pipx
pipx copied to clipboard
pipx install [pkg] - PermissionError: [Errno 13] Permission denied
FYI https://pipxproject.github.io/pipx/troubleshooting/ gives a 404 error
MacOS Big Sur 11.1
$ pipx install pipenv
Traceback (most recent call last):
File "/usr/local/Cellar/pipx/0.15.6.0/libexec/bin/pipx", line 33, in
I also tried installing cowsay and got the same problem.
It looks like somehow you don't have write permission to the /Users/guyjacks/.local/bin
directory. I'm guessing that either /Users/guyjacks/.local/bin
is read-only, or that it shows up as owned by a different user than the one you are using to execute pipx install pipenv
.
What is the output if you execute
ls -l /Users/guyjacks/.local
Does it work if you try to create a file in that directory, like:
touch /Users/guyjacks/.local/bin/testfile
If it is read-only (i.e. the above ls -l
command shows the bin
subdirectory as dr-xr-xr-x
) then to fix you could do:
chmod -R u+w /Users/guyjacks/.local/bin
Thanks @itsayellow.
I tried setting those permissions and it didn't work. I think the problem is that the user for the bin directory is root instead of me. I'm not certain if its safe to change the user for those files to me. It does seem odd to me that anything in "~/.local" would require the root user.
How is the output of "ls -l"
$ ls -l total 0 drwxr-xr-x 29 root staff 928 Aug 3 2017 bin drwx------ 3 root staff 96 Aug 3 2017 lib drwxr-xr-x 5 guyjacks staff 160 Dec 23 00:09 pipx drwxr-xr-x 5 guyjacks staff 160 Aug 11 2019 share
You could sudo chown -R guyjacks /Users/guyjacks/.local/bin
, but I’d first check why those directories belong to root
. Are there existing files there? How did they get there?
Yeah there are. I'm guessing that aws cli put a bunch of stuff in there. I have no idea if its safe to change the user on those files. Can pipx use a different directory?
-rwxr-xr-x 1 root staff 850 Aug 3 2017 aws -rwxr-xr-x 1 root staff 1432 Aug 3 2017 aws.cmd -rwxr-xr-x 1 root staff 204 Aug 3 2017 aws_bash_completer -rwxr-xr-x 1 root staff 1171 Aug 3 2017 aws_completer -rwxr-xr-x 1 root staff 1807 Aug 3 2017 aws_zsh_completer.sh -rwxr-xr-x 1 root staff 1710 Aug 3 2017 jp.py -rwxr-xr-x 1 root staff 250 Aug 3 2017 pyrsa-decrypt -rwxr-xr-x 1 root staff 266 Aug 3 2017 pyrsa-decrypt-bigfile -rwxr-xr-x 1 root staff 250 Aug 3 2017 pyrsa-encrypt -rwxr-xr-x 1 root staff 266 Aug 3 2017 pyrsa-encrypt-bigfile -rwxr-xr-x 1 root staff 248 Aug 3 2017 pyrsa-keygen -rwxr-xr-x 1 root staff 271 Aug 3 2017 pyrsa-priv2pub -rwxr-xr-x 1 root staff 244 Aug 3 2017 pyrsa-sign -rwxr-xr-x 1 root staff 248 Aug 3 2017 pyrsa-verify -rwxr-xr-x 1 root staff 629 Aug 3 2017 rst2html.py -rwxr-xr-x 1 root staff 749 Aug 3 2017 rst2html4.py -rwxr-xr-x 1 root staff 1174 Aug 3 2017 rst2html5.py -rwxr-xr-x 1 root staff 826 Aug 3 2017 rst2latex.py -rwxr-xr-x 1 root staff 635 Aug 3 2017 rst2man.py -rwxr-xr-x 1 root staff 799 Aug 3 2017 rst2odt.py -rwxr-xr-x 1 root staff 1733 Aug 3 2017 rst2odt_prepstyles.py -rwxr-xr-x 1 root staff 636 Aug 3 2017 rst2pseudoxml.py -rwxr-xr-x 1 root staff 672 Aug 3 2017 rst2s5.py -rwxr-xr-x 1 root staff 906 Aug 3 2017 rst2xetex.py -rwxr-xr-x 1 root staff 637 Aug 3 2017 rst2xml.py -rwxr-xr-x 1 root staff 705 Aug 3 2017 rstpep2html.py
You can set the PIPX_BIN_DIR
environment variable to customise it. Remember to add whatever you set to your PATH
.
I think it would also allow pipx to use that directory if you only changed the ownership of the directory itself, i.e. if you omit the -R
in @uranusjr 's example like this:
sudo chown guyjacks /Users/guyjacks/.local/bin
...if you wanted another option that would not touch the ownership of the aws files inside of /Users/guyjacks/.local/bin
, but would still change the ownership of /Users/guyjacks/.local/bin
itself.
A slight tangent, but I suppose we should do a check on the directory to make sure permissions are available, and give a more user-friendly error if it fails. We shouldn't ever be showing a stack trace to the user if we can avoid it.
i resolve issue by simply creating 2 folders in /Users/$(whoami)/.local/. On my side these two folder were not created before.
sudo mkdir /Users/$(whoami)/.local/bin
sudo mkdir /Users/$(whoami)/.local/pipx
When i rerun pipx ensurepath
i got :
⚠️ All pipx binary directories have been added to PATH. If you are sure you want to proceed, try again with the '--force' flag.
Otherwise pipx is ready to go! ✨ 🌟 ✨