mkvirtualenv --no-site-packages still finds and installs global packages in new environment

609 views Asked by At

I am using virtualenvwrapper to create/manage my virtual environments. Upon running pip freeze on my environments, I was surprised to find that several tens of Python modules and packages (installed before I knew about virtualenv/wrapper), are being installed in my new environment.

This is NOT the expected behaviour; I want to have a clean environment, where only the packages I have installed in that environment, are available.

The command I'm using is:

mkvirtualenv --no-site-packages mynewenv

When I run pip freeze in that new environment, I get the following long list (I was expecting nothing to be installed in the new environment):

apturl (0.5.2)
beautifulsoup4 (4.4.1)
bleach (1.5.0)
blinker (1.3)
Brlapi (0.6.4)
chardet (2.3.0)
checkbox-support (0.22)
command-not-found (0.3)
coverage (3.7.1)
cryptography (1.2.3)
Cython (0.25.2)
decorator (4.0.10)
defer (1.0.6)
Django (1.10.5)
djangorestframework (3.5.3)
entrypoints (0.2.2)
enum34 (1.1.6)
feedparser (5.1.3)
guacamole (0.9.2)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
ipykernel (4.5.2)
ipython (5.1.0)
ipython-genutils (0.1.0)
ipywidgets (5.2.2)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.4.0)
jupyter-console (5.0.0)
jupyter-core (4.2.1)
language-selector (0.1)
louis (2.6.4)
lxml (3.5.0)
lz4 (0.8.2)
Mako (1.0.3)
MarkupSafe (0.23)
mistune (0.7.3)
mockextras (1.0.2)
nbconvert (5.0.0)
nbformat (4.2.0)
notebook (4.3.1)
numpy (1.11.3)
oauthlib (1.0.3)
onboard (1.2.0)
padme (1.1.1)
pandas (0.19.2)
pandocfilters (1.4.1)
pbr (1.10.0)
pexpect (4.0.1)
pickleshare (0.7.4)
Pillow (3.1.2)
pip (9.0.1)
plainbox (0.25)
prompt-toolkit (1.0.9)
ptyprocess (0.5)
pyasn1 (0.1.9)
pycups (1.9.73)
pycurl (7.43.0)
Pygments (2.1)
pygobject (3.20.0)
PyJWT (1.3.0)
pymongo (3.4.0)
pyparsing (2.0.3)
pysmbc (1.0.15.5)
python-apt (1.1.0b1)
python-dateutil (2.6.0)
python-debian (0.1.27)
python-systemd (231)
pytz (2016.10)
pyxdg (0.25)
pyzmq (16.0.2)
qtconsole (4.2.1)
reportlab (3.3.0)
requests (2.9.1)
sessioninstaller (0.0.0)
setuptools (23.0.0)
simplegeneric (0.8.1)
six (1.10.0)
stevedore (1.15.0)
system-service (0.3)
terminado (0.6)
testpath (0.3)
tornado (4.4.2)
traitlets (4.3.1)
tzlocal (1.3)
ubuntu-drivers-common (0.0.0)
ufw (0.35)
unattended-upgrades (0.1)
unity-scope-calculator (0.1)
unity-scope-chromiumbookmarks (0.1)
unity-scope-colourlovers (0.1)
unity-scope-devhelp (0.1)
unity-scope-firefoxbookmarks (0.1)
unity-scope-gdrive (0.7)
unity-scope-manpages (0.1)
unity-scope-openclipart (0.1)
unity-scope-texdoc (0.1)
unity-scope-tomboy (0.1)
unity-scope-virtualbox (0.1)
unity-scope-yelp (0.1)
unity-scope-zotero (0.1)
urllib3 (1.13.1)
usb-creator (0.3.0)
virtualenv (15.1.0)
virtualenv-clone (0.2.6)
wcwidth (0.1.7)
wheel (0.29.0)
widgetsnbextension (1.2.6)
xdiagnose (3.8.4)
xkit (0.0.0)
XlsxWriter (0.7.3)

[[Miscellaneous Information]]

virtualenv --version 15.1.0 
virtualenvwrapper==4.7.2 
OS: Ubuntu 16.0.4
Python: 2.7 & 3.5
which pip : /usr/local/bin/pip
which pip3: /usr/local/bin/pip3

What am I doing wrong?

1

There are 1 answers

2
Harald Nordgren On

Did you activate the virtualenv? It's done by "sourcing" the active script:

source <env>/bin/activate

Other problems could be long path names or spaces in the path. What does pwd give in the you virtualenv directory?