[Solved]-Pip doesn't install packages to activated virtualenv, ignores requirements.txt

6👍

My usual workflow is to

pip freeze > someFile.txt

and then install with

pip install -r someFile.txt

So I’m certain that this should work just fine. Unfortunately I can’t really tell you anything besides make sure to check that

  1. You really are in the virtualenv that you think you are in. Make sure to run

    workon yourVirtualEnvName
    

    to activate it just in case that matters.

  2. Make sure to check that pip is within your virtualenv.

    which pip
    

    gives me

    /path/to/home/.virtualenvs/myVirtEnv/bin/pip
    

Sorry I can’t give you a more concrete answer. I have to do this semi-regularly and I’ve never had a problem with it skipping dependencies. Best of luck!

👤lively

3👍

Struggled with some variation of this issue not long ago; it ended up being my cluttered .bash_profile file.

Make sure you don’t have anything that might mess up your virtualenv inside your .bash_profile/.bashrc, such as $VIRTUAL_ENV or $PYTHONHOME or $PYTHONPATH environment variables.

👤mccc

2👍

I know this is an old post, but I just encountered a similar problem. In my case the cause was that I was running the pip install command using sudo. This made the command run globally and the packages install in the global python path.

Hope that helps somebody.

Leave a comment