Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualenv doesn't install pip

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.

like image 267
Felix Avatar asked Nov 10 '22 14:11

Felix


1 Answers

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.

like image 129
Jacob Budin Avatar answered Nov 15 '22 07:11

Jacob Budin