Proper permissions for python installation directory? -


The first time I am trying to use the Python app on a server, I started setuptools by adding them as root :

[root @ server mydirectory] # yum install python-setuptools

Cool. Then I'll try setup.py:

  [user@server mydirectory] $ python install.py installation error: installation files can not be created or removed in the installation directory Add or remove files: [Erro 13] Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-25752.write-test'  

This directory is owned by the {code> /usr/lib/python2.4/site-packages root, so it is understandable.

My question is, should I paste it on the site - the package directory, or should I setup.py run as a root?

The conventional way of installing stuff is System-wide as the non-root user as the sudo is the reason why you see all such things on all python docs:

  sudo python setup.py install  

Some people are site-groupable by the site- some "dev group", so you do not have to do this. (This effectively powers the Mac Package Manager.)


Alternatively, you can install per user site in the package. Not every project can do this, but anything based on the modern setuptools should be able to do this.

And, when we are on it, if you are installing stuff based on modern setuptools , it is probably better to install pip. Instead of python setup.py install anyway. With other benefits, to create egg-information files, so that the package can be viewed as dependency, uninstall, etc.

See for more information.


Finally, you might want to consider using one. With Python 3.3+, it is designed in this form, although it does not have its own pip 3.4. With previous versions of Python, you can install PyPI.

Many hosted server environments come with virtualenv pre-installed for Python (2.x or 3.x). If not, then the root will be required to install this system-word ... but after that, you can install most other packages in a per-project virtual environment rather than system-wide Will be able to.


Comments

Popular posts from this blog

eclipse plugin - Run java code error: Workspace is closed -

ios - How do I use CFArrayRef in Swift? -

scala - Play Framework - how to bind form to a session field -