I'm trying to figure out why my sudo doesn't have access to pip installed packages. Here is the details of my setup below.
Ubuntu 20.04, Fresh install. Comes with Python3.8. Install some other package, which installs its own Python (Intel MKL Oneapi), which is Python3.9. This install somehow makes that the default Python. I get around this by editting ~/.bashrc to explicitly target /usr/bin/python3 (which is 3.8) for python/python3 and pip/pip3 each.
I do
pip install packaging
I launch python with
python3
which correctly targets the alias'd /usr/bin/python3
and I am able to do import packaging
without issue.
In a script, I import packaging. If I run
python3 setup.py install
I get an error with a permission denied :
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test- easy-install-8015.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python3.8/dist-packages/
`
So I then try
sudo python3 setup.py install
However I am now back to No module named packaging
SO I am curious, why does sudo
not have access to this package?