Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named sip #8

Closed
alefnula opened this issue Aug 3, 2013 · 12 comments
Closed

ImportError: No module named sip #8

alefnula opened this issue Aug 3, 2013 · 12 comments

Comments

@alefnula
Copy link

alefnula commented Aug 3, 2013

Installation: Anaconda-1.6.1-MacOSX-x86_64.pkg

Apparently sip is not packaged with pyside package, so when I run ipython qtconsole and try %pylab qt or just run the full command line: ipython qtconsole --pylab=qt I get the following exception:

/Users/viktor/anaconda/lib/python2.7/site-packages/matplotlib/backends/qt4_compat.py in <module>()
     34 # Now perform the imports.
     35 if QT_API in (QT_API_PYQT, QT_API_PYQTv2):
---> 36     import sip
     37     if QT_API == QT_API_PYQTv2:
     38         if QT_API_ENV == 'pyqt':

ImportError: No module named sip
@alefnula
Copy link
Author

alefnula commented Aug 5, 2013

Just to add a comment that on windows with the Anaconda-1.6.2-Windows-x86.exe and Anaconda-1.6.2-Windows-x86_64.exe installations everything works correctly.

@asmeurer
Copy link
Contributor

asmeurer commented Sep 6, 2013

So should imaging be a dependency of matplotlib?

@alefnula
Copy link
Author

alefnula commented Sep 6, 2013

I don't think this has anything to do with imaging. The problem is that the matplotlib somehow concluded that the PyQt4 library is installed and not the PySide library, so it tries to use it and import sip. Not sure why it concluded that :(.

@asmeurer
Copy link
Contributor

asmeurer commented Sep 6, 2013

It looks like this issue is fixed in the git master version of matplotlib https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/qt4_compat.py#L43.

@alefnula alefnula closed this as completed Sep 6, 2013
@alefnula
Copy link
Author

alefnula commented Sep 6, 2013

It looks like. I just thought it's something anaconda related since it works on windows and linux. The bug only manifests itself on MacOSX. (sorry I closed it accidentally, you should decide what to do with the issue.)

@alefnula alefnula reopened this Sep 6, 2013
@asmeurer
Copy link
Contributor

asmeurer commented Sep 6, 2013

So I think the easiest fix until the next release would be to make imaging a dependency of matplotlib, at least on Mac OS X.

@bmu
Copy link

bmu commented Nov 23, 2013

The same issue exists on linux if pyqt4 and pyside are installed.
However you can set the qt version with an environment variable (see the "qt4_compat.py" linked above):

export QT_API='pyside'

This works as a workaround for the issue on linux.

@tritemio
Copy link

tritemio commented Apr 7, 2014

I encountered the issue with Anaconda 1.9.1 on Mac OSX.

I solved it by choosing PySide as qt backend in matplotlibrc, like suggested here:

http://stackoverflow.com/questions/19231944/anaconda-unable-to-import-pylab

I use Anaconda on several machine and I never had this issue on WIndows or Linux.

@drevicko
Copy link

I just encountered this issue on osx with anaconda3 2.4.1.
anaconda didn't install pyside, but it's specified in ~/.matplotlib/.matplotlibrc, so matplotlib fails to import.
One solution would be to include pyside in anaconda?

@msarahan
Copy link
Contributor

Pyside is not nearly as well-developed as PyQt. Unless you are constrained by license requirements and are unable to use PyQt, we strongly recommend PyQt. PyQt is included with Anaconda. PySide is available as an add-on package:

conda install pyside

@drevicko
Copy link

I don't think you should close this issue, as it affects people with a default anaconda install: matplotlib doesn't work, which is pretty fundamental. The beauty and attraction of anaconda is that it "just works" - but in this case it doesn't...

I'm not sure what can/should be done, but at least some sort of warning would be in order. Or perhaps matplotlib for anaconda could be coerced into looking in the anaconda folder somewhere to find it's matplotlibrc, and build a new one there fitting the anaconda install.

Many new users of anaconda will have already been using matplotlib and have an rc file that may say pyside. They will all be affected by this (note the comment that on linux when both pyside and pyqt4 are installed, though that may be related to matplotlib/matplotlib#4883).

@msarahan
Copy link
Contributor

Thanks for your concern. Anaconda "just works" much of the time because it controls much of the system. Your issue gets into config files that are created by packages. These are just hard to keep track of in the general case. I feel like documenting the solution in several easy to find places is a better solution than trying to detect all possible problems across all possible upgrade paths. This particular issue with matplotlib might be relatively easy, but I don't want to commit anyone to expanding this over time.

What we might reasonably support would be a quick and easy way to clear config files to restore systems to a clean state, with a backup feature so that we aren't just blowing away everyone's stuff. If you agree with this approach, please create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants