Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe Mike Orr's answer from <a href="http://groups.google.com/group/python-virtualenv/browse_thread/thread/1412994580f0a2c6/17271fcd6a6e747e?lnk=gst&amp;q=ubuntu+virtualenv#17271fcd6a6e747e" rel="nofollow noreferrer">the virtual-env mailing list</a> seems to be the best. Note the OP published this question in both places.</p> <p><strong>Original content of mail:</strong></p> <p>Years ago Debian created /usr/local/lib/pythonVERSION/site-packages, and compiled the Python binary to include it in the default search path. Ubuntu followed Debian's lead as it normally does. The Python developers did not like this because you'd get interference with a locally-installed /usr/local/bin/python using the same site-packages directory. Ubuntu finally decided to abandon site-packages and use dist-packages instead, a name which they invented so it wouldn't interfere with anything. The loing story is out there somewhere if you google it, somewhere in the Python bug tracker or distutils SIG or such.</p> <p>The system works, at least if you use the Ubuntu virtualenv package. Some people have had problems using a locally-installed virtualenv on Ubuntu because the magic sys.path entries weren't being added or something. I'm not sure about --no-site-packages because I never use that option: I run PIL and mysqldb from the Ubuntu packages because it can be hard to compile their C dependencies sometimes. (Need the right header files, Python is ignoring the header files, etc.)</p> <p>So Ubuntu Python packages go into /usr/lib/pythonVERSION/dist-packages. Or that python-support directory for some reason. Locally-installed Python packages go into /usr/local/lib/pythonVERSION/dist-packages by default. Whenever I install an Ubuntu 9.04 system I run:</p> <p>$ sudo apt-get install python-setuptools (6.0c9) $ sudo apt-get install python-virtualenv (1.3.3) $ sudo easy_install pip $ sudo pip install virtualenvwrapper</p> <p>The virtualenvs work fine this way, although I haven't tried --no-site-packages.</p> <blockquote> <p>I'm trying to spin up virtualenv, and the --no-site-packages flag seems to do nothing with ubuntu. I installed virtualenv 1.3.3 with easy_install (which I've upgraded to setuptools 0.6c9)</p> </blockquote> <p>These versions are both in Ubuntu 9.04, so you're making it harder on yourself by installing them locally.</p> <blockquote> <p>and everything seems to be installed to /usr/local/lib/python2.6/dist-packages</p> </blockquote> <p>Yes</p> <blockquote> <p>I assume that when installing a package using apt-get, it's placed in / usr/lib/python2.6/dist-packages/ ?</p> </blockquote> <p>Yes</p> <blockquote> <ol start="4"> <li>Is it first come first serve on the path? If I have a newer version of package XYZ installed in /usr/local/lib/python2.6/dist- packages/ and and older one (from ubuntu repos/apt-get) in /usr/lib/ python2.6/dist-packages, which one gets imported when I import xyz? I'm assuming this is based on the path list, yes?</li> </ol> </blockquote> <p>sys.path is scanned in order. The only funny thing is that .pth eggs get put earlier or later in the path than some people expect. But if you're using pip for everything it can do (i.e. except to install pip itself, precompiled eggs, and a snapshot of a local directory that's a copy rather than an egg link), you won't have many .pth eggs anyway.</p> <blockquote> <ol start="5"> <li>Why the hell is this so confusing? Is there something I'm missing here?</li> </ol> </blockquote> <p>It's not well documented. I figured it out by scanning the web.</p> <blockquote> <ol start="7"> <li>Will this affect pip as well?</li> </ol> </blockquote> <p>Yes, pip will automatically install to /usr/local/lib/pythonVERSION/site-packages. Use "pip install -E $VIRTUAL_ENV packagename" to install into a virtualenv.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload