I would like to install sphinx-doc from the sources so I git clone the module then installed it with sudo python setup.py install. Using /usr/local/lib/python2.7/dist-packages/pytz-2016.4-py2.7.eggSearching for MarkupSafe==0.23Best match: MarkupSafe 0.23Removing MarkupSafe 0.18 from easy-install.pth fileAdding MarkupSafe 0.23 to easy-install.pth fileUsing /usr/local/lib/python2.7/dist-packagesFinished processing dependencies for Sphinx==1.4b1.dev-20160423Then I realized that I don't have the permissions to use it: $ sphinx-quickstartbash: /usr/local/bin/sphinx-quickstart: Permission denied$ ls -al /usr/local/bin/sphinx-quickstart -rwxr-x--- 1 root root 357 Apr 23 16:56 /usr/local/bin/sphinx-quickstartThe question is, how to install it with the correct permissions? I often have this kind of issues when I have to use sudo to create a folder or to mount a drive to /media. This is a bit off topic, but /media is 755 and as a regular user I cannot mount my own drives on my own computer without being root. Is that normal?
File permissions while installing a python module
ubuntu;permissions;software installation;python
If you want to install Python packages from source, you should do so in a virtualenv. That way you minimize the chance that you break your system's python, and it you make it possible to just remove the installed package without fear of removing too much.In order to do so you must first install virtualenv, e.g. using  sudo apt-get install python-virtualenvafter that is installed create a virtualenv somewhere and activate it: sudo mkdir /opt/util sudo chown $USER /opt/util virtualenv /opt/util/sphinx-doc source /opt/util/sphinx-doc/bin/activateafter that run your python setup.py installin the git cloned directory, you should not have to use sudo.As long as the virtualenv is active you should be able to run sphinx-doc or any (other) utilites the python setup.py install creates. You can also run those when the virtualenv is not active by using /opt/util/sphinx-doc/bin/<UTILNAME> (for which you might want to make an alias)./opt/util/sphinx-doc can be changed to whatever you want. But if you put such virtualenvs next to each other, you can easily create some script for automatic updating of any pip installed packages, for defining aliases etc.