PyQt problems with Spyder on Ubuntu 14.04 LTS - python

I've installed the latest version of Anaconda. The install went smoothly, but when I try to run Spyder I get a couple of run-time errors relating to PySide and PyQt. The final error message is:
RuntimeError: Please check Spyder installation requirements:
PyQt4 4.6+ (or PySide 1.2.0+) is required.
However, when I try to install PyQt, Ubuntu says I have the most up to date version. Also, conda list indicates that I have the following installed (I've excluded the other stuff as it isn't relevant):
pyqt 4.11.4 py35_1
qt 4.8.7 1
So Ubuntu seems to recognise that I have PyQt installed, but Spyder can't 'see' it.
To fix this, I attempted to install spyder3 via the package manager using
sudo apt-get install spyder3
The install completed without any errors, but running spyder3 led to the same PyQt error as before.
Could someone please advise me how to fix this? I'm fairly new to Ubuntu, so am not sure how to link Spyder to the required Qt files.

Finally managed to fix this and figured it was worth posting an update in case anyone else has the same issue.
After installing Anaconda I installed some 3rd party software (moose framework) which requires a series of modules to be loaded. One of these is miniconda.
The presence of miniconda seems to confuse Spyder - and stops it from working. By using:
module unload miniconda
I found that Spyder works as normal.

Related

Conda hangs on solving environment when installing PySide2

This has been discussed before but I cannot find any way to get this working with fixes I've seen. Conda hangs on solving environment when installing pyside2 with the forge channel. I have tried removing and readding the channel, reinstalling anaconda, and uninstalling anaconda, and installing miniconda instead. The last one kind of worked, the package started to be installed but crashed midway through. I was able to start qt designer but I couldn't import the pyside2 package.
Any ideas?

Spyder 4.1.3 always crashes after a few seconds

I have a problem with Spyder after updating it from 3.2.4 to 4.1.3 with
conda update spyder
The app didn't launch anymore and when I started it from the command prompt I got an error saying
File "C:\Users\TO3THY0\AppData\Local\conda\conda\envs\DataScience\lib\site-packages\spyder\plugins\ipythonconsole\widgets\debugging.py", line 22, in
from IPython.core.inputtransformer2 import TransformerManager ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'
So I installed ipython using
conda install iptyhon
If I now click on the spyder app on my desktop the app won't even open. If I type into the command prompt:
spyder
the app opens but crashes after a few seconds. I am using Anaconda 5.0.1 and python 3.6.3. Unfortunately I don't get an error message or anything so I am quite lost now...
As I am quite new to programming I am not sure what other information could help to solve this problem so I am sorry for the vague question. Any help to find the reason or even a solution to this problem is highly appreciated.
I have the latest version of anaconda and installation using conda update spyder is constricted by anaconda -> requires spyder==4.0.1=py37_0. I guess the option is to downgrade to 4.0.1 using conda install spyder=4.0.1. If this doesn't help, try to reinstall Anaconda. Actually, the Spyder maintainer recommends:
It's usually better to use a new conda env to try major Spyder versions, instead of updating things in the base env.

Python crashes when trying to start Anaconda navigator

I just installed the Anaconda package (64 bit, python 2.7) on my Windows 10.
Python itself works fine. The programmed code gets executed fine.
However, when I try to run the Anaconda Navigator or try to run conda command in the windows prompt python crashes.
A windows error pops up, telling me "Python has stopped working".
Does anyone have an idea how I can fix this? I tried to reinstall the Anaconda package, but it didn't work.
Generally uninstalling Anaconda might break the newer installations.
Try this, it help me solve similar issues with missing Anaconda Navigator and broken anaconda installations after an uninstallation.
Hope it helps you. :)
EDIT
The version of new packages should be the same with the base Miniconda.
For Python2 do conda install anaconda=5.3.1=py27_0 anaconda-navigator=1.9.6=py27_0.
The important thing to specify the Python 2.7 build.
You can search more information about packages with the conda show <package> command for versions and builds.

Spyder: No Python shell is currently selected

