Python - error: could not create 'treetagger.egg-info': Permission denied

MBT picture MBT · May 10, 2017 · Viewed 8.2k times · Source

I tried to install a python module (treetager-python) by using the command:

python3 setup.py install

When trying this, I get the error:

running install
running bdist_egg
running egg_info
creating treetagger.egg-info
error: could not create 'treetagger.egg-info': Permission denied

I read about using the flag --user, but this is not working at all:

python3 setup.py install --user
running install
error: can't combine user with prefix, exec_prefix/home, or install_(plat)base

I know that using sudo would probably solve this, but I don't like to execute 3rd party files/code with root permissions.

So is there any way to solve this without using 'sudo'?

I tried this on Mac OS, just let me know if I there is any additional information needed.

Thanks in advance!

SOLUTION: So as the answer suggests the problem was a permission problem in the source folder. As I downloaded this the file owner was set to 'root', changing the owner using chown solved the problem. Thanks for the quick help!

Answer

Fujiao Liu picture Fujiao Liu · May 10, 2017

go to the folder contains setup.py and execute sudo chmod -R 777 folder_name. I hope this will help.