Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7072

Multiple Matplotlib versions make Spyder 6 unable to start the IPython kernel on Ubuntu

$
0
0

I currently meet this error when starting Spyder 6.0.1 (installed with pip because the one available in apt package is stuck at version 4.2.1) on Ubuntu 22.04:

An error occurred while starting the kernel/home/username/.local/lib/python3.10/site‑packages/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package).As a result, the 3D projection is not available.warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "

This is due to the fact that both the apt package python3-matplotlib (3.5.1) (needed as dependency for some other installed software) and the pip package matplotlib (3.9.2) (needed by myself) are installed, the first being available at: /usr/lib/python3/dist-packages and the second one at: /home/username/.local/lib/python3.10/site-packages/.

The Python path being:

>>> import sys>>> for i,j in enumerate(sys.path):...     print(f"{i}: {j}")... 0: 1: /usr/lib/python310.zip2: /usr/lib/python3.103: /usr/lib/python3.10/lib-dynload4: /home/username/.local/lib/python3.10/site-packages5: /usr/local/lib/python3.10/dist-packages6: /usr/lib/python3/dist-packages

Is there a way to explicitly set a different priority when loading a specific package in Spyder so that I can force Spyder to work with the Matplotlib library installed by apt in: /usr/lib/python3/dist-packages?

I don't understand either, because the Matplotlib message state is "warning", so it shouldn't block Spyder's startup.

Also, in Spyder there is the menu Tools > PYTHONPATH manager which first seems promising but it's only to "append" new paths to the existing Python path as it says:

The paths listed below will be passed to the IPython console and to the Editor as additional locations to search for Python modules."

and it's currently empty.

Last but not least, when starting an IPython console, I can load matplotlib 3.9.2 without any troubles, so why can't Spyder?:

$ ipython3Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]Type 'copyright', 'credits' or 'license' for more informationIPython 8.28.0 -- An enhanced Interactive Python. Type '?' for help.In [1]: import matplotlib as mplIn [2]: mpl.__version__Out[2]: '3.9.2'

The very last option would be to permanently uninstall the Matplotlib 3.9.2 pip package but if I can avoid that, I would be glad.

Spyder version:

* Spyder version: 6.0.1  (pip)* Python version: 3.10.12 64-bit* Qt version: 5.15.2* PyQt5 version: 5.15.7* Operating System: Linux-6.8.0-47-generic-x86_64-with-glibc2.35

Viewing all articles
Browse latest Browse all 7072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>