Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python setup.py install without sudo

I have a project with some structure, it is console script. The project has setup.py file.

All I want is to install my package any way without using sudo. I spent like 10 hours browsing the internet and can't find a working solution.

I keep getting error: [Errno 13] Permission denied: 'srm.egg-info/PKG-INFO' if using virtualenv

And getting [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-27105.write-test'

It works good enough with sudo(but there are troubles with uninstall, and it is still not working with virtualenv)

Using: Ubuntu 14.04, Python 2.7,

like image 362
N7D Avatar asked May 02 '17 20:05

N7D


2 Answers

Use the parameter --user to specify your home directory:

python setup.py install --user
like image 92
galimay Avatar answered Oct 24 '22 17:10

galimay


Ok, so I f***ed up so much:

After using sudo, package files were created in the location of my setup.py and they had lock icon (system files because of sudo) and I could no longer install program without sudo.

My solution was to sudo rm -r all of the previously created locked files in program directory and those near python directory, and just install my program without sudo using --user or virtualenv.

like image 32
N7D Avatar answered Oct 24 '22 17:10

N7D