question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pip Installs Packages Into Global Enviroment While VirtualEnv is Activated

See original GitHub issue
  • Pip version: 8.1.1
  • Python version: 3.5
  • Operating system: Ubuntu 16.04

Description:

I am trying to create a virtualenv and install packages from requirements.txt that I have with the project. When I create the environment, I check that the python and pip indeed come from that enviroment. Namely, when I run: source ./virtualenv/bin/activate which pip which python

I get results that point to the binaries located inside the virtualenv directory

What I’ve run:

I then proceed to install the packages: pip install -r requirements.txt

For awhile, it was giving me trouble about the pkg-resources=0.0.0 line within the requirements.txt. As it turned, that line is input into this file because of a bug in Ubuntu. As you can probably surmise, I had created this file on an Ubuntu machine.

Once I strike the line out, the installation proceeds.

However, when I run pip list after the installation, the list contains only

pip (8.1.1) pkg-resources (0.0.0) setuptools (20.7.0)

What is more, if I deactivate the virtualenv and run pip list globally, I see that all of the dependencies were installed globally.

There are two questions here. One - that is most obious - why does it happen? The second one is how could I clean up my global packages and uninstall the pollutants which now reside there?

Here is the requirements.txt file

aldryn-apphooks-config==0.3.3
aldryn-background-image==0.1.1
aldryn-boilerplates==0.7.5
aldryn-bootstrap3==1.2.2
aldryn-categories==1.0.4
aldryn-common==1.0.4
aldryn-events==1.1.7
aldryn-forms==2.2.2
aldryn-newsblog==1.3.3
aldryn-people==1.2.2
aldryn-reversion==1.0.9
aldryn-translation-tools==0.2.1
Babel==2.4.0
backport-collections==0.1
cssselect==1.0.1
cssutils==1.0.2
dj-database-url==0.4.2
Django==1.9.13
django-absolute==0.3
django-appconf==1.0.2
django-appdata==0.1.6
django-bootstrap3==8.2.3
django-classy-tags==0.8.0
django-cms==3.4.3
django-emailit==0.2.2
django-extended-choices==1.1.1
django-filer==1.2.7
django-formtools==2.0
django-mptt==0.8.7
django-parler==1.7
django-phonenumber-field==1.3.0
django-polymorphic==1.0.2
django-reversion==1.10.2
django-sekizai==0.10.0
django-simple-captcha==0.5.5
django-sizefield==0.9.1
django-sortedm2m==1.3.3
django-standard-form==1.1.1
django-tablib==3.2
django-taggit==0.22.1
django-treebeard==4.1.0
djangocms-admin-style==1.2.7
djangocms-attributes-field==0.2.0
djangocms-column==1.7.0
djangocms-file==2.0.2
djangocms-googlemap==1.1.0
djangocms-installer==0.9.6
djangocms-link==2.1.2
djangocms-picture==2.0.5
djangocms-snippet==1.9.2
djangocms-style==2.0.2
djangocms-text-ckeditor==3.5.0
djangocms-video==2.0.3
easy-thumbnails==2.3
future==0.16.0
html5lib==0.9999999
lxml==3.7.3
olefile==0.44
phonenumbers==8.4.3
phonenumberslite==8.4.3
Pillow==4.1.1
premailer==3.0.1
python-dateutil==2.6.0
python-slugify==1.2.0
pytz==2017.2
requests==2.14.2
six==1.10.0
tablib==0.11.4
tzlocal==1.4
Unidecode==0.4.20
YURL==0.13

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
suyash248commented, Feb 27, 2018

I had a similar issue. Following command worked for me-

<path-to-your-env>/bin/pip3 install -r requirements.txt

4reactions
artforlifecommented, Jun 6, 2017

@RonnyPfannschmidt you are not being constructive. Show how to DO IT instead of tellling me how NOT TO DO IT.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing packages using pip and virtual environments
This guide discusses how to install packages using pip and a virtual environment manager: either venv for Python 3 or virtualenv for Python...
Read more >
in virtual environment pip installs in global instead of ... - GitHub
Description. When I create a virtual environment with venv: py -m venv my_env and activate it, pip installs packages in the global ......
Read more >
pip installing in global site-packages instead of virtualenv
Now, when I try to install e.g. Markdown using pip in the activated virtualenv, pip will install in the global site-packages folder instead...
Read more >
Further Configuration of Pip and Virtualenv
As a result of this, it is very easy to install packages globally while thinking that you are actually installing the package for...
Read more >
Stop Installing Python Packages Globally — Use Virtual ...
Python virtual environments allow you to install Python packages in an isolated location for a particular application instead of installing them globally.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found