Reputation: 4008
I've two files related to requirements. I was getting this error, when calling:
$ pip install -r requirements.txt --no-index --find-links file:///tmp/packages
Error:
Looking in links: file:///tmp/packages
Requirement already satisfied: asgiref==3.2.3 in d:\virtual_envs\scolarte\lib\site-packages (from -r requirements-dev.txt (line 1)) (3.2.3)
Collecting boto3==1.12.0 (from -r requirements-dev.txt (line 2))
Url 'file:///tmp/packages' is ignored: it is neither a file nor a directory.
Could not find a version that satisfies the requirement boto3==1.12.0 (from -r requirements-dev.txt (line 2)) (from versions: )
No matching distribution found for boto3==1.12.0 (from -r requirements-dev.txt (line 2))
But the package installed when calling:
pip install boto3==1.12.0
why?
a) requirements.txt:
-r requirements-dev.txt
gunicorn
psycopg2
b) requirements-dev.txt
asgiref==3.2.3
boto3==1.12.0
botocore==1.14.16
defusedxml==0.6.0
diff-match-patch==20181111
dj-database-url==0.5.0
dj-static==0.0.6
Django==3.0.3
django-crispy-forms==1.8.1
django-import-export==2.0.1
django-sendgrid-v5==0.8.1
django-storages==1.9.1
djangorestframework==3.11.0
docutils==0.15.2
et-xmlfile==1.0.1
future==0.18.2
jdcal==1.4.1
jmespath==0.9.4
MarkupPy==1.14
numpy==1.18.1
odfpy==1.4.1
openpyxl==3.0.3
pandas==0.25.3
Pillow==7.0.0
python-dateutil==2.8.1
python-decouple==3.3
python-http-client==3.2.4
pytz==2019.3
PyYAML==5.3
s3transfer==0.3.3
sendgrid==6.1.1
six==1.14.0
sqlparse==0.3.0
static3==0.7.0
tablib==0.14.0
urllib3==1.25.8
xlrd==1.2.0
xlwt==1.3.0
Upvotes: 2
Views: 4127
Reputation: 8245
When you are using
pip install boto3==1.12.0
You are installing from PyPI (The Python Package Index). Whereas by using the --no-index
option in
pip install -r requirements.txt --no-index --find-links file:///tmp/packages
you are explicitly telling pip
not to look for it in the PyPI.
Form the PyPI Documentation
--no-index
Ignore package index (only looking at --find-links URLs instead).
-f, --find-links
<url>
If a url or path to an html file, then parse for links to archives. If a local path or file:// url that’s a directory, then look for archives in the directory listing.
Also on how pip finds packages (emphasis mine)
pip looks for packages in a number of places: on PyPI (if not disabled via --no-index), in the local filesystem, and in any additional repositories specified via --find-links or --index-url. There is no ordering in the locations that are searched. Rather they are all checked, and the “best” match for the requirements (in terms of version number - see PEP 440 for details) is selected.
Upvotes: 3