Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip doesn't install packages to activated virtualenv, ignores requirements.txt

I am attempting to setup a development environment on my new dev machine at home. I have just installed Ubuntu and now I am attempting to clone a remote repo from our web-server and install its dependencies so I can begin work.

So far I have manually installed virtualenv and virtualenvwrapper from pypi and edited my bash.rc appropriately to source my virtualenvs when i start my terminal. I then cloned my repo to ~/projects/project-name/websitename.com. Then I used virtualenvwrapper to mkvirtualenv env-name from ~/projects/project-name/websitename.com. This reflects exactly the file-structure/setup of the web-server I am cloning from. So far so good.

I logged into the dev server and activate the virtualenv there and use pip freeze -l > req.txt to render a dependencies list and scp to my local machine. I activate the virtualenv on my local machine, navigate to the ~/projects/project-name/websitename.com and execute pip install -r path-to-req.txt and it runs through all of the dependencies as if nothing is wrong. However, when i attempt to manage.py syncdb i get an error about not finding core django packages. What the hell? So i figure somehow Django failed to install, i run pip install Django==1.5.1 and it completes successfully. I got to setup my site again and get another error about no module named django_extensions. Okay, what the hell with it, i just installed all of these packages with pip?!

So i pip freeze -l > test.txt and cat test.txt, what does it list? Django==1.5.1, the one package I just manually installed. Why isn't pip installing my dependencies from my specified list into my virtualenv? What am I messing up here?

-EDIT-------------

Which pip gives me the path to pip in my virtualenv

I have only 1 virtualenv and it is activated

like image 201
leotemp Avatar asked Sep 03 '13 23:09

leotemp


1 Answers

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!

like image 160
lively Avatar answered Oct 18 '22 11:10

lively