pip command installs to /local instead of /usr/local
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
pip command installs to /local instead of /usr/local
i installed a fresh install of Xubuntu 20.04 (focal fossa) and many extra packages including python3-pip. when i run "pip install botocore" it tries to install it in /local/lib (creating parent directories as it goes) instead of /usr/local/lib. i cleared /local and put an empty regular file there (to block creating a directory there) and tried that command, again. this time it claims to be getting that package (and a dependent package) from cache and gives me an error message. i have scanned my entire filesystem and i cannot find where it is cached. i want to flush the cache.
any idea what i should check next? where is pip caching these packages? how can i flush this cache? how is pip coming up with the path //local/lib? is there a configuration for this that could have been messed up?
here is the output:
Code:
Collecting botocore
Using cached botocore-1.27.23-py3-none-any.whl (8.9 MB)
Collecting jmespath<2.0.0,>=0.7.1
Using cached jmespath-1.0.1-py3-none-any.whl (20 kB)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/lib/python3/dist-packages (from botocore) (2.7.3)
Requirement already satisfied: urllib3<1.27,>=1.25.4 in /usr/lib/python3/dist-packages (from botocore) (1.25.8)
Installing collected packages: jmespath, botocore
ERROR: Could not install packages due to an EnvironmentError: [Errno 20] Not a directory: '//local/lib'
i could show what is in /usr/lib/python3/dist-packages but it's a big list of about 240 names. i'll avoid that unless it is relevant. botocore and jmespath are not there.
when i run "pip install botocore" it tries to install it in /local/lib (creating parent directories as it goes) instead of /usr/local/lib. i cleared /local and put an empty regular file there (to block creating a directory there) and tried that command, again.
This is an extremely bad idea. Instead of creating ugly and annoying workarounds you have to read the documentation and find out what's happened. [Probably] there is a flag to specify that directory.
Quote:
Originally Posted by Skaperen
this time it claims to be getting that package (and a dependent package) from cache and gives me an error message. i have scanned my entire filesystem and i cannot find where it is cached. i want to flush the cache.
Oh yes, again, extremely bad approach. Next time these files/packages will be cached exactly the same way. So again, instead of forcing the system to do what you want you need to understand what's going on and how can you configure it. https://pip.pypa.io/en/stable/topics/caching/
Quote:
Originally Posted by Skaperen
any idea what i should check next? where is pip caching these packages? how can i flush this cache? how is pip coming up with the path //local/lib? is there a configuration for this that could have been messed up?
This is an extremely bad idea. Instead of creating ugly and annoying workarounds you have to read the documentation and find out what's happened. [Probably] there is a flag to specify that directory.
you seem to be uncertain. i guess that it because you have not had the need to read the documentation, yet.
Quote:
Originally Posted by pan64
Oh yes, again, extremely bad approach. Next time these files/packages will be cached exactly the same way. So again, instead of forcing the system to do what you want you need to understand what's going on and how can you configure it. https://pip.pypa.io/en/stable/topics/caching/
normally, when some program changes or stores something, it leaves a trail. for example, i can do a wide scan of files and sort them by date/time and see what is recently changed. that didn't work for pip's cache. so, yeah, i have run up to a case where i need to read about how pip does this magical caching. maybe it's in the cloud, somewhere. maybe it's on my backup-A drive which i didn't scan even though it was plugged in at the time (/dev/sdd).
If you are going to install python stuff outside of your package manager, because the python module that you want is not in your distros repo, pip install somewhere as user.(/home/somewhere)
Then you won't mess up your file tree as your package manager sees it. And, you won't have python conflicts. Your distros package manager thinks that python3.x and friends need module number x, and the libs also need to match. Leave them alone, don't overwrite them with something pip likes.
Use a python virtual env if you need to, or include that dir of the module installed in home in your $PATH.
Or import it from where it is at the top of your script.
You can break a python install easy enough. But don't.
on which run of pip? i think doing so many different things is leaving me rather confused. i just tried a fresh clean install of pip and tried to have it upgrade itself and it could not find iself in /local.
on which run of pip? i think doing so many different things is leaving me rather confused. i just tried a fresh clean install of pip and tried to have it upgrade itself and it could not find iself in /local.
removing pip itself may or may not clean up the installed packages (by pip). So a fresh clean install of pip may not solve these issues (because the problem is not the tool itself).
You need to understand how pip works and how can you configure it. Also you need to understand what is the difference between root and user mode execution. Additionally you may find python venv really useful (as it was mentioned already), but you need to learn that first (too).
yes, i was treating pip as an ordinary package manager. i have been doing so for many years without problems so that did not come up in my mind for this.
it seems a python venv might be the right thing for this. i've never needed a venv before so i need to go read up on this to be sure. that or i can do a user install. i'll just make a username specific for this purpose. i could name it "pippy" (different so the context of "pip" in messages is not confusing).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.