Every package installed with pip is not found

On my pc, I can correctly install any package with pip without any errors. But when I try to run it with its command I always get the same "command not found" error. I have installed Python 3.10.

For example, this is what happens when I try to install quantumrandom (and every other programs):

pip install quantumrandom
Defaulting to user installation because normal site-packages is not writeable
Collecting quantumrandom Using cached quantumrandom-1.9.0.tar.gz (7.6 kB)
Using legacy 'setup.py install' for quantumrandom, since package 'wheel' is not installed.
Installing collected packages: quantumrandom Running setup.py install for quantumrandom ... done
Successfully installed quantumrandom-1.9.0
qrandom --int --min 5 --max 15
bash: qrandom: command not found

I believe that all packages installed with pip end up in this folder: "/home/tommaso/.local/lib/python3.10/site-packages"

This is the output of "python -m site":

sys.path = [ '/home/tommaso/.local/lib/python3.10/site-packages', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages',
]
USER_BASE: '/home/tommaso/.local' (exists)
USER_SITE: '/home/tommaso/.local/lib/python3.10/site-packages' (exists)
ENABLE_USER_SITE: True

And this is my PATH variable:

/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Thanks for your help

5

1 Answer

All you have to do is log out and log back in. The directory pip installs to is not in your path but when you log back in, your path will be automatically updated.

To explain: pip installs the executable files at $HOME/.local/bin . There is a conditional statement in ~/.profile (at the end of the file) that automatically adds this directory to your PATH, if and only if it exists:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH"
fi

When you logged in, before you installed your first pip packages, this directory did not exist so it is not currently in your path.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like