question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError with pandas 0.20.0 and 0.20.1

See original GitHub issue

Code Sample, a copy-pastable example if possible

With versions 0.20.0 and 0.20.1, I get the following error:

import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/smiel/.venvs/foo/local/lib/python2.7/site-packages/pandas/__init__.py", line 58, in <module>
    from pandas.io.api import *
  File "/home/smiel/.venvs/foo/local/lib/python2.7/site-packages/pandas/io/api.py", line 8, in <module>
    from pandas.io.clipboard.clipboard import read_clipboard
  File "/home/smiel/.venvs/foo/local/lib/python2.7/site-packages/pandas/io/clipboard/__init__.py", line 103, in <module>
    copy, paste = determine_clipboard()
  File "/home/smiel/.venvs/foo/local/lib/python2.7/site-packages/pandas/io/clipboard/__init__.py", line 76, in determine_clipboard
    return init_qt_clipboard()
  File "/home/smiel/.venvs/foo/local/lib/python2.7/site-packages/pandas/io/clipboard/clipboards.py", line 49, in init_qt_clipboard
    from PyQt4.QtGui import QApplication
ImportError: No module named sip

This does not occur with 0.19.2

Here are the other packages installed in my virtualenv

$ pip freeze
appdirs==1.4.3
numpy==1.12.1
packaging==16.8
pandas==0.20.1
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2017.2
PyYAML==3.12
six==1.10.0

Problem description

It would be nice if pandas was pip installable. As it stands, the new versions are not (for me).

Expected Output

No error when importing pandas.

Output of pd.show_versions()

I can’t get that info without being able to import pandas.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, May 8, 2017

Not exactly this error, but possibly related. For me the error with clipboard was something with from PyQt4 import QtCore. For some reason, I had an empty PyQt4 package in site-packages next to PyQt5 (so import PyQt4 did work, which is used to check which clipboard backend to use, but then later on actual imports raise an error), and for some reason this started to give problems. Matplotlib also had this problem, so I am not sure it was pandas-related.

0reactions
FragLegscommented, May 9, 2017

@jorisvandenbossche Shoot, I totally forgot that I had added a symlink to /usr/lib/python2.7/dist-packages/PyQt4 in my postmkvirtualenv script (as well as a symlink to /usr/lib/python2.7/dist-packages/sip.so). So yes, there is a PyQt4 directory in site-packages of the env I was testing in. Sorry about that bit of confusion.

fwiw - installing xclip does not solve the import problem for me.

@jreback Thanks for getting the fix merged so quickly! I can confirm that your commit works perfectly on my machine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes — pandas 0.20.1 documentation - PyData |
This is a combined release for 0.20.0 and and 0.20.1. ... Catch ImportError less aggressively in pandas/__init__.py (GH1845); Fix pip source installation ...
Read more >
How to solve import error for pandas? - python - Stack Overflow
ImportError : C extension: iNaT not built. If you want to import pandas from the source directory, you may need to run 'python...
Read more >
History — py_tools_ds 0.21.1 documentation - GFZ
Fixed TypeError in fill_holes_within_poly() in case older pandas version is installed. ... 0.20.2 (2022-02-10); 0.20.1 (2021-12-03); 0.20.0 (2021-11-24) ...
Read more >
iris.pandas — Iris 3.0.1 documentation - Read the Docs
Provide conversion to and from Pandas data structures. ... pandas >=0.20 except ImportError: from pandas.tseries.index import DatetimeIndex # pandas <0.20 ...
Read more >
Build failed using pipenv - Binder - Jupyter Community Forum
... environment e[91mAn error occurred while installing pandas==1.4.2 ... 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found