5

I have installed python3 via homebrew, updated pip & setuptools, installed virtualenv via pip. Now I'm trying to create a virtual env. Unfortunately, I can't get it to add pip to the virtualenv. Basically:

$ ls -lha venv/bin/ total 80 drwxr-xr-x 9 foghin staff 306B Jan 19 17:16 . drwxr-xr-x 6 foghin staff 204B Jan 19 17:16 .. -rw-r--r-- 1 foghin staff 2.2K Jan 19 17:16 activate -rw-r--r-- 1 foghin staff 1.2K Jan 19 17:16 activate.csh -rw-r--r-- 1 foghin staff 2.4K Jan 19 17:16 activate.fish -rw-r--r-- 1 foghin staff 1.1K Jan 19 17:16 activate_this.py lrwxr-xr-x 1 foghin staff 7B Jan 19 17:16 python -> python3 -rwxr-xr-x 1 foghin staff 13K Jan 19 17:16 python3 lrwxr-xr-x 1 foghin staff 7B Jan 19 17:16 python3.3 -> python3 

AFAIK pip is supposed to be there as well. Creating the virtual env with high verbosity yields this:

Installing setuptools, pip... Running command /Users/foghin/code/tastekid/venv/bin/python3 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip Ignoring indexes: https://pypi.python.org/simple/ Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python3.3/site-packages Requirement already satisfied (use --upgrade to upgrade): pip in /usr/local/lib/python3.3/site-packages Cleaning up... ...Installing setuptools, pip...done. 

This means that all the packages I install while the virtual env is activated go to my global site packages (/usr/local/lib/python3.3/site-packages), but they are not picked up by the sandboxed python.

How can I get virtualenv to properly install pip in my local environment?

Update: virtualenv version is 1.11.

4
  • Try creating the environment with virtualenv --no-site-packages. Commented Jan 19, 2014 at 16:09
  • You should mention the exact version number of virtualenv, so that if this is a bug, it will be easier to track it down. Commented Jan 19, 2014 at 16:09
  • @minitech from virtualenv --help: --no-site-packages DEPRECATED. Retained only for backward compatibility. Not having access to global site-packages is now the default behavior. Commented Jan 19, 2014 at 16:14
  • @StefanoSanfilippo updated my question to include virtualenv version. Commented Jan 19, 2014 at 16:14

1 Answer 1

1

As of this writing, Homebrew installs Python 3.3.3 ($ brew info python3).

And as of Python 3.3, Python's standard library now includes its own virtual environment implementation, and does not require the virtualenv package. See the venv module documentation. With the Homebrew Python 3 package, the command-line tool is named pyvenv-3.3.

I believe using this implementation should resolve the issues you're encountering.

Sign up to request clarification or add additional context in comments.

1 Comment

I've tried pyvenv as well, but that explicitly doesn't install pip and setuptools. I ended up installing them manually in the virtual environment, which seems to have worked. However, this still doesn't answer why virtualenv doesn't work as advertised.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.