Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The directory or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. #988

Closed
bryanbeshore opened this issue Nov 24, 2016 · 19 comments

Comments

@bryanbeshore
Copy link

I am receiving the following message when trying to install virtualenv via: sudo pip install virtualenv

Bryans-MacBook-Pro:/ BryanB$ sudo pip install virtualenv
The directory '/Users/BryanB/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/BryanB/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

I am unsure how to resolve this issue.

@yan12125
Copy link

Try this:

sudo -H pip install virtualenv

@bryanbeshore
Copy link
Author

Message received after trying sudo -H pip install virtualenv

Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

Overall goal is to setup my machine for this: http://newcoder.io/begin/setup-your-machine/#mac-os-x

@yan12125
Copy link

Is there a file virtualev in /Library/Frameworks/Python.framework/Versions/2.7/bin?

@bryanbeshore
Copy link
Author

bryanbeshore commented Nov 24, 2016

Yes

Requirement already satisfied: virtualenvwrapper in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv-clone in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied: stevedore in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied: six>=1.9.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: pbr>=1.6 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)

@techesuraj
Copy link

Os x has default python install and you're trying to install in it. I had the same issue but I fixed with the following command
sudo pip3 install virtualenv

@shailesh
Copy link

shailesh commented May 6, 2017

I also saw this change on my Mac when I went from running 'pip' to 'sudo pip'

Adding '-H' to sudo causes the message to go away for me. E.g.

sudo -H pip install foo

@cpj001
Copy link

cpj001 commented Dec 24, 2017

But I don't want to add -H every time. when I use sudo pip3 install virtualenvwrapper every time,it will show the warning. Who can help me

@Ekultek
Copy link

Ekultek commented Dec 24, 2017

It does matter what you want. The fix is to add -H or fix the systems permissions to give yourself access.

You cloud, also, add an alias to it for yourself so that the inconvenience of hitting two more keys doesn’t affect you.. @OrangePJ

@cpj001
Copy link

cpj001 commented Dec 24, 2017

@Ekultek fine...

@blackfur
Copy link

python --version
if the version is 2 then change it to link to 3
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3 /usr/bin/python

@sirLisko
Copy link

I solved with sudo chown -R $USERNAME /Users/$USERNAME/Library/Caches/pip, not sure if it helps :)

@xiaoxiaofeng999
Copy link

1.查看文件的拥有权:ls -l
2.修改文件或目录的拥有权(root权限下):chown -R username 目录
3.系统提示我要修改的是:chown -R xf /home/xf/.cache/pip

@etzl
Copy link

etzl commented Oct 17, 2018

when i use sudo pip3 install requests it shows this massage but i used just pip3 install requests it installed package.

@ericvpatridge
Copy link

For some reason, I had to add python to the PATH and this solved my problem.

@waterreedshimmer
Copy link

Install without sudo as in what I was trying to install, the -H option didn't install all packages but the install without sudo did it.
pip install <package>

@gaborbernat
Copy link
Contributor

This is related to provisioning virtualenv for the system, and it's OS dependent probably. As there's no actionable item for the package itself I'll close this.

@SecureTheBeans
Copy link

Sorry to bring this thread back to life, but I am still experiencing a problem with my module not importing correctly. This is error message I get when I try importing the module "pyperclip"

>>> import pyperclip
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
ModuleNotFoundError: No module named ‘pyperclip’
>>> 

Can anyone help?
I am using Mac OS X
Python version 3.8.3

This is what I get when I try installing pyperclip via sudo -H pip3 install pyperclip

Requirement already satisfied: pyperclip in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.8.0)

btw I am a newbie. Terminal is foreign to me.

Thanks in advance everyone.

@gaborbernat
Copy link
Contributor

@SecureTheBeans your question has nothing to do with virtualenv, your question is more appropriate at https://discuss.python.org/c/users/7

@SecureTheBeans
Copy link

My bad. I didn’t know this was exclusive to virtualenv.

I received the same outputted message from Terminal after trying to install the module pyperclip through sudo pip install and figured the issues were similar enough. Anyways I figured out what was going on. The interpreter I was using was not the same where pip was installing.

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests