How to install a module for all users with pip on linux?
<p>How to install a package in the standard python environment <em>i.e.</em> <code>/usr/local/lib/python2.7/dist-packages</code> using <code>pip</code> and make this new package available for all the users without using <code>virtualenv</code>?</p>
<p>By using the following, the package is installed with root permissions only:</p>
<pre class="lang-none prettyprint-override"><code>$ sudo pip install loremipsum
Downloading/unpacking loremipsum
  Downloading loremipsum-1.0.5.tar.gz
  Running setup.py (path:/tmp/pip_build_root/loremipsum/setup.py) 
  egg_info for package loremipsum
    
Installing collected packages: loremipsum
  Running setup.py install for loremipsum
    
Successfully installed loremipsum
Cleaning up...
</code></pre>
<p>Proof:</p>
<pre class="lang-none prettyprint-override"><code>$ python -c 'import loremipsum'
Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
ImportError: No module named loremipsum

$ sudo python -c 'import loremipsum'

$ pip install loremipsum
Requirement already satisfied (use --upgrade to upgrade): loremipsum in 
/usr/local/lib/python2.7/dist-packages
Cleaning up...

$ cowsay sad
 _____
&lt; sad &gt;
 -----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
</code></pre>
<p>Please do not advise me to use <code>apt-get install python-...</code> instead. I would like to know what is my mistake and how to use pip correctly.</p>
<pre class="lang-none prettyprint-override"><code>$ python --version
Python 2.7.6
$ pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
$ uname -a
Linux _ 3.19.0-32-generic #37~14.04.1-Ubuntu SMP _ x86_64 GNU/Linux
</code></pre>
<p><strong>EDIT</strong></p>
<p>I guess the problem is because <code>pip</code> does not allow the group and everyone to read the installed stuff:</p>
<pre class="lang-none prettyprint-override"><code>$ sudo pip uninstall loremipsum
Uninstalling loremipsum:
  /usr/local/lib/python2.7/dist-packages/loremipsum-1.0.5.egg-info
  /usr/local/lib/python2.7/dist-packages/loremipsum/__init__.py
  /usr/local/lib/python2.7/dist-packages/loremipsum/__init__.pyc
  /usr/local/lib/python2.7/dist-packages/loremipsum/default/dictionary.txt
  /usr/local/lib/python2.7/dist-packages/loremipsum/default/sample.txt
  /usr/local/lib/python2.7/dist-packages/loremipsum/generator.py
  /usr/local/lib/python2.7/dist-packages/loremipsum/generator.pyc
Proceed (y/n)? y
  Successfully uninstalled loremipsum

$ sudo pip install loremipsum
Downloading/unpacking loremipsum
  Downloading loremipsum-1.0.5.tar.gz
  Running setup.py (path:/tmp/pip_build_root/loremipsum/setup.py) 
  egg_info for package loremipsum
    
Installing collected packages: loremipsum
  Running setup.py install for loremipsum
    
Successfully installed loremipsum
Cleaning up...
$ sudo ls -al /usr/local/lib/python2.7/dist-packages/loremipsum
total 60
drwxr-s---  3 root staff  4096 Apr 27 22:06 .
drwxrwsr-x 18 root staff  4096 Apr 27 22:06 ..
drwxr-s---  2 root staff  4096 Apr 27 22:06 default
-rw-r-----  1 root staff 16182 Apr 27 22:06 generator.py
-rw-r-----  1 root staff 16323 Apr 27 22:06 generator.pyc
-rw-r-----  1 root staff  6130 Apr 27 22:06 __init__.py
-rw-r-----  1 root staff  6869 Apr 27 22:06 __init__.pyc
</code></pre>