idb icon indicating copy to clipboard operation
idb copied to clipboard

install: PermissionError: [Errno 13] Permission denied: '/usr/local/protoc_compiler_template.py'

Open voxspox opened this issue 5 years ago • 8 comments

Description

I want to install idb on a maxOs Catalania 10.15.6

% brew tap facebook/fb
% brew install idb-companion

-> ok

% pip3 install fb-idb
Collecting fb-idb
  Using cached fb_idb-1.0.12-py3-none-any.whl (125 kB)
Requirement already satisfied: treelib in ./lib/python3.8/site-packages (from fb-idb) (1.6.1)
...
Requirement already satisfied: hyperframe<6,>=5.2.0 in ./lib/python3.8/site-packages (from h2->grpclib>=0.3.2->fb-idb) (5.2.0)
Installing collected packages: fb-idb
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/protoc_compiler_template.py'
Consider using the `--user` option or check the permissions.

% ls /usr/local/lib/python3.8/site-packages
fb_idb-1.0.12.dist-info
idb
...

% idb
zsh: command not found: idb

Solution

Maybe the setup.py must be fixed to not access /usr/local for temporary files??

Additional Information

none

voxspox avatar Sep 11 '20 11:09 voxspox

i ran into this issue today and the fix for me was to add the python lib to my PATH

export PATH="$PATH:/Users/[username]/Library/Python/3.8/bin"

in my .zshrc fixed for me

phillipkey avatar Sep 18 '20 19:09 phillipkey

I ran sudo pip3 install fb-idb but I had to pip3 uninstall fb-idb before I tried to install it again.

josmithua avatar Oct 26 '20 15:10 josmithua

Installing with sudo (root privileges) is a way to avoid this error, but it's probably not how one would want to handle this. After all, when doing so pip prints "WARNING: Running pip as root will break packages and permissions." That's a reasonable warning!

The reporter's suggestion that setup.py should be changed to avoid writing to /usr/local is most likely correct, as it seems that os.path.dirname(__file__) is returning /usr/local even when the file is located in another (user-writable) location. Possibly this can be resolved by wrapping in os.path.realpath to compensate for any symlinks?

michaek avatar May 17 '21 14:05 michaek

@jackkinsella I'm glad that's working for you, but the original reporter shows that they were using pip3, so I expect that may not be a general solution.

michaek avatar Jul 13 '21 13:07 michaek

This happens for me every install, for every supported version of Python. Running pip install fb-idb a second time produces no error, but also fails to install idb.

alexchandel avatar Oct 11 '21 16:10 alexchandel

still occurs in macOS Big Sur v11.6.4 with brew installed python3.10

truebit avatar Sep 20 '22 13:09 truebit

Using the --user option as recommended solved this issue for me.

GuillaumeHemmen avatar Sep 20 '22 14:09 GuillaumeHemmen

Don't use sudo, because it is not recommended. This works:

pip install --user fb-idb

If you get "idb: command not found" after successful installation, idb is installed in the directory that is not in the PATH.

find / -name "idb"

Then you know where it is and either add that directory to the PATH or move idb to some place which is in the path.

MVenell avatar Apr 26 '23 06:04 MVenell