aisync
aisync

Reputation: 175

Anaconda Sudo PIP permissions Problems

I'm learning Python and have Anaconda installed, and I'm trying to familiarize myself with the process of getting an Eye-Color Detection project working. I'm running into the following error after going through readme:

Eye-Color-Detection git:(master) ✗ sudo pip install -r requirements.txt

WARNING: The directory '/Users/{user}/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

When trying to update:

(tweet) ➜ Eye-Color-Detection git:(master) ✗ conda update --all

[Errno 13] Permission denied: '/Users/{user}/opt/anaconda3/envs/tweet/lib/python3.8/site-packages/wrapt/__init__.py' -> '/Users/{user}/opt/anaconda3/envs/tweet/lib/python3.8/site-packages/wrapt/__init__.py.c~'

Q: How might I go about doing this correctly within the same Conda environment?

Upvotes: 0

Views: 606

Answers (2)

Ayush
Ayush

Reputation: 576

What you need to do is you have to change the directory premission to writable.

You can do it using this command,

$ sudo chmod 7777 /Users/{user}/library/caches/

to change permissions recursively,

$ sudo chmod 7777 -R /Users/{user}/library/caches/

or you can own that directory by using this command,

$ sudo chown OWNER:GROUP /Users/{user}/library/caches/

where OWNER is the username for your computer which you can find in the terminal by using this command.

$ whoami

GROUP is optional.

Upvotes: 0

00willo
00willo

Reputation: 68

Most of the time, a sudo pip install is almost never what you really want. While in some cases, it may "appear" to work and solve you're immediate problem. More often than not you've just broken your system python without knowing it.

In the context of that repo, I'd ignore the repo's README and do this.

$ git clone https://github.com/ghimiredhikura/Eye-Color-Detection
$ cd Eye-Color-Detection

Create a virtualenv environment, change yourenvname as you like.

$ conda create -n yourenvname python=3.x
$ conda activate yourenvname

Install the dependencies and run the code

$ pip install -r requirements.txt
$ python3 eye-color.py --input_path=sample/2.jpg --input_type=ima

As fixing you conda environment may be difficult to debug depending on what else you've sudo'd in attempting to resolve your issue. If you happen to be familiar with "regular" virtualenv's created using python's builtin virtual environment tooling, then you could also try this to get you going.

$ python3 -m venv .venv --copies
$ source .venv/bin/active

$ pip install -r requirements.txt

$ python3 eye-color.py --input_path=sample/2.jpg --input_type=image

Upvotes: 1

Related Questions