LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 07-05-2022, 06:18 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,687
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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.
 
Old 07-06-2022, 02:11 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,002

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by Skaperen View Post
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 View Post
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 View Post
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?
Oh yes, the documentation of pip would be very useful. https://pip.pypa.io/en/stable/topics/configuration/ https://pip.pypa.io/en/stable/user_guide/
 
Old 07-08-2022, 12:41 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,687

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by pan64 View Post
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 View Post
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).

Quote:
Originally Posted by pan64 View Post
indeed. but maybe, someone who likes to be helpful happens to know this off the top of their head.

Last edited by Skaperen; 07-08-2022 at 12:42 PM.
 
Old 07-08-2022, 01:24 PM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
My 2 cents, said it before.

Don't run pip as root.

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.

Last edited by teckk; 07-08-2022 at 01:25 PM.
 
Old 07-08-2022, 02:17 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Pass pip the "--user" flag.
 
Old 07-08-2022, 02:33 PM   #7
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,687

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by dugan View Post
Pass pip the "--user" flag.
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.
 
Old 07-11-2022, 12:27 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,002

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by Skaperen View Post
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).
 
Old 07-13-2022, 07:00 PM   #9
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,687

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'sudo pip install' is not recognized. 'pip install' is recognized. MrBright2019 Linux - Newbie 1 07-28-2020 10:09 PM
LXer: pip Uninstall | Uninstall a Package Installed with pip LXer Syndicated Linux News 0 03-01-2018 10:30 AM
[SOLVED] sbopkg installs "original" SlackBuild to /usr/doc/<pkg>/ instead of "local" SlackBuild drumz Slackware 29 01-20-2018 12:12 AM
Hello, Bon Jour, Pip Pip SocaSpice LinuxQuestions.org Member Intro 3 11-14-2010 08:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration