I want to download Python package pipy.org
and move them to another machine and finally install that packages with downloaded .whl
files in that machine
This is requirements.txt
file:
amqp==5.1.1
anytree==2.8.0
asgiref==3.5.2
async-timeout==4.0.2
attrs==22.1.0
autobahn==22.7.1
Automat==22.10.0
beautifulsoup4==4.11.1
billiard==3.6.4.0
celery==5.2.7
certifi==2022.9.24
cffi==1.15.1
channels==4.0.0
channels-redis==4.0.0
charset-normalizer==2.1.1
click==8.1.3
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
constantly==15.1.0
coreapi==2.3.3
coreschema==0.0.4
cryptography==38.0.3
daphne==4.0.0
Deprecated==1.2.13
Django==4.0.8
django-celery-beat==2.3.0
django-celery-results==2.4.0
django-filter==22.1
django-jalali==6.0.0
django-timezone-field==5.0
djangorestframework==3.14.0
djangorestframework-simplejwt==5.2.2
drf-yasg==1.21.4
et-xmlfile==1.1.0
gunicorn==20.1.0
h2==4.1.0
hpack==4.0.0
hyperframe==6.0.1
hyperlink==21.0.0
idna==3.4
incremental==22.10.0
inflection==0.5.1
itypes==1.2.0
jdatetime==4.1.0
Jinja2==3.1.2
kombu==5.2.4
lxml==4.9.1
MarkupSafe==2.1.1
msgpack==1.0.4
multitasking==0.0.11
numpy==1.23.3
openpyxl==3.0.10
packaging==21.3
pandas==1.5.0
pandas-datareader==0.10.0
Pillow==9.2.0
priority==1.3.0
prompt-toolkit==3.0.31
psutil==5.9.2
psycopg2==2.9.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
PyJWT==2.6.0
pyOpenSSL==22.1.0
pyparsing==3.0.9
python-crontab==2.6.0
python-dateutil==2.8.2
python-dotenv==0.21.0
pytz==2022.4
redis==4.3.4
requests==2.28.1
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
service-identity==21.1.0
simplejson==3.17.6
six==1.16.0
soupsieve==2.3.2.post1
sqlparse==0.4.3
Twisted==22.10.0
txaio==22.2.1
typing_extensions==4.4.0
tzdata==2022.5
Unidecode==1.3.6
uritemplate==4.1.1
urllib3==1.26.12
vine==5.0.0
wcwidth==0.2.5
wrapt==1.14.1
yfinance==0.1.74
zope.interface==5.5.1
I did download packages with:
pip download -r requirements.txt
This is list of downloaded pacakges in ~/LocalPythonPackage
directory:
→ ls
amqp-5.1.1-py3-none-any.whl lxml-4.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
anytree-2.8.0-py2.py3-none-any.whl MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
asgiref-3.5.2-py3-none-any.whl msgpack-1.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
async_timeout-4.0.2-py3-none-any.whl multitasking-0.0.11-py3-none-any.whl
attrs-22.1.0-py2.py3-none-any.whl numpy-1.23.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
autobahn-22.7.1.tar.gz openpyxl-3.0.10-py2.py3-none-any.whl
Automat-22.10.0-py2.py3-none-any.whl packaging-21.3-py3-none-any.whl
beautifulsoup4-4.11.1-py3-none-any.whl pandas-1.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
billiard-3.6.4.0-py3-none-any.whl pandas_datareader-0.10.0-py3-none-any.whl
celery-5.2.7-py3-none-any.whl Pillow-9.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
certifi-2022.9.24-py3-none-any.whl priority-1.3.0-py2.py3-none-any.whl
cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl prompt_toolkit-3.0.31-py3-none-any.whl
channels-4.0.0-py3-none-any.whl psutil-5.9.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
channels_redis-4.0.0-py3-none-any.whl psycopg2-2.9.4.tar.gz
charset_normalizer-2.1.1-py3-none-any.whl pyasn1-0.4.8-py2.py3-none-any.whl
click-8.1.3-py3-none-any.whl pyasn1_modules-0.2.8-py2.py3-none-any.whl
click_didyoumean-0.3.0-py3-none-any.whl pycparser-2.21-py2.py3-none-any.whl
click_plugins-1.1.1-py2.py3-none-any.whl PyJWT-2.6.0-py3-none-any.whl
click_repl-0.2.0-py3-none-any.whl pyOpenSSL-22.1.0-py3-none-any.whl
constantly-15.1.0-py2.py3-none-any.whl pyparsing-3.0.9-py3-none-any.whl
coreapi-2.3.3-py2.py3-none-any.whl python-crontab-2.6.0.tar.gz
coreschema-0.0.4.tar.gz python_dateutil-2.8.2-py2.py3-none-any.whl
cryptography-38.0.3-cp36-abi3-manylinux_2_28_x86_64.whl python_dotenv-0.21.0-py3-none-any.whl
daphne-4.0.0-py3-none-any.whl pytz-2022.4-py2.py3-none-any.whl
Deprecated-1.2.13-py2.py3-none-any.whl redis-4.3.4-py3-none-any.whl
Django-4.0.8-py3-none-any.whl requests-2.28.1-py3-none-any.whl
django_celery_beat-2.3.0-py3-none-any.whl ruamel.yaml-0.17.21-py3-none-any.whl
django_celery_results-2.4.0-py3-none-any.whl ruamel.yaml.clib-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
django_filter-22.1-py3-none-any.whl service_identity-21.1.0-py2.py3-none-any.whl
django_jalali-6.0.0-py3-none-any.whl setuptools-65.6.3-py3-none-any.whl
djangorestframework-3.14.0-py3-none-any.whl simplejson-3.17.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
djangorestframework_simplejwt-5.2.2-py3-none-any.whl six-1.16.0-py2.py3-none-any.whl
django_timezone_field-5.0-py3-none-any.whl soupsieve-2.3.2.post1-py3-none-any.whl
drf_yasg-1.21.4-py3-none-any.whl sqlparse-0.4.3-py3-none-any.whl
et_xmlfile-1.1.0-py3-none-any.whl Twisted-22.10.0-py3-none-any.whl
gunicorn-20.1.0-py3-none-any.whl txaio-22.2.1-py2.py3-none-any.whl
h2-4.1.0-py3-none-any.whl typing_extensions-4.4.0-py3-none-any.whl
hpack-4.0.0-py3-none-any.whl tzdata-2022.5-py2.py3-none-any.whl
hyperframe-6.0.1-py3-none-any.whl Unidecode-1.3.6-py3-none-any.whl
hyperlink-21.0.0-py2.py3-none-any.whl uritemplate-4.1.1-py2.py3-none-any.whl
idna-3.4-py3-none-any.whl urllib3-1.26.12-py2.py3-none-any.whl
incremental-22.10.0-py2.py3-none-any.whl vine-5.0.0-py2.py3-none-any.whl
inflection-0.5.1-py2.py3-none-any.whl wcwidth-0.2.5-py2.py3-none-any.whl
itypes-1.2.0-py2.py3-none-any.whl wrapt-1.14.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
jdatetime-4.1.0-py3-none-any.whl yfinance-0.1.74-py2.py3-none-any.whl
Jinja2-3.1.2-py3-none-any.whl zope.interface-5.5.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
and after copy all `.whl files to traget computer, I did run this code:
pip install --no-index --find-links ~/LocalPythonPackage -r requirements.txt
But I got this error:
ERROR: Could not find a version that satisfies the requirement MarkupSafe==2.1.1 (from versions: none)
ERROR: No matching distribution found for MarkupSafe==2.1.1
I use python3.11
and Ubuntu 20.04.5 LTS
in both computers. I think that, this problem is for dependencies or different in OS
.
Can you help me to solve this problem?
2
Answers
You use Python 3.11 but wheels you show above are for Python 3.10. You should download packages on a host with the same processor architecture (x64 seems to be your case), the same OS and version (Ubuntu 20) and the same minor Python version (Python 3.11.*, that is any Python 3.11 does but not Python 3.10) as the target host.
Or use Python 3.10 on the offline host.
TL;DR
You need to use
--platform
and--only-binary=:all:
(sometimes need to specify--abi
and--python-version
as well) flags to download wheels that is compatible with your installation target machine.(Important: if your target machine is not
aarch64
architecture, replace themanylinux2014_aarch64
with the correct platform tag)Some wheels are platform dependent
The error happens because pip can’t install the MarkupSafe wheel you provided in the directory, therefore it says it can’t find a valid distribution.
Since you mentioned the two computers are same in Python version and OS distribution, I’m gonna guess that the two computers you use are different in architectures. (ex. the target computer is aarch64)
The following explanation and solution are based on this guess.
The Python Packaging User Guide states a Python wheel could be either a "pure Python wheel" or a "platform wheel". When a Python package contains extensions that requires compilation, the produced wheel will be platform-specific and cannot be installed on other non-compatible platforms.
In your case, the wheel
MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
is a platform wheel built for Python 3.10 runtime, manylinux2014 and x86_64 architecture machines.The wheel filename is defined in PEP 491, formatted as
{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl
.Hence by the name of a wheel (to be precise, the last three component in the filename) you can find out if it is a pure Python wheel or a platform wheel.
Newer Python versions (except different major versions) can still install platform wheels built for older minor versions
Another answer in the post says you need to install a wheel that has the same miner Python version in the Python tag, but that is usually not true.
According to PEP 425:
That means
pip
is responsible for make decision whether a distribution could be installed on the current system.Let’s take a look at the source code of
pip
. TheCandidateEvaluator
evaluate possible distribution candidates when trying to install a package.If you trace the code all the way to
_py_interpreter_range
, you’ll find out a list of older Python minor versions are appended to the supported tags in descending order.For Python 3.11,
Python 3.10
,Python 3.9
,Python 3.8
… are all considered supported tags for pip.Solution
from https://pip.pypa.io/en/stable/cli/pip_download/.
To download
MarkupSafe
formanylinux2014_aarch64
:And change your package preparation command to: