Search code examples
pythonpython-3.xinstallationanacondaspyder

Spyder Kernels, anaconda and Python 3.9


--

Edit - pip uninstall not working

pip uninstall primer3
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umpy (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -umexpr (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -iopython (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -illow (c:\anaconda3\lib\site-packages)
WARNING: Ignoring invalid distribution -cipy (c:\anaconda3\lib\site-packages)
WARNING: Skipping primer3 as it is not installed.

--

I am looking to use some software that requires Python v>=3.9. I downloaded it as described here via default options to C:\Users\u03132tk\AppData\Local\Programs\Python\Python39\python.exe.

My IDE is Spyder, originally installed at C:\ANACONDA3\Lib\site-packages\spyder. The original shortcut I clicked, C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)\Spyder.lnk, executed these files:

C:\ANACONDA3\pythonw.exe 
C:\ANACONDA3\cwp.py 
C:\ANACONDA3 
C:\ANACONDA3\pythonw.exe 
C:\ANACONDA3\Scripts\spyder-script.py 

As it was not the default interpreter for my Spyder version, I then downloaded Spyder version 5 via windows installer in the hope that it would use Python version 3.9 (it uses 3.8 :( ). Spyder v5 is installed at C:\Program Files\Spyder, and the shortcut I use to open it (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Spyder.lnk) executes these files:

C:\Program Files\Spyder\Python\pythonw.exe 
C:\Program Files\Spyder\Spyder.launch.pyw

After reading around I found out how to change the Python interpreter. My current problem is this error in the console:

The Python environment or installation whose interpreter is located at
    C:\Users\u03132tk\AppData\Local\Programs\Python\Python39\python.exe
doesn't have the spyder‑kernels module or the right version of it installed (>= 2.4.0 and < 2.5.0). Without this module is not possible for Spyder to create a console for you.

You can install it by activating your environment first (if necessary) and then running in a system terminal:
    conda install spyder-kernels=2.4
or
    pip install spyder-kernels==2.4.*

I did the pip option and it seemed to go OK, apart from these errors (the full output is given under 'text dump'):

ERROR: spyder 4.1.5 requires pyqt5<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.5 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.5 has requirement spyder-kernels<1.10.0,>=1.9.4, but you'll have spyder-kernels 2.4.3 which is incompatible.
ERROR: ipykernel 6.16.2 has requirement traitlets>=5.1.0, but you'll have traitlets 4.3.2 which is incompatible.

Given that spyder-kernels-2.4.3 seemed to download OK, I thought it might be fine, but I get the same console error after restarting spyder. I have tried setting the preferred interpreter to C:\Users\u03132tk\AppData\Local\Programs\Python\Python39\python.exe, and I also tried copying the Python39 directory into C:\Program Files\Spyder and setting the preferred interpreter to C:\Program Files\Spyder\Python39\python.exe - neither worked.

I am not sure of best practices with this kind of thing at all - could the issue be that I have two Spyder versions? I have folders that seem to indicate the spyder kernels installed OK for both the old (C:\ANACONDA3\Lib\site-packages\spyder_kernels-2.4.3.dist-info, C:\ANACONDA3\Lib\site-packages\spyder_kernels) and new (C:\Program Files\Spyder\pkgs\spyder_kernels-2.4.3.dist-info, C:\Program Files\Spyder\pkgs\spyder_kernels) spyder versions.

Also, if my latest install of Spyder is outside the Anaconda ecosystem, will that make it harder to use packages (or can I just Pip install them as needed still)?

When I leave python and venture into my actual computer I am a complete amateur, so any help would be much appreciated!

Thanks, Tim

Text dump:

C:\Users\u03132tk>pip install spyder-kernels==2.4.*
Collecting spyder-kernels==2.4.*
  Downloading https://files.pythonhosted.org/packages/d8/63/2b2202362cca689c38f5a63268596f6fff14bdfb4a539103e4073b7064b0/spyder_kernels-2.4.3-py2.py3-none-any.whl (98kB)
     |████████████████████████████████| 102kB 6.4MB/s
Collecting pyzmq>=22.1.0; python_version >= "3" (from spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/40/dd/1fe1f11eb03d177a141188c80d1134f64146db3c5cecbcf4054817a2f8af/pyzmq-25.0.2-cp37-cp37m-win_amd64.whl (1.2MB)
     |████████████████████████████████| 1.2MB ...
Collecting jupyter-client<9,>=7.4.9; python_version >= "3" (from spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/fd/a7/ef3b7c8b9d6730a21febdd0809084e4cea6d2a7e43892436adecdd0acbd4/jupyter_client-7.4.9-py3-none-any.whl (133kB)
     |████████████████████████████████| 143kB 6.4MB/s
Collecting ipykernel<7,>=6.16.1; python_version >= "3" (from spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/95/46/505364588f6145f5edd29c1506b1964dd397a668c49f8bb42deffb6a0168/ipykernel-6.16.2-py3-none-any.whl (138kB)
     |████████████████████████████████| 143kB ...
Requirement already satisfied: cloudpickle in c:\anaconda3\lib\site-packages (from spyder-kernels==2.4.*) (1.2.1)
Collecting ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3" (from spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/7c/6a/1f1365f4bf9fcb349fcaa5b61edfcefa721aa13ff37c5631296b12fab8e5/ipython-7.34.0-py3-none-any.whl (793kB)
     |████████████████████████████████| 798kB 6.4MB/s
Requirement already satisfied: traitlets in c:\anaconda3\lib\site-packages (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*) (4.3.2)
Collecting jupyter-core>=4.9.2 (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/02/8f/0e0ad6804c0a021a27410ec997626a7a955c20916454d0205f16eb83de4b/jupyter_core-4.12.0-py3-none-any.whl (89kB)
     |████████████████████████████████| 92kB 5.8MB/s
Collecting python-dateutil>=2.8.2 (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247kB)
     |████████████████████████████████| 256kB ...
Requirement already satisfied: entrypoints in c:\anaconda3\lib\site-packages (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*) (0.3)
Collecting tornado>=6.2 (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/f3/9e/225a41452f2d9418d89be5e32cf824c84fe1e639d350d6e8d49db5b7f73a/tornado-6.2.tar.gz (504kB)
     |████████████████████████████████| 512kB 6.4MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting nest-asyncio>=1.5.4 (from jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/e9/1a/6dd9ec31cfdb34cef8fea0055b593ee779a6f63c8e8038ad90d71b7f53c0/nest_asyncio-1.5.6-py3-none-any.whl
Requirement already satisfied: packaging in c:\anaconda3\lib\site-packages (from ipykernel<7,>=6.16.1; python_version >= "3"->spyder-kernels==2.4.*) (19.0)
Collecting matplotlib-inline>=0.1 (from ipykernel<7,>=6.16.1; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/f2/51/c34d7a1d528efaae3d8ddb18ef45a41f284eacf9e514523b191b7d0872cc/matplotlib_inline-0.1.6-py3-none-any.whl
Collecting debugpy>=1.0 (from ipykernel<7,>=6.16.1; python_version >= "3"->spyder-kernels==2.4.*)
  Downloading https://files.pythonhosted.org/packages/af/7e/61738aba4da0de74e797ca71013977ebd8d35f58b18e674da045efb30487/debugpy-1.6.7-cp37-cp37m-win_amd64.whl (4.8MB)
     |████████████████████████████████| 4.8MB 6.8MB/s
Requirement already satisfied: psutil in c:\anaconda3\lib\site-packages (from ipykernel<7,>=6.16.1; python_version >= "3"->spyder-kernels==2.4.*) (5.6.3)
Requirement already satisfied: backcall in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.1.0)
Requirement already satisfied: pickleshare in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.7.5)
Requirement already satisfied: setuptools>=18.5 in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (41.0.1)
Requirement already satisfied: jedi>=0.16 in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.17.1)
Requirement already satisfied: decorator in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (4.4.0)
Requirement already satisfied: pygments in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (2.4.2)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.4.1)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\anaconda3\lib\site-packages (from ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (2.0.9)
Requirement already satisfied: ipython-genutils in c:\anaconda3\lib\site-packages (from traitlets->jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*) (0.2.0)
Requirement already satisfied: six in c:\anaconda3\lib\site-packages (from traitlets->jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*) (1.12.0)
Requirement already satisfied: pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy" in c:\anaconda3\lib\site-packages (from jupyter-core>=4.9.2->jupyter-client<9,>=7.4.9; python_version >= "3"->spyder-kernels==2.4.*) (223)
Requirement already satisfied: pyparsing>=2.0.2 in c:\anaconda3\lib\site-packages (from packaging->ipykernel<7,>=6.16.1; python_version >= "3"->spyder-kernels==2.4.*) (2.4.0)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in c:\anaconda3\lib\site-packages (from jedi>=0.16->ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.7.0)
Requirement already satisfied: wcwidth in c:\anaconda3\lib\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython!=8.10.0,!=8.8.0,!=8.9.0,<9,>=7.31.1; python_version >= "3"->spyder-kernels==2.4.*) (0.1.7)
Building wheels for collected packages: tornado
  Building wheel for tornado (PEP 517) ... done
  Stored in directory: C:\Users\u03132tk\AppData\Local\pip\Cache\wheels\4c\e2\a2\2a4d8b655b5018edd788430e998bfb2e15a2b7876dbee210e6
Successfully built tornado
ERROR: spyder 4.1.5 requires pyqt5<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.5 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.5 has requirement spyder-kernels<1.10.0,>=1.9.4, but you'll have spyder-kernels 2.4.3 which is incompatible.
ERROR: ipykernel 6.16.2 has requirement traitlets>=5.1.0, but you'll have traitlets 4.3.2 which is incompatible.
Installing collected packages: pyzmq, jupyter-core, python-dateutil, tornado, nest-asyncio, jupyter-client, matplotlib-inline, debugpy, ipython, ipykernel, spyder-kernels
  Found existing installation: pyzmq 18.0.0
    Uninstalling pyzmq-18.0.0:
      Successfully uninstalled pyzmq-18.0.0
  Found existing installation: jupyter-core 4.6.3
    Uninstalling jupyter-core-4.6.3:
      Successfully uninstalled jupyter-core-4.6.3
  Found existing installation: python-dateutil 2.8.0
    Uninstalling python-dateutil-2.8.0:
      Successfully uninstalled python-dateutil-2.8.0
  Found existing installation: tornado 6.0.3
    Uninstalling tornado-6.0.3:
      Successfully uninstalled tornado-6.0.3
  Found existing installation: jupyter-client 6.1.7
    Uninstalling jupyter-client-6.1.7:
      Successfully uninstalled jupyter-client-6.1.7
  Found existing installation: ipython 7.6.1
    Uninstalling ipython-7.6.1:
      Successfully uninstalled ipython-7.6.1
  Found existing installation: ipykernel 5.3.4
    Uninstalling ipykernel-5.3.4:
      Successfully uninstalled ipykernel-5.3.4
  Found existing installation: spyder-kernels 1.9.4
    Uninstalling spyder-kernels-1.9.4:
      Successfully uninstalled spyder-kernels-1.9.4
Successfully installed debugpy-1.6.7 ipykernel-6.16.2 ipython-7.34.0 jupyter-client-7.4.9 jupyter-core-4.12.0 matplotlib-inline-0.1.6 nest-asyncio-1.5.6 python-dateutil-2.8.2 pyzmq-25.0.2 spyder-kernels-2.4.3 tornado-6.2

Solution

  • You created a very big headache for yourself. You now have three python installations and two spyder installations.

    First, clean the mess:

    1. Uninstall C:\Users\u03132tk\AppData\Local\Programs\Python\Python39 completely
    2. Uninstall C:\Program Files\Spyder

    Then, lets start at the original setup, you have spyder installed as part of anaconda and the requirement that you had was

    I am looking to use some software that requires Python v>=3.9.

    Here, you should just create a conda virtual environment, install a spyder kernel to it and then select that environment as interpreter in spyder. This command will create a new environment with python 3.9, run it in your anaconda prompt:

    conda create -n py39 python=3.9 spyder-kernels pip #list all packages that your new environment should have
    

    When you want to use this environment, simply write conda activate py39 in your anaconda prompt. After this, all conda/pip install commands will install to this specific environment, without modifying your base environment and you can install the software that you wanted here.