I am using Python Virtual Environment for installing a package from Git Repo. When I use its setup.py file, I get the following error. How should I fix it?
mona@goku:~/research/code/IP-Net/src/lib/models/networks/py_utils/_cpools$ python setup.py install --user
running install
Checking .pth file support in /home/mona/.local/lib/python3.8/site-packages/
/home/mona/venv/ipnet/bin/python3 -E -c pass
TEST FAILED: /home/mona/.local/lib/python3.8/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/mona/.local/lib/python3.8/site-packages/
and your PYTHONPATH environment variable currently contains:
'~/venv/ipnet/lib/python3.8/site-packages'
Here are some of your options for correcting the problem:
* You can choose a different installation directory, i.e., one that is
on PYTHONPATH or supports .pth files
* You can add the installation directory to the PYTHONPATH environment
variable. (It must then also be on PYTHONPATH whenever you run
Python and want to use the package(s) you are installing.)
* You can set up the installation directory to support ".pth" files by
using one of the approaches described here:
https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations
Please make the appropriate changes to your system and try again.
I have:
$ pip freeze
numpy==1.20.0
torch==1.7.1
typing-extensions==3.7.4.3
$ echo $PYTHONPATH
~/venv/ipnet/lib/python3.8/site-packages
and
$ ls ~/venv/ipnet/lib/python3.8/site-packages
total 152K
drwxrwxr-x 3 mona mona 4.0K Feb 2 19:34 ..
-rw-rw-r-- 1 mona mona 126 Feb 2 19:34 easy_install.py
drwxrwxr-x 6 mona mona 4.0K Feb 2 19:34 setuptools
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:34 setuptools-44.0.0.dist-info
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:34 pip-20.0.2.dist-info
drwxrwxr-x 5 mona mona 4.0K Feb 2 19:34 pip
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:34 pkg_resources-0.0.0.dist-info
drwxrwxr-x 5 mona mona 4.0K Feb 2 19:34 pkg_resources
-rw-rw-r-- 1 mona mona 82K Feb 2 19:42 typing_extensions.py
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:42 typing_extensions-3.7.4.3.dist-info
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:42 __pycache__
drwxrwxr-x 18 mona mona 4.0K Feb 2 19:42 numpy
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:42 numpy.libs
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:42 numpy-1.20.0.dist-info
drwxrwxr-x 29 mona mona 4.0K Feb 2 19:42 torch
drwxrwxr-x 11 mona mona 4.0K Feb 2 19:42 caffe2
drwxrwxr-x 16 mona mona 4.0K Feb 2 19:42 .
drwxrwxr-x 2 mona mona 4.0K Feb 2 19:42 torch-1.7.1.dist-info
Code repo is located at: https://github.com/vaesl/IP-Net
I have the following in my ~/.bashrc and already have source it. It belongs to a Python Virt Env I made for this git repo:
export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
As the user metatoaster
suggested, I did the following:
commented this line that I added to ~/.bashrc and sourced it:
#export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
removed the --user
flag here:
python setup.py install