How to install Python Package for global use by all users (incl. www-data)
<p>I thought I throw together a little dirty script on our server (Ubuntu 16.04) that gives me some plain text output from Python.</p>

<p>I want to call the script like this from PHP (I know there should be some escaping done, but it's just a test currently):</p>

<pre><code>&lt;?php
$command = '/usr/local/bin/script.py';
$output = shell_exec($command);
echo $output;
?&gt;
</code></pre>

<p>This is <code>script.py</code> owned by www-data mode <code>774</code></p>

<pre><code>#!/usr/bin/python
import CoolProp.CoolProp as CP
import argparse
print('Hallo Welt')
</code></pre>

<p>If I comment out the <code>CoolProp</code> import it works. But somehow the package cannot be reached by <code>www-data</code>and so the script returns nothing. </p>

<p>As you see I want to use the Package <code>CoolProp</code>.</p>

<ol>
<li>So I tried installing it with <code>pip install CoolProp</code>=> That works for my local user. But now when called from user <code>www-data</code></li>
<li>After I tried to install it with a target <code>--target=/usr/local/lib/site-packages/</code> but that did not help.</li>
<li>I tried to change the ACL on the complete <code>site-packages/</code> to <code>rwx</code>
for www-data but that does not work as well.</li>
</ol>

<p><strong>In the end:</strong> What is the simplest way to <code>pip install</code> a package that can be used by all users including <code>www-data</code>?</p>