Spyder: No Python shell is currently selected - python

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!

Related

Unable to run PythonWin For Python 3.9 64bit

I was trying to create Python executables on Windows 10 Pro (latest) so was upgrading to the latest packages but it's changed.
I've just gotten rid of Python 3.6 and reinstalled Python 3.9. I then went and installed PythonWin for it using the following (there no longer seems to be what was a standard install package):
**pip install pywin32**
Python is on the start menu but, unlike earlier installs, the new way of installing PythonWin this doesn't seem to give me any kind of way to run the program. Surely it should create some kind of shortcut on the start menu?
Any advice on this would be most helpful.
James
SOLVED!
While I still have no idea why a Start Menu shortcut wasn't installed, I have found the executable that runs PythonWin.
It was located in the following folder:
"C:\Users<MyUserID>\AppData\Local\Programs\Python\Python39\Lib\site-packages\pythonwin"
Thanks :)

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.

PyQt problems with Spyder on Ubuntu 14.04 LTS

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.

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

Spyder autocomplete doesn't work with 64-bit WinPython 2.7.5

In my installation of Spyder, autocomplete (ctrl+space) doesn't work in the editor (but does in the console). It looks like the same problem as this but I'm on Windows 7, so I can't pip install rope as the answer suggests.
My installation of Python is courtesy of WinPython and is version WinPython-64bit-2.7.5.2. It comes with Spyder 2.2.2.
I've attempted to get Spyder into debug mode with the --debug command line option, as described here, but it appears not to be available in this version of Spyder. (Spyder says no such option -d)
The follwing info may or may not be useful, from the Spyder about page:
Python 2.7.5 64bits, Qt 4.8.4, PyQt4 (API v2) 4.9.6 on Windows
Can anyone help get me going again? Without autocomplete I'm lost!
Many thanks,
Rob
When Spyder is bundled with WinPython it automatically comes with rope installed as part of the Spyder package. However, the Spyder 2.2.2 Windows installers shipped with the wrong version of rope, and code completion will not work. Fortunately, Spyder 2.2.3 has just been released, and upgrading Spyder will fix your problem. Use this procedure:
Download the binary installer spyder-2.2.3.win-amd64.exe from the Spyder downloads page.
Open up the WinPython Control Panel, which can be found in the root directory of your WinPython install.
Drag and drop the Spyder installer into the control panel, and then hit the "Install packages" button.
You should now be able to launch Spyder from the WinPython root directory using the executable there, and code completion should be fixed.

Categories

Resources