After I updated packages for python (matplotlib specifically), Spyder cannot find Python shell anymore. Upon running any script, I get
"Python 2.7.6 64bits, Qt 4.8.6, PyQt4 (API v2) 4.10.4 on Linux"
Also, for any of the consoles I open, I get a blank window. No usual >>>. The workspace doesn't load the values for pi and e as it would normally do
Many other online Q&A are about fixing the settings in preferences->run. Though that doesn't change anything for me
I got Spyder 2.2.5 and
Python 2.7.6 64bits, Qt 4.8.6, PyQt4 (API v2) 4.10.4 on Linux
I would be thankful for any help. What should I do?
Found solution:
Summary: reinstall spyder via pip.
In the process, in installed and reinstalled Spyder few times. Though that didn't help. After reading another Q&A, I figured I should install Spyder via pip. That worked:
sudo pip install spyder
Thanks for the help!

Could not find or load the Qt platform plugin "xcb"

On my OS(Linux Mint Debian Edition 2), except for the system python(/usr/bin/python) installed by the apt, I also installed the anaconda. But I've encounterd a problem running the following code with the anaconda python
# test.py
import matplotlib.pyplot as plt
import numpy as np
x = np.array([0, 1])
plt.scatter(x, x)
plt.show()
The error is
This application failed to start because it could not find or load the
Qt platform plugin "xcb".
Reinstalling the application may fix this problem.
Aborted
But if I try with the system python, i.e., /usr/bin/python test.py, it works correctly.
Then I tried the ipythons, of system and of anaconda, the result is same as before: the anaconda ipython kernel died.
And I tried add the ipython magic %matplotlib inline into the code, the anaconda ipython works correctly now. But if I replace the %matplotlib inline with %pylab, the anaconda ipython died again.
Note: I use the python 2.7. System ipython's version is 2.3, anaconda ipython's version is 3.2.
To fix this problem, I added to the top:
import matplotlib
matplotlib.use('Agg')
I have a CentOS7, Anaconda3-4.5.0, python3.5
pyqt version 5.6.0 and qt version 5.6.0
If you want to use the plot in a Tkinter window for visualisation then use:
matplotlib.use('TkAgg')
Same problem with Linux Mint 17, 64 bit. It was solved after 4h searching on the net! You need to give these commands on the terminal from folder /anaconda2/bin
sudo ./conda remove qt
sudo ./conda remove pyqt
sudo ./conda install qt
sudo ./conda install pyqt
Hope it helps!
I experienced this problem on Ubuntu 16.04 with anaconda 4.3.17 (Python 2.7). The issue stemmed from anaconda having Qt version 5.6 installed, while my system Qt libraries were at version 5.5.
A quick hack is to make sure Anaconda libraries precede your system libraries by setting LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=$HOME/anaconda2/lib:$LD_LIBRARY_PATH
Unfortunately, this will break other programs that use Qt 5.5, so you can only use it in situations that are 100% anaconda python, for example, if you're starting an ipython session with --pylab.
I discovered that this was the issue by looking at the way libxqcb.so was linked:
ldd $HOME/anaconda2/plugins/platforms/libqxcb.so
which reported the following errors:
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqxcb.so)
./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.6' not found (required by ./libqxcb.so)
The error messages are saying they can't find Qt_5.6, which is anaconda's version. The version on my system was 5.5, which I found out by looking at the filenames that resulted from this command:
ls /usr/lib/x86_64-linux-gnu/libQt*
This can also happen when using something like an ssh session to connect to for instance a piece of software that is using X11 graphical libraries as I recently discovered.
The issue occurs when trying to plot images in the graphical user interface, using:
cv2.imshow()
or
plot.show()
In this case you should either use ssh -XY or you should consider saving to a file instead such as
cv2.imwrite('file.png')
or
plt.savefig('file.png')
I had this problem when using a deep neural network that was originally geared towards being used in conjunction with Jupyter notebook. When writing the images to files instead of displays, the code the ran through multiple ssh tunnels without reporting the xcb and Qt bug.
By the way, it didn't matter what variant of Qt4 or Qt5 was installed. It still failed with the same error message.
I had to upgrade several python packages to make it work. In particular:
pip3 install --upgrade pyside2 pyqt5

Categories

Resources