Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyvenv & pip not installing into local site-packages

I'm test driving the Django 1.6b, Python 3.3.2 (compiled from source) and pyvenv with Ubuntu 12.04.

Every time I try and install perform a pip install [package] the package attempts to install itself globally rather than into my local environment. A simple workflow is as follows:

$ pyvenv environments/roebk

$ source environments/roebk/bin/activate

$ (roebk) pip install south

error: could not create '/usr/local/lib/python3.3/site-packages/south': Permission denied

I've double checked that I'm using the correct version of pip.

$ pip -V pip 1.4 from /usr/local/lib/python3.3/site-packages/pip-1.4-py3.3.egg (python 3.3)

Am I missing anything obvious?

like image 371
Kristian Roebuck Avatar asked Feb 15 '23 17:02

Kristian Roebuck


1 Answers

Did you install setuptools and pip into the environment? virtualenv installs setuptools and pip automatically into a new environment.

$ virtualenv qwerty 
New python executable in qwerty/bin/python
Installing setuptools............done. 
Installing pip...............done.
$ 

According to the pyvenv docs you need to install them into the new environment manually.

Common installation tools such as Distribute and pip work as expected with venvs - i.e. when a venv is active, they install Python packages into the venv without needing to be told to do so explicitly. Of course, you need to install them into the venv first: this could be done by running distribute_setup.py with the venv activated, followed by running easy_install pip. Alternatively, you could download the source tarballs and run python setup.py install after unpacking, with the venv activated.

like image 182
AndrewS Avatar answered Feb 28 '23 19:02

AndrewS