Score:5

Every package installed with pip is not found

dk flag

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

guiverc avatar
cn flag
You've provided no OS & release details; which provide the best clue as to what software stack you're using & how the python3 version you're using relates.
andrew.46 avatar
in flag
Try adding the following to `~/.bashrc` and either source this file or reboot: `export PYTHONPATH=${PYTHONPATH}:${HOME}/.local/lib/python3.10/site-packages` This is an oddity that I have encountered with Python 3.10 on my own system...
mchid avatar
bo flag
@andrew.46 If you look at the last few lines in `~/.profile` you'll see the conditional statement that automatically adds the path.
mchid avatar
bo flag
@andrew.46 So really, the problem is with the system path, not the python path.
andrew.46 avatar
in flag
https://www.linuxquestions.org/questions/slackware-14/python-3-10-0-problems-with-pipx-4175702100/
Score:3
bo flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.