How to install Python Package for global use by all users (incl. www-data) How to install Python Package for global use by all users (incl. www-data) shell shell

How to install Python Package for global use by all users (incl. www-data)


I recommend that you try the solution that xotihcan posted first as that is the easy way to make most python modules available to all users including www-data. However it doesn't work for every python module. If that doesn't work for you or you just want to install modules for the www-data user only then use the following commands:

sudo mkdir /var/www/.localsudo mkdir /var/www/.cachesudo chown www-data.www-data /var/www/.localsudo chown www-data.www-data /var/www/.cachesudo -H -u www-data pip install CoolProp

I had this same issue trying to make the Python pyro4 module available for the www-data use. There is another way to do it but it involves some even dirtier hackery. For more details check out my question/answer @ How do I properly call a Python Pyro client using PHP and Apache web server?


Run PIP with root user.

That should fix the problem.