I am using Python 3 on my ubuntu 14.04.2 (trusty), along with Python 2. I am trying to run
ipython --pylab, but with Python 3, this fails (works well with Python 2). It fails since it needs QT4/5 or PySide.
I could not install PySide, but I could easily install PyQt4 with
sudo aptitude install python3-pyqt4 python3-pyqt5
However, that doesn't seem to do the job. The output of
ipython --pylab is
ImportError: cannot import name 'QtCore'
matplotlib throws that error after trying to import
PyQt5. Funny thing, it fails exactly there even if PyQt5 is purged (but with the error
No module namedPyQt5`)
Is there anything wrong with either
matplotlib or with the
python3-pyqt4/5 packages? Is it possible that
python-pyqt4/5 do not even support
python3-pyqt5 and installing
ipython worked well with
pylab. This is documented in the SO question I was linking to.
pyside installed, I have installed
python3-pyqt5 again in order to answer a question from the comments, and now
QtCore is properly imported (both in
python and in
pylab is not working again.
The error is, however, much different:
ImportError: Could not load requested Qt binding. Please ensure that PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available, and only one is imported per session. Currently-imported Qt library: 'pyqt5' PyQt4 installed: False PyQt5 installed: False PySide >= 1.0.3 installed: True Tried to load: ['pyqt5']
%pylab again from within the
ipython console works. This is a very weird behaviour.
It seems that
pyside, without the ubuntu package
python3-pyqt5, does not really work. I can run
ipython --pylab with no errors that way, but when I try to
plot() or to
scatter(), it fails with
AttributeError: 'figure()' is not a Qt property or a signal
So, it seems the only way I can make
pylab work properly, it to install both
python3-pyqt5, see the weird
ImportError quoted above, trying
%pylab again, and work.