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 all found for somepackage Storing debug log for failure in /root/.pip/pip.log
Could not find any downloads that satisfy the requirement somepackage
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-RjqjFW/psycopg2
I know these packages are installed on the main system, but its like they won't work on the venv. How do you all get around this problem? It's been a long day and I just don't understand what the problem is, especially because they work on my local system, they work on the main python install on my remote system, but not in the venv for some crazy reason. Any ideas?
Here is the requirements, I thought it was alittle intense for django, but thats what pip freeze > requirements.txt gave me
Babel==1.3
Django==1.7.1
Fabric==1.10.1
Flask==0.10.1
Flask-Babel==0.9
Flask-Login==0.2.11
Flask-Mail==0.9.1
Flask-OpenID==1.2.4
Flask-SQLAlchemy==2.0
Flask-WTF==0.10.3
Flask-WhooshAlchemy==0.56
Jinja2==2.7.3
MarkupSafe==0.23
PAM==0.4.2
Pillow==2.3.0
Pygments==1.6
Scrapy==0.24.4
Sphinx==1.2.2
Tempita==0.5.2
WTForms==2.0.1
Werkzeug==0.9.6
Whoosh==2.6.0
adium-theme-ubuntu==0.3.4
apt-xapian-index==0.45
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
blinker==1.3
boto==2.20.1
bottle==0.12.7
certifi==14.05.14
chardet==2.0.1
colorama==0.2.5
command-not-found==0.3
coverage==3.7.1
cssselect==0.9.1
debtagshw==0.1
decorator==3.4.0
defer==1.0.6
dirspec==13.10
docutils==0.11
duplicity==0.6.23
ecdsa==0.11
flipflop==1.0
guess-language==0.2
guppy==0.1.9
html5lib==0.999
httplib2==0.8
ipython==2.3.1
itsdangerous==0.24
lockfile==0.8
lxml==3.3.3
nose==1.3.4
numpy==1.8.2
oauthlib==0.6.1
oneconf==0.3.7
paramiko==1.15.2
pbr==0.10.7
pexpect==3.1
piston-mini-client==0.7.5
psycopg2==2.5.4
pyOpenSSL==0.13
pyasn1==0.1.7
pycrypto==2.6.1
pycups==1.9.66
pycurl==7.19.3
pygame==1.9.1release
pygobject==3.12.0
pyserial==2.6
pysmbc==1.0.14.1
python-apt==0.9.3.5ubuntu1
python-debian==0.1.21-nmu2ubuntu2
python-openid==2.2.5
pytz==2014.10
pyxdg==0.25
queuelib==1.2.2
reportlab==3.0
requests==2.2.1
roman==2.0.0
sessioninstaller==0.0.0
simplegeneric==0.8.1
six==1.5.2
software-center-aptd-plugins==0.0.0
speaklater==1.3
sqlalchemy-migrate==0.9.2
sqlparse==0.1.14
system-service==0.1.6
tornado==4.0.2
unity-lens-photos==1.0
urllib3==1.7.1
virtualenv==1.11.6
w3lib==1.10.0
wsgiref==0.1.2
wxPython==2.8.12.1
wxPython-common==2.8.12.1
xdiagnose==3.6.3build2
z3c.xmlhttp==0.5.1
zope.interface==4.0.5
zope.publisher==4.0.0a4
zope.traversing==4.0.0
zope.viewlet==4.0.0a1
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
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
sudo pip install -r requirements.txt or pip install -r requirements.txt worked for me
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.
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
You have the same problem that I stack with, So the solution is easy:
You must check the file path the text takes from it like in a blue circle.
Run code below:
cd C:\Users\yk406.anaconda\yolov7
Note: path directory is an example paste the path that your environment works in
when the first step is done the second one is done by installing file text like in a green circle.
Run code below:
pip install -r requirements.txt
Related
When I run the following command within my virtual env
sudo pip3 install -r requirements.txt
It says that the packages were successfully installed, but when I try to run or import the packages, it can not find them.
pip3 show returns nothing.
However, when I manually run
sudo pip3 install package-name
It installs the package just fine and it works.
Why is pip install -r requirements.txt not working? It always worked in the past. Now that I reinstalled Python it stopped working..
System:
Ubuntu 14.04
Python changed from 3.4 to 3.6.2
requirements.txt
Django==2.0.8
django-debug-toolbar
channels
Debugging in Terminal:
EDIT: This makes no sense.
pip3 install -r requirements.txt
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn>=0.18->daphne~=2.3->channels==2.3.0->-r requirements.txt (line 79)) (2.19)
$ pip3 --version
pip 19.2.3 from /home/dominic/Desktop/projects/printrender/env/lib/python3.6/site-packages/pip (python 3.6)
I install packages in my Virtual Environemnt using pip3 install -r requirements and it says that they are already installed, but when I run Pip Freeze, it returns nothing, as if nothing is installed.
Pip3 install -r requirements is placing my packages in my local packages python packages, and pip freeze is referencing my virtual env packages.
pip is not installing this packages in the correct place
I don't think you should use sudo when you're using a virtual environment. Try without.
I think you created a virtual environment for python 2 by mistake since pip3 is used from /usr/local/lib/python3.6 instead of in the env. You can create the virtual environment specifically for python3 by using the command
virtualenv -p python3 env
Could you try creating a new virtual environment with the command above and see if it works?
Using sudo was part of the issue and some of the packages in my requirements.txt were causing errors with the latest version of pip.
When you use sudo, you installed your packages globally. This must solve your problem.
sudo su
. venv/bin/activate
pip install -r requirements.txt
i want to install electrum-ltc into my app like this:
but if i include this line in my requirements.txt the role-out fails and i have to install it manually with the same line shown above.
if i install it like this at the requirements.txt:
some modules do not get installed in that specific case its the script package.
thanks in advance
I don't know if you can accept it as answer because I "cheated" in a way.
I did:
$ mkdir /tmp/tgz-install && cd /tmp/tgz-install
$ pipenv install https://download.electrum.org/3.3.3/Electrum-3.3.3.tar.gz\#egg\=electrum\[fast\]
$ pipenv shell
$ pip3 freeze > requirements.txt
$ cat requirements.txt
I got:
aiohttp==3.5.4
aiohttp-socks==0.2.2
aiorpcX==0.10.4
async-timeout==3.0.1
attrs==18.2.0
certifi==2018.11.29
chardet==3.0.4
dnspython==1.16.0
ecdsa==0.13
Electrum==3.3.3
idna==2.8
jsonrpclib-pelix==0.4.0
multidict==4.5.2
protobuf==3.6.1
pyaes==1.6.1
pycryptodomex==3.7.3
QDarkStyle==2.5.4
qrcode==6.1
six==1.12.0
yarl==1.3.0
I suppose you can do everything with just pip.
In case you can't use pipenv directly - you can use created requirements.
Inform in case you have some trouble.
I am hitting a unique version of the well documented Virtualenv-Pip bug discussed in answers like here and here. In these cases the issue was pip was installing in a global folder, in some cases because the shebang in one of the pip scripts was wrong, in others because the line 42 in the bin/activate script was wrong, but it always installed globally.
My issue is different: within my virtual environment pip install <package> works as desired (installing locally), but pip install -r requirements.txt installs into the void. For example:
pip install scipy
then looking at the contents of /home/user/software/project/venv/lib/python3.6/site-packages i get the result:
easy_install.py
numpy
numpy-1.16.1.dist-info
pip
pip-19.0.2.dist-info
pkg_resources
__pycache__
scipy
scipy-1.2.1.dist-info
setuptools
setuptools-40.8.0.dist-info
wheel
wheel-0.33.0.dist-info
However, when in the same virtual environment, I run pip install -r requirements.txt, where the requirements.txt asks to install numpy, Cython, sklearn, matplotlib, and argparse, and which outputs:
Collecting Cython (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/16/98/49aa24054e99e9c7734e49d6996662f547e4e2faae0051d35fbbc461afa4/Cython-0.29.5-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
100% |████████████████████████████████| 2.1MB 23.6MB/s
Collecting numpy (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/f5/bf/4981bcbee43934f0adb8f764a1e70ab0ee5a448f6505bd04a87a2fda2a8b/numpy-1.16.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting sklearn (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting matplotlib (from -r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/71/07/16d781df15be30df4acfd536c479268f1208b2dfbc91e9ca5d92c9caf673/matplotlib-3.0.2-cp36-cp36m-manylinux1_x86_64.whl (12.9MB)
100% |████████████████████████████████| 12.9MB 6.3MB/s
Collecting argparse (from -r requirements.txt (line 5))
Downloading https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
This results in no new additions to the local site-packages. What's more when I try to see where they installed, there are no site-packages directories in /usr/lib/python2.7, /usr/local/lib/python2.7, /usr/lib/python3, /usr/lib/python3.6, usr/lib/python3.7, ~/.local/lib/python3.6/, or ~/.local/lib/python2.7/.
To verify this, when I run:
find /usr/ -name "Cython"
I get an empty result.
Any advice? I can write a bash script that literally calls pip install instead, but that seems so sloppy, and I feel like I should fix this before it becomes worse.
NOTES:
My machine is on 18.04.1, which has python3.6.7 as python3 and python 2.7.15 as python2 installed as machine defaults, I installed pip for both with sudo apt install python-pip and sudo apt install python3-pip, and this virtual environment was created with virtualenv -p python3 venv
My requirements.txt:
Cython
numpy
sklearn
matplotlib
torch>=0.4.1
torchvision>=0.2.1
argparse
quadprog
Full output from pip install -r requirements.txt
So this is a partial answer, but I figured out at least the problem even if I don't entirely understand why. When I changed:
virtualenv -p python3 venv
to
virtualenv -p /usr/lib/python3.6 venv .
pip install -r requirements.txt worked, yielding the correct site-packages.
Again, I do not know why this worked, but it did. I just tried it again with a different python version with less luck though, so I'm not entirely sure if this is a universal fix. I will edit this answer when I have a better explanation.
my requirements file is like that :
https://github.com/sontek/pyramid_webassets/archive/38b0b9f9f4e36dc22b3a5c10eabf4d9228d97740.zip#egg=pyramid_webassets-0.0
https://github.com/miracle2k/webassets/archive/334d55c6bcfd091cb2d984777daf943acde0d364.zip#egg=webassets-0.8.dev
when running pip install -r requirements.txt I want it to install the specific version of pyramid_webassets, and then the specific webassets version (0.8.dev)
the problem is that pyramid_webassets have the webassets as sub-dependency, and it installs the latest of this package.
so the output of pip freeze is
Chameleon==2.14
Mako==0.9.1
MarkupSafe==0.18
PasteDeploy==1.5.2
WebOb==1.3.1
argparse==1.2.1
pyramid==1.4.5
pyramid-webassets==0.0
repoze.lru==0.6
translationstring==1.1
venusian==1.0a8
webassets==0.9
wsgiref==0.1.2
zope.deprecation==4.1.0
zope.interface==4.0.5
you might notice that webassets version is the latest (0.9) though I specified the version I want (0.8.dev).
I tried to reorder the list, adding the --upgrade flag- nothing helped.
any idea how can I install it and still having the required version of webassets?
Thanks.
soultion:
I found this commend useful:
cat requirements.txt | xargs -L1 pip install
that will install one by one the packages orderly
but we should add --upgrade for the last package so it'll upgrade it.
use pip install option to not install package dependencies
$ pip install --no-deps -r requirements.txt
Doing a pip freeze afterwards
gottfried#sascha-Latitude-XT2:~/venv$ bin/pip freeze
argparse==1.2.1
pyramid-webassets==0.0
webassets==0.8.dev
wsgiref==0.1.2
References
pip cookbook - Ensuring repeatability
What happens when you move webassets higher then pyramid_webassets on the list?
I have a requirements.txt file containing all my dependencies but it is not processed correctly :
After a pip install -r requirements.txt, I get the following pip freeze :
argparse==1.2.1
wsgiref==0.1.2
But when I do a pip install of :
numpy==1.6.2
Django==1.4.2
django-tastypie==0.9.14
pyes==0.19.1
And then run my pip install -r requirements.txt . Then it works.
Here is what my requirements.txt contains :
numpy==1.6.2
Django==1.4.2
django-tastypie==0.9.14
urllib3==1.5
pyes==0.19.1
BeautifulSoup==3.2.1
MySQL-python==1.2.3
IMAPClient==0.9.1
Jinja2==2.6
Pillow==2.0.0
amqp==1.0.9
anyjson==0.3.3
billiard==2.7.3.22
celery==3.0.16
django-celery==3.0.11
django-compressor==1.3
django-concurrency
django-extensions==1.1.1
https://codeload.github.com/toastdriven/django-haystack/zip/master#egg=django-haystack
django-model-utils==1.2.0
django-multiforloop==0.2.1
django-social-auth==0.7.22
html5lib==0.95
httplib2==0.8
kombu==2.5.7
logilab-astng==0.24.2
logilab-common==0.59.0
oauth2==1.5.211
ordereddict==1.1
pycrypto==2.6
pylint==0.27.0
python-dateutil==1.5
python-openid==2.2.5
pytz==2013b
six==1.3.0
unittest2==0.5.1
wsgiref==0.1.2
xlrd==0.9.0
xmltodict==0.4.6
django-storages>=1.1.8
boto==2.8.0
lxml==3.1.0
pyelasticsearch==0.4.1
django-tastypie-elasticsearch==0.1.0
Would anyone have a solution ?
I tried this out and the problem is with django-tastypie-elasticsearch. There is a known issue, whereby installation with pip fails if Django hasn't been installed yet. Here is the issue report:
https://github.com/llonchj/django-tastypie-elasticsearch/issues/1
Looks like django-tastypie-elastic has only two contributors, so you're probably on your own. The good news is that it wasn't your fault!
On mac:
To get your already installed dependencies
pip3 freeze > requirements.txt
from: Automatically create requirements.txt
Then if you want to install them, and you are using a virtual environment
pip3 install -r requirements.txt
from:
How can I install packages using pip according to the requirements.txt file from a local directory?
If you want to update them
I just know how to do it with pip-review.
https://pypi.org/project/pip-review/#description
pip3 install pip-review or pip install pip-review
then pip-review --local --auto
from:
How to upgrade all Python packages with pip
The "https://codeload.github.com/toastdriven/django-haystack/zip/master#egg=django-haystack" line is not a valid pip requirement. It should read "-e git+https://codeload.github.com/toastdriven/django-haystack/zip/master#egg=django-haystack"