spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.32k stars 1.61k forks source link

Error occured while starting the kernel #22165

Closed lchtourou closed 4 months ago

lchtourou commented 4 months ago

Description

What steps will reproduce the problem?

I updated the kernel in the command prompt as spyder said to do after there was an error starting the kernel. I relaunched spyder and now have this error: Traceback (most recent call last): File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main return _run_code(code, main_globals, None, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code exec(code, run_globals) File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\spyder_kernels\console__main.py", line 22, in from spyder_kernels.console import start File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\spyder_kernels\console\start.py", line 20, in import ipykernel File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\ipykernel__init.py", line 7, in from .connect import * # noqa: F403 ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\ipykernel\connect.py", line 12, in import jupyter_client File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client__init__.py", line 3, in from .asynchronous import AsyncKernelClient File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client\asynchronous__init.py", line 1, in from .client import AsyncKernelClient # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client\asynchronous\client.py", line 11, in from ..channels import AsyncZMQSocketChannel, HBChannel File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client\channels.py", line 16, in from .session import Session File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client\session.py", line 53, in from .jsonutil import extract_dates, json_clean, json_default, squash_dates File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\jupyter_client\jsonutil.py", line 14, in from dateutil.parser import parse as _dateutil_parse File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\dateutil\parser\init__.py", line 2, in from ._parser import parse, parser, parserinfo, ParserError File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\dateutil\parser_parser.py", line 50, in from .. import tz File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\dateutil\init.py", line 16, in getattr__ return importlib.import_module("." + name, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\importlib\init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\dateutil\tz\init__.py", line 2, in from .tz import * File "C:\Users\lchtourou\AppData\Local\Programs\Python\Python312\Lib\site‑packages\dateutil\tz\tz.py", line 21, in from six.moves import _thread ModuleNotFoundError: No module named 'six.moves'

Traceback

Traceback (most recent call last):
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\jupyter_client\manager.py", line 91, in wrapper
    self._ready.set_result(None)
asyncio.exceptions.InvalidStateError: invalid state

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\qtconsole\manager.py", line 27, in poll
    super().poll()
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\jupyter_client\restarter.py", line 143, in poll
    self.kernel_manager.restart_kernel(now=True, newports=newports)
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\jupyter_core\utils\__init__.py", line 173, in wrapped
    return loop.run_until_complete(inner)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\jupyter_client\manager.py", line 596, in _async_restart_kernel
    await self._async_start_kernel(**self._launch_args)
  File "C:\Users\lchtourou\AppData\Local\anaconda3\Lib\site-packages\jupyter_client\manager.py", line 94, in wrapper
    self._ready.set_exception(e)
asyncio.exceptions.InvalidStateError: invalid state

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0             :  1.4.0 (OK)
chardet >=2.0.0                  :  4.0.0 (OK)
cloudpickle >=0.5.0              :  2.2.1 (OK)
cookiecutter >=1.6.0             :  2.5.0 (OK)
diff_match_patch >=20181111      :  20200713 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.20.0 (OK)
jedi >=0.17.2,<0.20.0            :  0.18.1 (OK)
jellyfish >=0.7                  :  1.0.1 (OK)
jsonschema >=3.2.0               :  4.19.2 (OK)
keyring >=17.0.0                 :  23.13.1 (OK)
nbconvert >=4.0                  :  7.10.0 (OK)
numpydoc >=0.6.0                 :  1.5.0 (OK)
paramiko >=2.4.0                 :  2.8.1 (OK)
parso >=0.7.0,<0.9.0             :  0.8.3 (OK)
pexpect >=4.4.0                  :  4.8.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  5.9.0 (OK)
pygments >=2.0                   :  2.15.1 (OK)
pylint >=2.5.0,<3.1              :  2.16.2 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.10.0,<1.11.0           :  1.10.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.2 (OK)
qtawesome >=1.2.1                :  1.2.2 (OK)
qtconsole >=5.5.1,<5.6.0         :  5.5.1 (OK)
qtpy >=2.1.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.0.1 (OK)
setuptools >=49.6.0              :  68.2.2 (OK)
sphinx >=0.6.6                   :  5.0.2 (OK)
spyder_kernels >=2.5.0,<2.6.0    :  2.5.0 (OK)
textdistance >=4.2.0             :  4.2.1 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  2.1.6 (OK)
zmq >=22.1.0                     :  25.1.2 (OK)

# Optional:
cython >=0.21                    :  None (NOK)
matplotlib >=3.0.0               :  3.8.0 (OK)
numpy >=1.7                      :  1.26.4 (OK)
pandas >=1.1.1                   :  2.1.4 (OK)
scipy >=0.17.0                   :  1.11.4 (OK)
sympy >=0.7.3                    :  1.12 (OK)

Environment

Environment ``` Package Version ----------------------------- -------------- alabaster 0.7.16 argcomplete 1.10.3 arrow 1.3.0 astroid 3.1.0 asttokens 2.4.1 atomicwrites 1.4.1 attrs 23.2.0 autopep8 2.0.4 Babel 2.14.0 bcrypt 4.1.2 beautifulsoup4 4.8.2 binaryornot 0.4.4 black 24.4.0 bleach 6.1.0 certifi 2024.2.2 cffi 1.16.0 chardet 3.0.4 charset-normalizer 3.3.2 click 8.1.7 cloudpickle 3.0.0 colorama 0.4.6 comm 0.2.2 compressed_rtf 1.0.6 cookiecutter 2.6.0 cryptography 42.0.5 debugpy 1.8.1 decorator 5.1.1 defusedxml 0.7.1 diff-match-patch 20230430 dill 0.3.8 docstring-to-markdown 0.15 docutils 0.20.1 docx2txt 0.8 ebcdic 1.1.1 et-xmlfile 1.1.0 executing 2.0.1 extract-msg 0.28.7 fastjsonschema 2.19.1 flake8 7.0.0 idna 3.7 imagesize 1.4.1 IMAPClient 2.1.0 importlib_metadata 7.1.0 inflection 0.5.1 intervaltree 3.1.0 ipykernel 6.29.4 ipython 8.23.0 isort 5.13.2 jaraco.classes 3.4.0 jaraco.context 5.3.0 jaraco.functools 4.0.0 jedi 0.19.1 jellyfish 1.0.3 Jinja2 3.1.3 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter_client 8.6.1 jupyter_core 5.7.2 jupyterlab_pygments 0.3.0 keyring 25.1.0 lxml 5.2.1 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib-inline 0.1.6 mccabe 0.7.0 mdurl 0.1.2 mistune 3.0.2 more-itertools 10.2.0 mypy-extensions 1.0.0 nbclient 0.10.0 nbconvert 7.16.3 nbformat 5.10.4 nest-asyncio 1.6.0 numpy 1.26.4 numpydoc 1.7.0 olefile 0.47 openpyxl 3.1.2 packaging 24.0 pandas 2.2.1 pandocfilters 1.5.1 paramiko 3.4.0 parso 0.8.4 pathspec 0.12.1 pdfminer.six 20191110 pexpect 4.9.0 pickleshare 0.7.5 pillow 10.3.0 pip 24.0 platformdirs 4.2.0 pluggy 1.4.0 prompt-toolkit 3.0.43 psutil 5.9.8 ptyprocess 0.7.0 pure-eval 0.2.2 pycodestyle 2.11.1 pycparser 2.22 pycryptodome 3.20.0 pydocstyle 6.3.0 pyflakes 3.2.0 Pygments 2.17.2 pylint 3.1.0 pylint-venv 3.0.3 pyls-spyder 0.4.0 PyNaCl 1.5.0 PyQt5 5.15.10 PyQt5-Qt5 5.15.2 PyQt5-sip 12.13.0 PyQtWebEngine 5.15.6 PyQtWebEngine-Qt5 5.15.2 python-dateutil 2.9.0.post0 python-docx 1.1.0 python-lsp-black 2.0.0 python-lsp-jsonrpc 1.1.2 python-lsp-server 1.11.0 python-pptx 0.6.23 python-slugify 8.0.4 pytoolconfig 1.3.1 pytz 2024.1 pywin32 306 pywin32-ctypes 0.2.2 PyYAML 6.0.1 pyzmq 25.1.2 QDarkStyle 3.2.3 qstylizer 0.2.2 QtAwesome 1.3.1 qtconsole 5.5.1 QtPy 2.4.1 referencing 0.34.0 requests 2.31.0 rich 13.7.1 rope 1.13.0 rpds-py 0.18.0 Rtree 1.2.0 setuptools 69.4.0 six 1.12.0 snowballstemmer 2.2.0 sortedcontainers 2.4.0 soupsieve 2.5 SpeechRecognition 3.8.1 Sphinx 7.2.6 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 spyder 5.5.4 spyder-kernels 2.5.2 stack-data 0.6.3 tabulate 0.9.0 text-unidecode 1.3 textdistance 4.6.1 three-merge 0.1.1 tinycss2 1.2.1 tomli 2.0.1 tomlkit 0.12.4 tornado 6.4 traitlets 5.14.2 types-python-dateutil 2.9.0.20240316 typing_extensions 4.11.0 tzdata 2024.1 tzlocal 5.2 ujson 5.9.0 urllib3 2.2.1 watchdog 4.0.0 wcwidth 0.2.13 webencodings 0.5.1 whatthepatch 1.0.5 xlrd 1.2.0 XlsxWriter 3.2.0 yapf 0.40.2 zipp 3.18.1 ```
ccordoba12 commented 4 months ago

Hey @lchtourou, thanks for reporting. It seems you're mixing packages from two different Python installations:

C:\Users\lchtourou\AppData\Local\Programs\Python\Python312

and

C:\Users\lchtourou\AppData\Local\anaconda3

So, removing one of them should fix this problem. Since you already have installed Anaconda, I guess you don't need the first installation. Therefore, please open this directory in the Windows file explorer:

C:\Users\lchtourou\AppData\Local\Programs\Python

and remove all its contents.