Spyder fails to load since Stable Update 2023-02-03

The current spyder-kernel requires ‘jupyter-client<8,>=7.4.9’ but
jupyter-client 8.0.2-1 was installed.

I have attempted to roll back, but unable to install jupyter-client other than jupyter-client 8.0.2-1

tracy@daphne:~$ spyder
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (jupyter-client 8.0.2 (/usr/lib/python3.10/site-packages), Requirement.parse('jupyter-client<8,>=7.4.9'), {'spyder-kernels'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/spyder", line 33, in <module>
    sys.exit(load_entry_point('spyder==5.4.1', 'gui_scripts', 'spyder')())
  File "/usr/bin/spyder", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 

883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/spyder/app/start.py", line 55, in <module>
    from spyder.utils.external import lockfile
  File "/usr/lib/python3.10/site-packages/spyder/utils/external/lockfile.py", line 31, in <module>
    from spyder.utils.programs import is_spyder_process
  File "/usr/lib/python3.10/site-packages/spyder/utils/programs.py", line 28, in <module>
    import pkg_resources
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3260, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jupyter-client<8,>=7.4.9' distribution was not found and is required by spyder-kernels

Had the same problem today.
Fixed this by (over) installing spyder using pip (it’s a bad decision, see the next answer):

pip install spyder

Note:
I could fix the problem with jupyter-client (8.0.2-1 installed) by downgrading the jupyter-client only with pip:

pip install jupyter-client==7.4.9

But then spyder said that it is looking for another package with specific version:
…The ‘astroid<=2.14.0-dev0,>=2.12.13’ distribution was not found …
(astroid 2.14.1-1 installed)
It is where I stopped downgrading packages and found a solution with re-installing spyder using pip (above)

You actually made it worse. Do not mix package managers. Please see:

Thanks for the comment and for sharing the post with advices.

In fact, I’m far from being a professional linux user. And therefore, frequent problems with programs after updates (with spyder - very often) cause great sadness and attempts to urgently fix them in any way. I have a vague idea of the problems that can arise when mixing package managers, but I hardly realize how serious the consequences could be in the future.

If you have an opinion on how to avoid problems in this particular case (for example, next update spyder, reinstall it with pacman?), please advise

It appears it’s fixed with python-spyder-kernels 2.4.2-2 available in our unstable branch.

See: FS#77336 - [spyder] crashes on startup because jupyter-client was upgraded beyond the maximum version

1 Like

When will that be available in Stable?

It’s sorta kinda difficult working on anything without ones favourite development tool.

If you’d like to test it, download 2.4.2-2 from a mirror (direct link via https://mirror.23m.com) and see if it fixes the issue.

It doesn’t.

tracy@daphne:~$ spyder
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (jupyter-client 8.0.2 (/usr/lib/python3.10/site-packages), Requirement.parse('jupyter-client<8,>=7.4.9'), {'spyder-kernels'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/spyder", line 33, in <module>
    sys.exit(load_entry_point('spyder==5.4.1', 'gui_scripts', 'spyder')())
  File "/usr/bin/spyder", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/spyder/app/start.py", line 55, in <module>
    from spyder.utils.external import lockfile
  File "/usr/lib/python3.10/site-packages/spyder/utils/external/lockfile.py", line 31, in <module>
    from spyder.utils.programs import is_spyder_process
  File "/usr/lib/python3.10/site-packages/spyder/utils/programs.py", line 28, in <module>
    import pkg_resources
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3260, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3272, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 596, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jupyter-client<8,>=7.4.9' distribution was not found and is required by spyder-kernels

OK, reinstalled jupyter-client 7.4.9 and astroid 2.13.2. Spyder now loads… and appears to be functioning correctly.

Basically the latest update borked Sypder.

I’m going to set up a spare laptop and connect it to the testing Repository.

When can we expect a fix for this issue?

I can’t install anything, as pamac wants to upgrade both astroid and jupyter-client, along with the rest of the files I want to install.

Good idea–There was just a testing update, so you’ll have python-spyder-kernels 2.4.2-2 available. Make sure to do a full upgrade, don’t hold any packages back.

That will now have to wait, as there was a reason why the laptop was a spare… it overheats, not normally a problem, but we are experiencing rather warm temperatures, which does not help.

Ok, I tested it, spyder works again.

But I had to upgrade the following two packages to the testing version:
python-pylint (2.15.10-1 → 2.16.1-1) and
python-spyder-kernels (2.4.2-1 → 2.4.2-2)

Hope this helps!

2 Likes