pip install planemo fails with error: "ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/locale'"

Question:

I am trying to install planemo like so:

/usr/local/bin/pip3 install virtualenv
virtualenv .venv
. .venv/bin/activate
/usr/local/bin/pip3 install planemo

The last command fails with this error message:

ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/locale'
Consider using the `--user` option or check the permissions.

WARNING: You are using pip version 21.0.1; however, version 22.2 is available.
You should consider upgrading via the '/usr/local/opt/[email protected]/bin/python3.9 -m pip install --upgrade pip' command.

How to solve this?

Asked By: Timur Shtatland

||

Answers:

DO NOT USE: this solution does install planemo, but into an incorrect location.

The error is caused by an outdated version of pip. Note that the error message is followed by a few hints, one of which solves the issue. Just upgrade pip:

/usr/local/opt/[email protected]/bin/python3.9 -m pip install --upgrade pip

Now this works:

/usr/local/bin/pip3 install planemo
which planemo
# /usr/local/bin/planemo
Answered By: Timur Shtatland
. .venv/bin/activate

This line activates your virtual environment. "activating" in this case means setting a bunch of environment variables, including PATH.

/usr/local/bin/pip3 install planemo

And then you completely ignore PATH by calling pip3 with an absolute path. Make that

pip install planemo

and it should work.

Answered By: Sören

Sometimes the problem is just that the library exists in site-packages and was likely installed using sudo (accidentally or otherwise), just cd into site-packages, check permissions ls -all and if the package is ‘root’ then remove it and reinstall it

Answered By: rdmtinez