Pregunta

Here's my Windows setup

  • c:\Python27 : installed via official msi
  • setuptools : installed via python setup.py install (from: setuptools-1.1.5.tar.gz)
  • pip               : installed via python get-pip.py             (from get-pip.py)
  • virtualenv : installed via python setup.py install (from : virtualenv-1.10.1.tar.gz)
  • Create virtualenv using : virtualenv --no-site-packages myenv

Now, setuptools shows a different version in the following 2 cases :

  1. Open a shell & run pip list:
    pip (1.4.1)
    setuptools (1.1.5)
    virtualenv (1.10.1)

  2. activate virtualenv & run pip list
    pip (1.4.1)
    setuptools (0.9.8)

Why is setuptool showing version 0.9.8 in virtualenv although I installed version 1.1.5 as shown in the global path?

Update:

I tried @Rod's suggestion and it worked. But my setup broke. I wish the caveat was mentioned in the answer. I'm adding this here so that others don't end up wasting hours like I did. If I use the option --no-setuptools while creating virtualenv, after activating virtualenv, pip installs the packages globally.

My project had some dependencies that were installed via pip install. They stopped working (i.e. MySQLdb adapter). When I created another virtualenv without the --no-setuptools option, it started working.

¿Fue útil?

Solución

Why is setuptool showing version 0.9.8 in virtualenv although I installed version 1.1.5 as shown in the global path?

The different setuptools version seen is due to virtualenv bundling a version of setuptools within its archive (version 1.10.1 is bundled with setuptools 0.9.8). The local setuptools is installed from the archive to avoid accessing the network.

Having a different version of setuptools in your virtualenv should not be a problem.

Changing the version

If you must change the version, currently there is no way to force downloading another version setuptools other than unpacking the tar file and replacing the setuptools archive, in virtualenv-1.10.1\virtualenv_support with a newer version.

Eventually you will be able to specify a directory containing another version of setuptools to use, with the --extra-search-dir option, but the feature currently does not work.

Note: Virtualenv will install its own version of setuptools if you do not specify --no-setuptools when you create your virtualenv. Obviously, using the option --no-setuptools will not install setuptools nor pip. It will most likely break the encapsulation provided by virtualenv (as the OP noted).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top