I'm on arch linux and until recently I made the error of using pip to install things globally. I tried to remove everything related to python that wasn't tracked by pacman. I then removed pip.
I know of the --user flag for pip but in the end I use the same bunch of basic packages, which I rather install globally using my package manager.
To debug some code I recently needed debug symbols which lead me to compile python myself. After that, I reinstalled it using pacman.
Currently python2 and 3 are installed whereas python
points to v3.
If I start a REPL and run help("modules")
I get:
>>> help("modules")
Please wait a moment while I gather a list of all available modules...
/usr/lib/python3.9/site-packages/IPython/kernel/__init__.py:12: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
warn("The `IPython.kernel` package has been deprecated since IPython 4.0."
/usr/lib/python3.9/site-packages/lutris/gui/dialogs/__init__.py:10: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gtk, WebKit2, GLib
/usr/lib/python3.9/pkgutil.py:108: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.
yield from walk_packages(path, info.name+'.', onerror)
and then a list of modules including matplotlib
and matplotlib_inline
.
If I try to import it inside a REPL I get:
Python 3.9.5 (default, May 24 2021, 12:50:35)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pascal/matplotlib.py", line 1, in <module>
import matplotlib.path as mpath
ModuleNotFoundError: No module named 'matplotlib.path'; 'matplotlib' is not a package
Now while writing this I was indeed able to import it once when I opened the REPL in my home dir but I can't reproduce it.
Furthermore /usr/lib/python3.9/site-packages
contains
matplotlib/
matplotlib_inline/
matplotlib-3.4.1-py3.9.egg-info/
matplotlib_inline-0.1.2-py3.9.egg-info/
matplotlib-3.4.1-py3.9-nspkg.pth
and pacman -Q
lists
python-matplotlib 3.4.1-2
python-matplotlib-inline 0.1.2-1
Also the search path (run in REPL) is:
>>> import sys
>>> sys.path
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/<user>/.local/lib/python3.9/site-packages', '/usr/lib/python3.9/site-packages']