0

I am having a problem with my Spyder console when trying to swtich to a newer version of Python.

I followed a tutorial about changing the Python enviroment on Spyder but when I restarted the console, I got a huge error.

What I put as my Python interpreter: C:\Users\alex33\AppData\Local\Programs\Python\Python39\python.exe

Python version: 3.9.2
What version Spyder originally had: 3.7

The full error:

Traceback (most recent call last):
File "C:\Users\alex33\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,

File "C:\Users\alex33\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\console\__main__.py", line 23, in 
start.main()

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\console\start.py", line 253, in main
import_spydercustomize()

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\console\start.py", line 43, in import_spydercustomize
import spydercustomize

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\customize\spydercustomize.py", line 28, in 
from spyder_kernels.comms.frontendcomm import CommError, frontend_request

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\frontendcomm.py", line 17, in 
from jupyter_client.localinterfaces import localhost

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\jupyter_client\__init__.py", line 4, in 
from .connect import *

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\jupyter_client\connect.py", line 21, in 
import zmq

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\__init__.py", line 125, in 
from zmq import backend

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\backend\__init__.py", line 32, in 
raise original_error from None

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\backend\__init__.py", line 27, in 
_ns = select_backend(first)

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\backend\select.py", line 32, in select_backend
mod = import_module(name)

File "C:\Users\alex33\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)

File "C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\backend\cython\__init__.py", line 6, in 
from . import (
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\Users\alex33\AppData\Local\Programs\Spyder\pkgs\zmq\backend\cython\__init__.py)
David Buck
  • 3,752
  • 35
  • 31
  • 35
Pexate
  • 75
  • 1
  • 11
  • Does this answer your question? [ImportError: cannot import name constants](https://stackoverflow.com/questions/32643383/importerror-cannot-import-name-constants) – David Buck Apr 02 '21 at 09:56
  • It sadly didn't work – Pexate Apr 02 '21 at 11:59
  • (*Spyder maintainer here*) I think this is caused because our Windows application and the Python version you installed are trying to import packages from the same directory. So my recommendation is to remove your Python 3.9.2 completely (including everything under `C:\Users\alex33\AppData\Local\Programs\Python`) and install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) instead. – Carlos Cordoba Apr 10 '21 at 18:55
  • After that, please create a [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) with the packages you want to use and `spyder-kernels`. – Carlos Cordoba Apr 10 '21 at 18:56

0 Answers0