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

Issue with Spyder in Python 3.6 #6934

Closed
jordanlui opened this issue Apr 10, 2018 · 29 comments
Closed

Issue with Spyder in Python 3.6 #6934

jordanlui opened this issue Apr 10, 2018 · 29 comments

Comments

@jordanlui
Copy link

jordanlui commented Apr 10, 2018

Problem Description

Having issues running Spyder on Python Environments that are not my base environment.
In Spyder for Python 3.4, 3.5, 3.6, I can't get Spyder to launch, if I try in Win Cmd Prompt it cites some issue with PySide.
I setup environment with Python 3.3 and my Spyder install forced me to upgrade to 3.6. I can get Spyder to work and sometimes run a basic line, but I get cache error messages in terminal when I try to run a script.
I don't have problems in my base environment which runs Python 2.7

What steps will reproduce the problem?

  1. Open Spyder for Python 3.3 via Windows Start Menu, Win Cmd Prompt or Git bash
  2. Run a script or basic line like 4/3
  3. Watch Kernel crash and see error output in terminal

What is the expected output? What do you see instead?

Here is result I see when I launch via Git Bash with Administrator Privileges. These errors appear before I can run a single python command in Spyder.

$ spyder
[15764:14556:0409/214138.627:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5
[15764:14556:0409/214138.627:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\Jordan\AppData\Local\Spyder\QtWebEngine\Default\GPUCache to C:\Users\Jordan\AppData\Local\Spyder\QtWebEngine\Default\old_GPUCache_000
[15764:14556:0409/214138.627:ERROR:cache_creator.cc(134)] Unable to create cache
[15764:14556:0409/214138.627:ERROR:shader_disk_cache.cc(570)] Shader Cache Creation failed: -2

I can then run some basic commands in Spyder IDE like 4/3 but can't execute scripts.

If I launch via Windows Start Menu I get the error but just see the kernel restarting.

(py33) C:\Users\Jordan>spyder
Traceback (most recent call last):
  File "C:\Users\Jordan\Anaconda2\envs\py33\lib\site-packages\qtpy\__init__.py", line 163, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Jordan\Anaconda2\envs\py33\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Jordan\Anaconda2\envs\py33\lib\site-packages\spyder\app\start.py", line 159, in main
    from spyder.app import mainwindow
  File "C:\Users\Jordan\Anaconda2\envs\py33\lib\site-packages\spyder\app\mainwindow.py", line 49, in <module>
    requirements.check_qt()
  File "C:\Users\Jordan\Anaconda2\envs\py33\lib\site-packages\spyder\requirements.py", line 39, in check_qt
    import qtpy
  File "C:\Users\Jordan\Anaconda2\envs\py33\lib\site-packages\qtpy\__init__.py", line 169, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

However I am unable to install PySide since it appears to require Python 3.3. Should I force a downgrade to Python 3.3 to get this working? Is this safe?

Paste Traceback/Error Below (if applicable)

Package Versions

  • Spyder: 3.2.8 but listing for version py36_0. Not sure if this is common
  • Python: 3.6.5 (Initially installed Python 3.3, but noticed that Spyder forced this update)
  • Qt: 5.9.4
  • PyQt: 5.9.2
  • Operating System: Win10 64bit

Dependencies

IPython >=4.0    :  6.3.1 (OK)
cython >=0.21    :  None (NOK)
jedi >=0.9.0     :  0.11.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.14.2 (OK)
pandas >=0.13.1  :  None (NOK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.4 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.2 (OK)
sympy >=0.7.3    :  None (NOK)

@ccordoba12
Copy link
Member

Did you use pip to install pyqt5 at some point?

@jordanlui
Copy link
Author

jordanlui commented Apr 10, 2018

@ccordoba12 Almost positive that I have not done pip install of pyqt5
To test my issues, I wiped my Anaconda install and started fresh, and then started creating environments and seeing my errors arise. So conda list shows pyqt 5.6.0 for python build py36_2.

Should I try a pip install now?

Thanks,

Note I do have a completely separate (non-anaconda) Python 3 install on my machine which has QtPy 1.3.1 installed via pip, but pyqt is not listed. I hope this isn't adding to my issues.

@CAM-Gerlach
Copy link
Member

Should I try a pip install now?

No, that's a sure way to break your Anaconda install.

Make sure you are launching Spyder from the Anaconda prompt or Anaconda Navigator; launching from the normal command prompt or Git Bash will use your system Python version which will not work with Spyder since it won't have the right compiled packages installed (like PyQt, which is why you're likely seeing the PySide error as a fallback). PySide hasn't been supported by Spyder for a long time; 3.3 will move to PyQt5 only for the time being.

In any case it looks like it can't find your Qt bindings; Spyder thinks you have Qt/PyQt 5.9.x installed which could also pose a problem since we don't officially support it yet I believe. In any case, unless user error is involved somewhere most likely something's amiss with your Anaconda install, in which case a clean reinstall is the most reliable solution. Other than that, please try the steps listed in the Spyder Troubleshooting Guide, specifically the Basic First Aid and Emergency CPR sections, which resolve the great majority of Spyder installation issues.

@jordanlui
Copy link
Author

Thanks for response!
I should have clarified: my launches from Win Cmd Prompt or Git Bash are within an activated anaconda environment - so they should target my specific env that I am having trouble with.

Also: My recent attempts have been with a fresh install of Anaconda.

I tried all tips in troubleshoot guide that I can easily test now, including updating spyder and anaconda.

I'm going to to wipe my Anaconda2 and install Anaconda3 instead, and see if my issues persist.

Thanks,
Jordan

@CAM-Gerlach
Copy link
Member

I should have clarified: my launches from Win Cmd Prompt or Git Bash are within an activated anaconda environment

Okay, so you set up your $PATH$, , environment variables, etc. accordingly?

I'm going to to wipe my Anaconda2 and install Anaconda3 instead, and see if my issues persist.

I don't regularly do so thus I can't comment specifically, but I have seen statements to the effect that running Python 3 and Spyder in an Anaconda2 environment can cause problems generally...

so they should target my specific env that I am having trouble with.

Oh, so it is a specific environment? Can you isolate the problem to any specific packages in that environment? Did you try creating a clean one with just Spyder?

Other than that, anything specific to your setup in terms of packages, etc. installed?

Also, could you try downgrading to Qt/PyQt 5.6 and seeing if the problems persist?

@jordanlui
Copy link
Author

jordanlui commented Apr 11, 2018

Hi Cam,
I setup PATH and Environment variables for my base install (and also tried inserting for my additional anaconda environment, but this hasn't fixed my issues.

Yes I was having issues getting spyder in anaconda2 with any non-base python3 environments. I did an entire clean install of anaconda2 to replicate my issues and they still persisted. I only ran following commands and encountered issues above. Thus I don't think my issues are coming from specific packages that I decided to install.

activate mypy3
conda install spyder

Throughout this period I can get spyder working for my base python2.7 install.

Just to stir the pot more:

On the flipside, I wiped my anaconda2 install and switched to anaconda3.

In my base Py3 env

I can now get Spyder to launch from Win Start menu or Anaconda Nav, but not from Win Cmd, Git Bash, or Anaconda Prompt.

In my other Py2 env

Now I create a virtual env with Python 2. I get the whole flipped situation: I now have Qt problems in this new environment. I cannot open Spyder by any method.

Is it feasible to maintain separate installs of ananconda2 and anaconda3? It's looking like my only option to having working py2 and py3 spyder instances working successfully.

I checked my Qt versions. All versions are 5.6.x era and I'm still having issues.
Both my base Py3 env and my other Py2 env are running PyQt 5.6.0 and qt 5.6.2. Py2 is running qtpy 1.4.0 and Py3 is running qtpy 1.3.1

When I try to launch Spyder for my virtual env with Py2

File "C:\Users\Jordan\Anaconda3\envs\mypy2\Scripts\spyder-script.py", line 10, in 
sys.exit(main())
File "C:\Users\Jordan\Anaconda3\envs\mypy2\lib\site-packages\spyder\app\start.py", line 159, in main
from spyder.app import mainwindow
File "C:\Users\Jordan\Anaconda3\envs\mypy2\lib\site-packages\spyder\app\mainwindow.py", line 49, in 
requirements.check_qt()
File "C:\Users\Jordan\Anaconda3\envs\mypy2\lib\site-packages\spyder\requirements.py", line 39, in check_qt
import qtpy
File "C:\Users\Jordan\Anaconda3\envs\mypy2\lib\site-packages\qtpy\__init__.py", line 169, in 
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

Trying to force Spyder install when creating env

One other idea I tried: forcing installation of Spyder at outset of env creation
I tried conda create -n myenv spyder python=2.7
Seem to get identical error:

File "C:\Users\Jordan\Anaconda3\envs\testpy2\Scripts\spyder-script.py", line 10, in 
sys.exit(main())
File "C:\Users\Jordan\Anaconda3\envs\testpy2\lib\site-packages\spyder\app\start.py", line 159, in main
from spyder.app import mainwindow
File "C:\Users\Jordan\Anaconda3\envs\testpy2\lib\site-packages\spyder\app\mainwindow.py", line 49, in 
requirements.check_qt()
File "C:\Users\Jordan\Anaconda3\envs\testpy2\lib\site-packages\spyder\requirements.py", line 39, in check_qt
import qtpy
File "C:\Users\Jordan\Anaconda3\envs\testpy2\lib\site-packages\qtpy\__init__.py", line 169, in 
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

@jordanlui
Copy link
Author

Found resolution to my issue, and going to close this now. I am really sorry if I've wasted a lot of people's time.

Issue resolution in my case has to do with Win10 Administrator problems - even though I am sole admin on my laptop.

In my newest fresh install of Anaconda3, I could launch Spyder via Win Start Menu with its default settings, without needing to run as admin.

I now found I can launch Spyder for my secondary Py2 env by opening via Win Start Menu and running as Admin. I can also launch Spyder for my secondary Py2 env by running Win Cmd as admin, activating env, and then running Spyder. The Qt errors don't show up when I elevate.

This seems to be a recurring issues in my Win10 installs but I somehow couldn't mouse this out in my prior Anaconda2 install where I had Py2 base and Py3 in a secondary env.

Thanks for all the guidance!

@CAM-Gerlach
Copy link
Member

Interesting. I've installed Anaconda3 and launched Spyder by both shortcut and Anaconda Prompt in both Py2 and Py3 in Anaconda3 on both Win 8.1 and Win 10, both for all users and for my own admin and non-admin account, and never run into this problem without any elevation, Not sure exactly what would be different about your situation, but good to have another datapoint. Also, the Troubleshooting guide does mention installing by different means (admin and not), starting by different means (shortcut, Navigator, command line, etc) and elevating/running as administrator.

@sky-kryst
Copy link

@CAM-Gerlach
Copy link
Member

@skykryst FYI, this is a closed issue from nearly a year ago, and Spyder currently only officially supports PyQt5 (the SO question you link is only about a problem with PySide), at least until the PySide/QtfP 5.12 ecosystem matures and Qt 5.12 LTS is available as a conda package; therefore, its not really a Spyder-relevant problem.

@dberrian
Copy link

I managed to solve that as follow:
1- Run this on Anaconda prompt : conda install -c anaconda pyqt
2 - Uninstall and install Spyder through Anaconda navigator.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Feb 20, 2019

Glad you got your problem resolved. However, do not that as I state in the comment directly above yours, this is unlikely to be an identical or even particularly similar problem to the one reported in the OP. The correct procedure to do all of this should be simply conda install --force-reinstall pyqt qt qtpy spyder from the Anaconda prompt.

conda install -c anaconda pyqt

The anaconda channel is just a mirror of the defaults AD channel; therefore the packages you are getting from it are no different from defaults. Therefore, it is equivalent to doing conda install --force-reinstall -c defaults pyqt, with -c defaults only being necessary if you've mixed around packages from other channels into your environment (which could certainly be a cause of the problem).

Uninstall and install Spyder through Anaconda navigator.

This is no different than doing conda install --force-reinstall -c defaults spyder from the Anaconda prompt you were just using in the last command, except with the added potential for problems due to bugs in Navigator (which appear to be quite frequent).

@Mark531
Copy link

Mark531 commented Mar 4, 2019

I have the same issue. As you suggested, I ran:

conda install --force-reinstall pyqt qt qtpy spyder

But I still get the error when running spyder:

Traceback (most recent call last):
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\qtpy_init_.py", line 199, in
from PySide import version as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\app\start.py", line 200, in main
from spyder.app import mainwindow
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 48, in
requirements.check_qt()
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\requirements.py", line 41, in check_qt
import qtpy
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\qtpy_init_.py", line 205, in
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

@CAM-Gerlach
Copy link
Member

@Mark531 Sorry you're seeing an error; I suspect something is going on with your environment. Open Anaconda prompt in the environment in which you tried to open Spyder, type spyder, and confirm you again see the above traceback. Then, assuming you still have the error, post the full ouptut of conda list --show-channel-urls inside a <details> literal block, like this (you can quote my post to see how to do it):

CONDA LIST HERE

@Mark531
Copy link

Mark531 commented Mar 5, 2019

@CAM-Gerlach Thanks for your help. But in the meanwhile, I managed to fix the issue by running commands suggested by a guy on stackoverflow:

pip install msgpack
conda install qt=5.6 pyqt=5.6 sip=4.18

Now, spyder opens without problem.

@CAM-Gerlach
Copy link
Member

@Mark531 , I certainly hope you didn't run those commands (or any commands suggested by a random person on SO) in your base (default) Anaconda environment (especially anything involving pip or conda-forge) rather than a separate isolated one, as you stand a good chance of causing problems with your entire Anaconda install if you run commands there without fully understanding what they do. This is why I wanted to look at your environment to determine what the problem was before blindly suggesting possibilities.

pip install msgpack

Almost certainly irrelevant to the problem; msgpack is not a Spyder dependency and likely to cause issues with anything that does use it, as you installed it from pip rather than conda. pip might have installed further dependencies as well so there's no telling what future problems this might cause.

conda install qt=5.6 pyqt=5.6 sip=4.18

This installs the old 5.6.x versions of Qt/PyQt; you should upgrade to the 5.9.x versions with conda install pyqt=5.9. If the problem re-occurs, then at least you've isolated the apparent actual cause and you can just downgrade again with conda install pyqt=5.6; otherwise, you'll be using a more recent version of Qt (at some point, support for 5.6 will be dropped in Anaconda). Thanks.

@Mark531
Copy link

Mark531 commented Mar 6, 2019

I guess the guy precisely suggested to downgrade the version of pyqt because a later version was not fully supported. And this is the case indeed.
I updated pyqt with your command:

conda install pyqt=5.9

And I get back the error when I try to run spyder:

Traceback (most recent call last):
File "C:\Users\I328807\AppData\Local\Continuum\Anaconda3\lib\site-packages\qtpy_init_.py", line 199, in
from PySide import version as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

@CAM-Gerlach
Copy link
Member

I guess the guy precisely suggested to downgrade the version of pyqt because a later version was not fully supported.

Yes indeed, occasionally some systems have problems with one Qt version or the other, bt that usually comes down to issues with their GPU, graphics driver or occasionally other installed software, and usually result in a segfault or other cryptic error rather than the one above (which indicates QtPy isn't able to find any Qt bindings at all). Any reasonably recent version of Spyder and QtPy fully supports both versions, so either the versions on your machine are out of date, something else in your Anaconda environment is causing issues, or perhaps there's some other sort of machine-specific issue. If you share your conda list --show-channel-urls output, I can at least let you know how to fix one of the first two so they don't cause problems in the future (since Qt 5.6 won't be supported forever).

@Mark531
Copy link

Mark531 commented Mar 7, 2019

Sure, here is the list of the packages in my current environment:

> # Name                    Version                   Build  Channel
> _license                  1.1                      py36_1    defaults
> _tflow_select             2.1.0                       gpu    defaults
> absl-py                   0.7.0                    py36_0    defaults
> alabaster                 0.7.9                    pypi_0    pypi
> anaconda                  4.0.0               np110py35_0    defaults
> anaconda-client           1.7.2                    py36_0    defaults
> anaconda-navigator        1.9.6                    py36_0    defaults
> argcomplete               1.9.4                    py36_0    defaults
> asn1crypto                0.24.0                   py36_0    defaults
> astor                     0.7.1                    py36_0    defaults
> astroid                   1.4.8                    pypi_0    pypi
> astropy                   1.1.2                    pypi_0    pypi
> atomicwrites              1.2.1                    py36_0    defaults
> attrs                     18.2.0           py36h28b3542_0    defaults
> babel                     2.3.4                    pypi_0    pypi
> backcall                  0.1.0                    py36_0    defaults
> backports                 1.0                      py36_1    defaults
> backports.os              0.1.1                    py36_0    defaults
> beautifulsoup4            4.6.3                    py36_0    defaults
> bitarray                  0.8.3            py36hfa6e2cd_0    defaults
> blas                      1.0                         mkl    defaults
> blaze                     0.9.1                    py35_0    defaults
> bleach                    3.0.2                    py36_0    defaults
> bokeh                     1.0.3                    py36_0    defaults
> boto                      2.49.0                   py36_0    defaults
> bottleneck                1.0.0                    pypi_0    pypi
> bzip2                     1.0.6                hfa6e2cd_5    defaults
> ca-certificates           2019.1.23                     0    defaults
> certifi                   2018.11.29               py36_0    defaults
> cffi                      1.11.5           py36h74b6da3_1    defaults
> chardet                   3.0.4                    py36_1    defaults
> chest                     0.2.3                    py36_1    defaults
> click                     7.0                      py36_0    defaults
> cloudpickle               0.6.1                    py36_0    defaults
> clyent                    1.2.2                    py36_1    defaults
> colorama                  0.3.7                    pypi_0    pypi
> comtypes                  1.1.7                    py36_0    defaults
> conda                     4.6.7                    py36_0    defaults
> conda-build               1.20.0                   py35_0    defaults
> conda-env                 2.6.0                h36134e3_1    defaults
> configobj                 5.0.6                    py36_1    defaults
> console_shortcut          0.1.1                         3    defaults
> cryptography              2.5              py36h7a1dbc1_0    defaults
> cudatoolkit               9.0                           1    defaults
> cudnn                     7.3.1                 cuda9.0_0    defaults
> curl                      7.60.0               h7602738_0    defaults
> cycler                    0.10.0           py36h009560c_0    defaults
> cython                    0.28.5           py36h6538335_0    defaults
> cytoolz                   0.9.0.1          py36hfa6e2cd_1    defaults
> dask                      1.0.0                    py36_0    defaults
> dask-core                 1.0.0                    py36_0    defaults
> datashape                 0.5.4                    py36_1    defaults
> decorator                 4.0.10                   pypi_0    pypi
> dill                      0.2.8.2                  py36_0    defaults
> distributed               1.25.1                   py36_0    defaults
> docutils                  0.12                     pypi_0    pypi
> doit                      0.30.3                   pypi_0    pypi
> dynd-python               removed                       0    defaults
> entrypoints               0.2.2                    pypi_0    pypi
> enum34                    1.1.6                    pypi_0    pypi
> et_xmlfile                1.0.1            py36h3d2d736_0    defaults
> fastcache                 1.0.2            py36hfa6e2cd_2    defaults
> flask                     1.0.2                    py36_1    defaults
> flask-cors                3.0.7                    py36_0    defaults
> freetype                  2.8                  h51f8f2c_1    defaults
> gast                      0.2.2                    py36_0    defaults
> gevent                    1.3.6            py36hfa6e2cd_0    defaults
> greenlet                  0.4.15           py36hfa6e2cd_0    defaults
> grpcio                    1.12.1           py36h1a1b453_0    defaults
> h5py                      2.8.0            py36h3bdd7fb_2    defaults
> hdf5                      1.10.2               hac2f561_1    defaults
> heapdict                  1.0.0                    py36_2    defaults
> icc_rt                    2017.0.4             h97af966_0    defaults
> icu                       58.2                 ha66f8fd_1    defaults
> idna                      2.8                      py36_0    defaults
> imagesize                 0.7.1                    pypi_0    pypi
> importlib_metadata        0.6                      py36_0    defaults
> intel-openmp              2018.0.3                      0    defaults
> ipykernel                 4.5.0                    pypi_0    pypi
> ipython                   5.1.0                    pypi_0    pypi
> ipython-genutils          0.1.0                    pypi_0    pypi
> ipython_genutils          0.2.0            py36h3c5d0ee_0    defaults
> ipywidgets                7.4.2                    py36_0    defaults
> isort                     4.2.5                    pypi_0    pypi
> itsdangerous              1.1.0                    py36_0    defaults
> jdcal                     1.4                      py36_0    defaults
> jedi                      0.9.0                    pypi_0    pypi
> jinja2                    2.8                      pypi_0    pypi
> jpeg                      9b                   hb83a4c4_2    defaults
> jsonschema                2.5.1                    pypi_0    pypi
> jupyter                   1.0.0                    py36_7    defaults
> jupyter-client            4.4.0                    pypi_0    pypi
> jupyter-core              4.2.0                    pypi_0    pypi
> jupyter_client            5.2.4                    py36_0    defaults
> jupyter_console           6.0.0                    py36_0    defaults
> jupyter_core              4.4.0                    py36_0    defaults
> keras                     2.2.4                         0    defaults
> keras-applications        1.0.6                    py36_0    defaults
> keras-base                2.2.4                    py36_0    defaults
> keras-preprocessing       1.0.5                    py36_0    defaults
> keyring                   17.0.0                   py36_0    defaults
> kiwisolver                1.0.1            py36h6538335_0    defaults
> lazy-object-proxy         1.2.2                    pypi_0    pypi
> libcurl                   7.60.0               hc4dcbb0_0    defaults
> libdynd                   0.7.2                         0    defaults
> libiconv                  1.15                 h1df5818_7    defaults
> libpng                    1.6.36            h7602738_1000    conda-forge
> libprotobuf               3.6.0                h1a1b453_0    defaults
> libsodium                 1.0.3                         0    defaults
> libssh2                   1.8.0                h7a1dbc1_4    defaults
> libtiff                   4.0.9                hb8ad9f9_1    defaults
> libxml2                   2.9.8                hadb2253_1    defaults
> libxslt                   1.1.32               hf6f1972_0    defaults
> llvmlite                  0.24.0           py36h6538335_0    defaults
> locket                    0.2.0            py36hfed976d_1    defaults
> lxml                      4.2.5            py36hef2cd61_0    defaults
> m2w64-gcc-libgfortran     5.3.0                         6    defaults
> m2w64-gcc-libs            5.3.0                         7    defaults
> m2w64-gcc-libs-core       5.3.0                         7    defaults
> m2w64-gmp                 6.1.0                         2    defaults
> m2w64-libwinpthread-git   5.0.0.4634.697f757               2    defaults
> markdown                  3.0.1                    py36_0    defaults
> markupsafe                0.23                     pypi_0    pypi
> matplotlib                2.2.2            py36h153e9ff_1    defaults
> mccabe                    0.5.2                    pypi_0    pypi
> menuinst                  1.4.14           py36hfa6e2cd_0    defaults
> mistune                   0.7.3                    pypi_0    pypi
> mkl                       2018.0.3                      1    defaults
> mkl-service               1.1.2            py36hb217b18_5    defaults
> mkl_fft                   1.0.6            py36hdbbee80_0    defaults
> mkl_random                1.0.1            py36h77b88f5_1    defaults
> more-itertools            4.3.0                    py36_0    defaults
> mpmath                    1.1.0                    py36_0    defaults
> msgpack-python            0.5.6            py36he980bc4_1    defaults
> msys2-conda-epoch         20160418                      1    defaults
> multipledispatch          0.6.0                    py36_0    defaults
> mypy                      0.620                    pypi_0    pypi
> nbconvert                 4.2.0                    pypi_0    pypi
> nbformat                  4.1.0                    pypi_0    pypi
> networkx                  2.2                      py36_1    defaults
> nltk                      3.4                      py36_1    defaults
> nose                      1.3.7                    py36_2    defaults
> notebook                  5.7.4                    py36_0    defaults
> numba                     0.24.0                   pypi_0    pypi
> numexpr                   2.6.8            py36h9ef55f4_0    defaults
> numpy                     1.11.2                   pypi_0    pypi
> numpy-base                1.15.4           py36h8128ebf_0    defaults
> numpydoc                  0.8.0                    py36_0    defaults
> odo                       0.5.1            py36h7560279_0    defaults
> olefile                   0.46                     py36_0    defaults
> openpyxl                  2.5.12                   py36_0    defaults
> openssl                   1.1.1b               he774522_0    defaults
> overrides                 1.9                      pypi_0    pypi
> packaging                 18.0                     py36_0    defaults
> pandas                    0.23.4           py36h830ac7b_0    defaults
> pandoc                    2.2.3.2                       0    defaults
> pandocfilters             1.4.2                    py36_1    defaults
> parso                     0.3.1                    py36_0    defaults
> partd                     0.3.9                    py36_0    defaults
> path.py                   11.5.0                   py36_0    defaults
> patsy                     0.5.1                    py36_0    defaults
> pep8                      1.7.0                    pypi_0    pypi
> pickleshare               0.7.4                    pypi_0    pypi
> pillow                    5.2.0                    pypi_0    pypi
> pip                       18.0                     pypi_0    pypi
> pluggy                    0.8.0                    py36_0    defaults
> ply                       3.11                     py36_0    defaults
> prometheus_client         0.5.0                    py36_0    defaults
> prompt-toolkit            1.0.7                    pypi_0    pypi
> prompt_toolkit            2.0.7                    py36_0    defaults
> protobuf                  3.6.0            py36he025d50_0    defaults
> psutil                    4.3.1                    pypi_0    pypi
> py                        1.7.0                    py36_0    defaults
> pyasn1                    0.4.4            py36h28b3542_0    defaults
> pycodestyle               2.4.0                    py36_0    defaults
> pycosat                   0.6.3            py36hfa6e2cd_0    defaults
> pycparser                 2.19                     py36_0    defaults
> pycrypto                  2.6.1            py36hfa6e2cd_9    defaults
> pyedflib                  0.1.11                   pypi_0    pypi
> pyflakes                  1.3.0                    pypi_0    pypi
> pygments                  2.1.3                    pypi_0    pypi
> pyhdb                     0.3.3                    pypi_0    pypi
> pylint                    1.6.4                    pypi_0    pypi
> pyopenssl                 18.0.0                   py36_0    defaults
> pyparsing                 2.3.0                    py36_0    defaults
> pyqt                      5.9.2            py36h6538335_2    defaults
> pyreadline                2.1                      py36_1    defaults
> pysocks                   1.6.8                    py36_0    defaults
> pytables                  3.2.2               np110py35_2    defaults
> pytest                    4.0.2                    py36_0    defaults
> python                    3.6.0                         2    conda-forge
> python-dateutil           2.7.5                    py36_0    defaults
> python-pptx               0.6.12                   pypi_0    pypi
> pytz                      2016.7                   pypi_0    pypi
> pywin32                   223              py36hfa6e2cd_1    defaults
> pywinpty                  0.5.5                 py36_1000    defaults
> pyyaml                    3.13             py36hfa6e2cd_0    defaults
> pyzmq                     15.4.0                   pypi_0    pypi
> qt                        5.9.7            vc14h73c81de_0    defaults
> qtawesome                 0.3.3                    pypi_0    pypi
> qtconsole                 4.2.1                    pypi_0    pypi
> qtpy                      1.1.2                    pypi_0    pypi
> requests                  2.21.0                   py36_0    defaults
> rope                      0.11.0                   py36_0    defaults
> rope-py3k                 0.9.4.post1              pypi_0    pypi
> ruamel_yaml               0.15.46          py36hfa6e2cd_0    defaults
> scikit-image              0.12.3              np110py35_0    defaults
> scikit-learn              0.20.0           py36heebcf9a_1    defaults
> scipy                     1.1.0            py36h4f6bf74_1    defaults
> seaborn                   0.8.1                    pypi_0    pypi
> send2trash                1.5.0                    py36_0    defaults
> setuptools                28.2.0                   pypi_0    pypi
> shap                      0.27.0           py36h452e1ab_0    conda-forge
> simplegeneric             0.8.1                    pypi_0    pypi
> singledispatch            3.4.0.3          py36h17d0c80_0    defaults
> sip                       4.19.8           py36h6538335_0    defaults
> six                       1.10.0                   pypi_0    pypi
> snowballstemmer           1.2.1                    pypi_0    pypi
> sockjs-tornado            1.0.6                    py36_0    defaults
> sortedcontainers          2.1.0                    py36_0    defaults
> sphinx                    1.4.8                    pypi_0    pypi
> sphinx_rtd_theme          0.4.2                    py36_0    defaults
> sphinxcontrib             1.0                      py36_1    defaults
> sphinxcontrib-websupport  1.1.0                    py36_1    defaults
> spyder                    3.0.0                    pypi_0    pypi
> spyder-kernels            0.4.2                    py36_0    defaults
> sqlalchemy                1.2.16                   pypi_0    pypi
> sqlite                    3.26.0            hfa6e2cd_1000    conda-forge
> statsmodels               0.9.0            py36h452e1ab_0    defaults
> sympy                     1.3                      py36_0    defaults
> tblib                     1.3.2            py36h30f5020_0    defaults
> tensorboard               1.12.0           py36he025d50_0    defaults
> tensorflow                1.12.0          gpu_py36ha5f9131_0    defaults
> tensorflow-base           1.12.0          gpu_py36h6e53903_0    defaults
> termcolor                 1.1.0                    py36_1    defaults
> terminado                 0.8.1                    py36_1    defaults
> testpath                  0.4.2                    py36_0    defaults
> tk                        8.6.7                hcb92d03_3    defaults
> toolz                     0.9.0                    py36_0    defaults
> tornado                   4.4.2                    pypi_0    pypi
> tqdm                      4.31.1                     py_0    conda-forge
> traitlets                 4.3.1                    pypi_0    pypi
> typed-ast                 1.1.0                    pypi_0    pypi
> unicodecsv                0.14.1           py36h6450c06_0    defaults
> urllib3                   1.24.1                   py36_0    defaults
> vc                        14.1                 h0510ff6_4    defaults
> vs2015_runtime            15.5.2                        3    defaults
> wcwidth                   0.1.7                    pypi_0    pypi
> webencodings              0.5.1                    py36_1    defaults
> werkzeug                  0.14.1                   py36_0    defaults
> wget                      3.2                      pypi_0    pypi
> wheel                     0.32.3                   py36_0    defaults
> widgetsnbextension        3.4.2                    py36_0    defaults
> win-unicode-console       0.5                      pypi_0    pypi
> win_inet_pton             1.0.1                    py36_1    defaults
> wincertstore              0.2              py36h7fe50ca_0    defaults
> winpty                    0.4.3                         4    defaults
> wrapt                     1.10.8                   pypi_0    pypi
> xlrd                      1.2.0                    py36_0    defaults
> xlsxwriter                1.1.2                    py36_0    defaults
> xlwings                   0.15.1                   py36_0    defaults
> xlwt                      1.3.0            py36h1a4751e_0    defaults
> yaml                      0.1.7                hc54c509_2    defaults
> zict                      0.1.3                    py36_0    defaults
> zlib                      1.2.11               h8395fce_2    defaults

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Mar 7, 2019

@Mark531 Thanks. I enclosed it in details tags and a verbatim block for as I requested; since without that it takes up a huge amount of space in the thread and is very difficult to read.

In any case, your issue is immediately apparent: you have installed a large number of packages in your environment via pip, while others are installed from conda-forge, and still others from defaults; furthermore, many of the pip versions are years and years old, such as Spyder 3.0.0 (current is 3.3.3, with Spyder 4 in beta); 3.0.0 is over 2 1/2 years old) and QtPy 1.1.x. Needless to say, mixing packages from all three sources, and both ancient and up to date versions, is a recipe for unmitigated disaster; I'm honestly surprised Spyder even launched at all. The reason it worked with Qt 5.6 but not with 5.9 was due to Spyder only being fully compatible with the latter as of like 3.2.8 or 3.3.0 (or thereabouts), whereas that ancient version apparently still happened to work with 5.6. Without drastic action, you are likely to have numerous problems in the future trying to use, update and install other packages, as well as Spyder itself, and we of course cannot support a version that far out of date.

In any case, assuming that's your base environment (the one activated by default opening Anaconda prompt), I would honestly recommend just completely uninstalling Anaconda and doing a clean install, since the environment is so heavily contaminated. Then, use Spyder from base but create fresh, isolated environments if you need to install conda-forge or pip packages, so they don't mess with your Spyder install nor Anaconda itself and if something goes wrong, you can easily fix, remove or recreate just that one environment rather than your whole Anaconda install. Check out our guide to working with packages and envronments with Spyder for more on that. Thanks, and best of luck!

@kr-praveen
Copy link

This error means that you installed pyqt5 with pip along side the pyqt conda package. It could be solved by you uninstalling the pip package.
Try:
pip uninstall PyQt5
Then update conda:
conda update conda
conda update anaconda-navigator

It will surely resolve your problem

@CAM-Gerlach
Copy link
Member

We appreciate you trying to help and share something that worked for you on a superficially similar error, but if you are going to post a potential solution, please do so on an open, non-duplicate issue and take care to read the actual issue report, as in both these cases the issue was not caused by the same problem and would not be fixed by your solution, and furthermore was already resolved and closed. Thanks.

This error means that you installed pyqt5 with pip along side the pyqt conda package.

This is but one of many potential causes of this error, the reporter explicitly stated that they have not used pip to install PyQt5 at any point, so it of course cannot be the case here, There are many other cases of this error as well which your suggestion will not surely resolve your problem.

conda update conda

Not explicitly necessary, but doesn't hurt.

conda update anaconda-navigator

The Anaconda Navigator GUI doesn't have anything to do with this; I'm not sure why you're suggesting it.

The above is also missing a crucial step for many if not most such cases, which is ensuring the conda PyQt package is installed properly: conda install --force-reinstall pyqt qt.

@Mark531
Copy link

Mark531 commented Mar 13, 2019

Sure, I have installed packaged from various sources because default conda channels did not contain the latest versions.

So, I installed a fresh version of Anaconda, but since it was not available for python 3.6 (I use a library that only works in python 3.6), I created a virtual environment. After activating it and running spyder, the interpreter was yet python 3.7... I had to manually change the interpreter. Well, it would be simpler to make available an Anaconda installer for python 3.6.

@CAM-Gerlach
Copy link
Member

I have installed packaged from various sources because default conda channels did not contain the latest versions.

Well, your pip-installed package versions were uniformly, in every case I checked (over a dozen off the top of my head), several years out of date; in many cases installed simultaneously (a sure recipe for disaster) with far newer conda-installed versions.

Sometime conda defaults can lag a few days to a week or so behind the latest pip releases, but unless you absolutely, positively have to get a fix a few days early, I strongly recommend not doing that. And if you do, always do it in an isolated Conda environment (not a virtualenv/venv, if you're using conda), and install from conda-forge instead of pip, since it has pretty much all the major and scientific-related packages.

I created a virtual environment

You should never use virtualenvs in conda (although they do reputedly work). You should always use Conda environments instead, as they provide numerous benefits and avoid problems.

So, I installed a fresh version of Anaconda, but since it was not available for python 3.6

It is, it just doesn't come in the default installer. You have two easy options to resolve this: First, you can just run conda install python=3.6 in your base environment, to switch everything to Python 3.6. Or, as you did, you can create a conda environment and install the packages you need there, including the one that is still stuck on 3.6, and it will automatically pick up the correct Python version: conda create -n your-new-env-name numpy pandas matplotlib spyder-kernels your-py36-package. Same thing with any other Python version, like 2.7.

After activating it and running spyder, the interpreter was yet python 3.7... I had to manually change the interpreter.

How, from the command line with spyder? Or some other way? If the latter, it won't pick up that environment but rather open from base. However, that's perfectly fine and how its supposed to work, so you don't need to maintain a Spyder install for every environment (or even Python installation) you want to use and can use one copy of Spyder with many environment simultaneously. They just need to have spyder-kernels installed so Spyder can talk to it. Please read our guide to working with packages and envronments with Spyder for more details about this approach.

Well, it would be simpler to make available an Anaconda installer for python 3.6.

We have no control over this, of course. You are welcome to ask them, but I doubt they'll do so, when users can create a new environment or downgrade the Python version in their base env with one simple command. Also, you could simply download Miniconda and install exactly the packages and Python version(s) you want, without all the pre-installed baggage.

@zcq0730
Copy link

zcq0730 commented May 12, 2019

Hey, CAM-Gerlach Thanks a lot!

After doing these three lines didn´t solve my problem.
pip uninstall PyQt5
conda update conda
conda update anaconda-navigator

But in addition with:
conda install --force-reinstall pyqt qt

solved my problem. I don´t know why it wasn´t properly installed before, but anyway, now it works.
Thank you very much! Finally got it running. I almost tried everything before came up to your solution.

We appreciate you trying to help and share something that worked for you on a superficially similar error, but if you are going to post a potential solution, please do so on an open, non-duplicate issue and take care to read the actual issue report, as in both these cases the issue was not caused by the same problem and would not be fixed by your solution, and furthermore was already resolved and closed. Thanks.

This error means that you installed pyqt5 with pip along side the pyqt conda package.

This is but one of many potential causes of this error, the reporter explicitly stated that they have not used pip to install PyQt5 at any point, so it of course cannot be the case here, There are many other cases of this error as well which your suggestion will not surely resolve your problem.

conda update conda

Not explicitly necessary, but doesn't hurt.

conda update anaconda-navigator

The Anaconda Navigator GUI doesn't have anything to do with this; I'm not sure why you're suggesting it.

The above is also missing a crucial step for many if not most such cases, which is ensuring the conda PyQt package is installed properly: conda install --force-reinstall pyqt qt.

@CAM-Gerlach
Copy link
Member

After doing these three lines didn´t solve my problem.
pip uninstall PyQt5
conda update conda
conda update anaconda-navigator

You may either have not had pyqt and qt installed, something went wrong with the install, or installing it with pip as well damaged your conda installation or otherwise messed up your environment. Regardless, glad you got it working!

@zcq0730
Copy link

zcq0730 commented May 12, 2019

Thanks a lot for the detailed reply! That makes a lot of sense. The last two reasons fit better. Good to know about those possibilities :)

After doing these three lines didn´t solve my problem.
pip uninstall PyQt5
conda update conda
conda update anaconda-navigator

You may either have not had pyqt and qt installed, something went wrong with the install, or installing it with pip as well damaged your conda installation or otherwise messed up your environment. Regardless, glad you got it working!

@theoroborus
Copy link

This error means that you installed pyqt5 with pip along side the pyqt conda package. It could be solved by you uninstalling the pip package.
Try:
pip uninstall PyQt5
Then update conda:
conda update conda
conda update anaconda-navigator

It will surely resolve your problem

Thanks, it solved my problem. I ran into this issue several time, when I was installing python on windows over anaconda. :)

@gledsonmelotti
Copy link

Hello everybody. I have problem with my spyder. My spyder does not work. The problem is:

C: ... envs\kerasgpu\Scripts\spyder-script.py", line 6, in
from spyder.app.start import main
ModuleNotFoundError: No module named 'spyder.app'

Can someone help me?

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

No branches or pull requests

10 participants