question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matplotlib not installed or didn't load correctly in Spyder 5.3.1

See original GitHub issue

Description

What steps will reproduce the problem?

I installed Spyder 5.3.1, fired it up, and iPython console is complaining that matplotlib isn’t installed or didn’t load correctly.

Traceback

Traceback (most recent call last):
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\spyder\plugins\ipythonconsole\widgets\client.py", line 735, in _restart_thread_main
    self.shellwidget.kernel_manager.restart_kernel(
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 30, in wrapped
    raise e
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 27, in wrapped
    return loop.run_until_complete(future)
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\nest_asyncio.py", line 89, in run_until_complete
    return f.result()
  File "asyncio\futures.py", line 178, in result
  File "asyncio\tasks.py", line 280, in __step
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 533, in _async_restart_kernel
    await ensure_async(self.shutdown_kernel(now=now, restart=True))
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 30, in wrapped
    raise e
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 27, in wrapped
    return loop.run_until_complete(future)
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\nest_asyncio.py", line 89, in run_until_complete
    return f.result()
  File "asyncio\futures.py", line 178, in result
  File "asyncio\tasks.py", line 280, in __step
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 83, in wrapper
    raise e
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 75, in wrapper
    out = await method(self, *args, **kwargs)
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 492, in _async_shutdown_kernel
    await ensure_async(self.request_shutdown(restart=restart))
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 30, in wrapped
    raise e
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\utils.py", line 27, in wrapped
    return loop.run_until_complete(future)
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\nest_asyncio.py", line 89, in run_until_complete
    return f.result()
  File "asyncio\futures.py", line 178, in result
  File "asyncio\tasks.py", line 280, in __step
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 397, in _async_request_shutdown
    self._connect_control_socket()
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\manager.py", line 318, in _connect_control_socket
    self._control_socket = self._create_connected_socket("control")
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\jupyter_client\connect.py", line 605, in _create_connected_socket
    sock = self.context.socket(socket_type)
  File "C:\Users\JTS\AppData\Local\Programs\Spyder\pkgs\zmq\sugar\context.py", line 258, in socket
    raise ZMQError(Errno.ENOTSUP)
zmq.error.ZMQError: Not supported

Versions

  • Spyder version: 5.3.1
  • Python version: 3.8.10
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.6
  • Operating System: Windows 10

Dependencies

# Mandatory:
atomicwrites >=1.2.0                 :  1.4.0 (OK)
chardet >=2.0.0                      :  4.0.0 (OK)
cloudpickle >=0.5.0                  :  2.1.0 (OK)
cookiecutter >=1.6.0                 :  1.7.3 (OK)
diff_match_patch >=20181111          :  20200713 (OK)
intervaltree                         :  None (OK)
IPython >=7.31.1;<8.0.0              :  7.33.0 (OK)
jedi >=0.17.2;<0.19.0                :  0.18.1 (OK)
jellyfish >=0.7                      :  0.9.0 (OK)
jsonschema >=3.2.0                   :  4.5.1 (OK)
keyring >=17.0.0                     :  23.5.1 (OK)
nbconvert >=4.0                      :  6.5.0 (OK)
numpydoc >=0.6.0                     :  1.3.1 (OK)
paramiko >=2.4.0                     :  2.11.0 (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.1 (OK)
pygments >=2.0                       :  2.12.0 (OK)
pylint >=2.5.0                       :  2.13.9 (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.4.1;<1.5.0                 :  1.4.1 (OK)
pylsp_black >=1.2.0                  :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0            :  3.0.3 (OK)
qstylizer >=0.1.10                   :  0.2.1 (OK)
qtawesome >=1.0.2                    :  1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0             :  5.3.0 (OK)
qtpy >=2.1.0                         :  2.1.0 (OK)
rtree >=0.9.7                        :  1.0.0 (OK)
setuptools >=49.6.0                  :  62.3.2 (OK)
sphinx >=0.6.6                       :  4.5.0 (OK)
spyder_kernels >=2.3.1;<2.4.0        :  2.3.1 (OK)
textdistance >=4.2.0                 :  4.2.2 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog                             :  2.1.8 (OK)
zmq >=22.1.0                         :  23.0.0 (OK)

# Optional:
cython >=0.21                        :  0.29.30 (OK)
matplotlib >=3.0.0                   :  3.5.2 (OK)
numpy >=1.7                          :  1.22.4 (OK)
pandas >=1.1.1                       :  1.4.2 (OK)
scipy >=0.17.0                       :  1.8.1 (OK)
sympy >=0.7.3                        :  1.10.1 (OK)

# Spyder plugins:
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mrclarycommented, Jun 22, 2022

@dalthviz, it turns out not to be an issue with micromamba, but an issue with the batch script I wrote. Apparently, when setting the variable SCRIPT in the logic statement, it cannot be expanded until after the entire logic statement is completed, so the call %SCRIPT% statement was just producing call . Moving it after the logic block results in the correct behavior with %SCRIPT% properly expanded.

#18387 should fix this issue.

@jtskowronek, sorry for the inconvenience.

1reaction
mrclarycommented, Jun 11, 2022

Checking a little bit this seems like this could be caused due to the addition of the micromamba executable to handle the env activation at #17692 and #17856 to the installers. If I comment out the code that gives the path to the micromamba executable (which causes the activation to fallback to find the conda executable) and instead return None I’m able to import PyQt 5.12 without issue. Just in case, the code I’m refering is this (maybe as a workaround for the moment @jtskowronek you could try to make the code bellow return None in you Spyder installation):

https://github.com/spyder-ide/spyder/blob/551c30fc214079f11b16d2de73f5a3fd7a6351b2/spyder/config/base.py#L591-L602

@mrclary could it be that the micromamba executable needs something else set besides the path to the env to activate things when involving binaries like the PyQt .dlls? 🤔

Hmm… I don’t know why this would be happening. I don’t think that it should matter what mechanism is used to activate an environment, but I’ll take a look at it this week and see.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failure importing openpyxl in Spyder 5.1.5
It is likely that Spyder is using a different Python installation. So when you run pip you may not be installing in the...
Read more >
Common Illnesses — Spyder 5 documentation
If the plugin with the problem is not listed in the dependencies dialog, check that you installed it in the same environment as...
Read more >
Installing — Matplotlib 1.5.3 documentation
Provides extensions to python datetime handling. If using pip, easy_install or installing from source, the installer will attempt to download and install ......
Read more >
Installation of Python, Spyder, Numpy, Sympy, Scipy, Pytest ...
You are inside a (Windows) Command Prompt, not in Python. Try to launch the Spyder Python environment by typing "spyder" (see https://docs.
Read more >
How to Setup Your Python Environment for Machine ...
Confirm Python is installed correctly by typing: ... If the commands do not work or have an error, please check the documentation for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found