Question

I want to create a virtual environment using Enthought's Canopy distribution, but with no site packages.

following: https://support.enthought.com/entries/21802240-Use-venv-not-virtualenv-with-Canopy-Python

I set up the environment, leaving off the -s to not install the site packages:

$ venv path/to/virtual_environment_dir
$ source path/to/virtual_environment_dir/bin/activate

And this uses the correct python, but still uses the system easy_install and pip

(env) $ which python
path/to/virtual_environment_dir/bin/python
(env) $ which easy_install
/usr/bin/easy_install
(env) $ which pip
/usr/local/bin/pip

So if I try to install anything, it just installs it globally.

Is there any way to install pip into the virtual environment?

Was it helpful?

Solution

You have to install setuptools and pip manually into the environment. venv in Canopy is backported from the venv in Python 3, so unlike virtualenv, it has no special support for pre-installing these packages into the new environment. Just follow the standard installation instructions for setuptools and pip using the new environment's python executable.

OTHER TIPS

This is from Robert Kern's reply, I just keep having to look up the command so I'll post it here.

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O - | python
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top