I\'ve had great luck with pip in the past, but working at installing some stuff in a venv on is giving me some headaches. I keep getting errors like No distributions at
I had this problem but with a different cause - I had an old version of virtualenv. Before version 1.7 you had to specify the option --no-site-packages when you create the virtual environment to not include global packages.
Two options to fix this, either upgrade your virtualenv:
sudo pip install virtualenv --upgrade
virtualenv venv
Or use the old one with the no-site-packages option:
virtualenv venv --no-site-packages
That fixed my requirements.txt file.
I see a few problems:
Your requirements.txt
is for the base system Python, not any virtual environment. Django does not have any external dependencies.
You are using the root user to install packages in your virtual environment (or you are using sudo
when you shouldn't).
The best option is to start from scratch:
$ virtualenv myvenv
...
$ source myvenv/bin/activate
(myvenv) $ pip install django
...
(myvenv) $ pip freeze > requirements.txt
Following solution has worked for me :
(my-virtualenv) 20:42 ~/MyPf (master)$ pip freeze > requirements.txt |
(my-virtualenv) 20:43 ~/MyPf (master)$ pip install -r requirements.txt
Had a similar issue but the above method didn't work for me. Clarified it with a rather simpler solution:
(venv) $ pip install --upgrade -r requirements.txt
UPDATE:
This command upgrades all packages that have been explicitly listed in your requirements.txt
file.
Your requirements.txt
file is just a list of pip install arguments placed in a file. They are used to hold the result from pip freeze for the purpose of achieving repeatable installations. In this case, your requirements.txt
file contains a pinned version of everything that was installed when pip freeze was run.
try pip install -r requirements.txt
It worked for me
sudo pip install -r requirements.txt
or pip install -r requirements.txt
worked for me