0

I'm trying to install my Python packages on an offline computer, but unfortunately when I use pip download <packagename> or pip wheel <packagename> it seems like it's not doing something correctly. Take for example beautifulsoup4. On my online, machine I run pip download beautifulsoup4 and the output files are

beautifulsoup4-4.11.1-py3-none-any.whl
soupsieve-2.3.2.post1-py3-none-any.whl

Then when I move them over to the offline machine and attempt to install them with pip install .\beautifulsoup4-4.11.1-py3-none-any.whl I get:

Processing c:\users\pk2\downloads\bs4\beautifulsoup4-4.11.1-py3-none-any.whl
Collecting soupsieve>1.2 (from beautifulsoup4==4.11.1)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000247B3D74D30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/soupsieve/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000247B3D746A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/soupsieve/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000247B3D74250>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/soupsieve/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000247B3D74400>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/soupsieve/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000247B3D743D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/soupsieve/
  ERROR: Could not find a version that satisfies the requirement soupsieve>1.2 (from beautifulsoup4==4.11.1) (from versions: none)
ERROR: No matching distribution found for soupsieve>1.2 (from beautifulsoup4==4.11.1)

I have had this problem with a lot of other packages as well, although not necessarily every package. For example, here is a similar issue with ffmpegio; it's looking for pluggy even though the pluggy-1.0.0-py2.py3-none-any.whl is located in the same directory.

$ pip install .\ffmpegio_core-0.5.0-py3-none-any.whl
Processing c:\users\pk2\downloads\python\offline package installers 3.8.2\ffmpegio_core\ffmpegio_core-0.5.0-py3-none-any.whl
Collecting pluggy (from ffmpegio-core==0.5.0)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000020A0BF32790>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pluggy/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000020A0BF32DF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pluggy/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000020A0BF32100>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pluggy/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000020A0BF328E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pluggy/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000020A0BF27D60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pluggy/
  ERROR: Could not find a version that satisfies the requirement pluggy (from ffmpegio-core==0.5.0) (from versions: none)
ERROR: No matching distribution found for pluggy (from ffmpegio-core==0.5.0)

It looks like it can't find the dependences even though they are in the same folder. Is there some way to tell pip to find them? It's not like I know the dependency chain for every package I want to install, so it's impractical to figure out the correct order to install them in one-by-one (if that's what the issue is here).

I'm on Windows 10. Can somebody please help me understand how to correctly download and install these packages on machines that remain offline?

joejoejoejoe4
  • 1,206
  • 1
  • 18
  • 38

1 Answers1

1

to download/build the wheels, you'll need:

pip wheel --wheel-dir=.\wheelhouse paramiko==2.11.0

And to install, you need to tell pip where to find your downloaded wheels:

pip install mypackage --no-index --find-links=.\wheelhouse

A complete session for paramiko would look something like follows

Create a new empty virtualenv to show when operations happen, make a wheelhouse directory to download and install wheels from:

(dev36) go|c:\srv> mkvirtualenv piptst
created virtual environment CPython3.10.2.final.0-64 in 3209ms
[...]
(piptst) go|c:\srv> cdvirtualenv
(piptst) go|C:\srv\venv\piptst> mkdir wheelhouse

Fetch paramiko and all its dependent packages, store them in the wheelhouse directory:

(piptst) go|C:\srv\venv\piptst> pip wheel --wheel-dir=.\wheelhouse paramiko==2.11.0
Collecting paramiko==2.11.0
  Downloading paramiko-2.11.0-py2.py3-none-any.whl (212 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 212.9/212.9 KB 3.3 MB/s eta 0:00:00
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cryptography>=2.5
  Downloading cryptography-37.0.2-cp36-abi3-win_amd64.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 17.1 MB/s eta 0:00:00
Collecting bcrypt>=3.1.3
  Downloading bcrypt-3.2.2-cp36-abi3-win_amd64.whl (29 kB)
Collecting pynacl>=1.0.1
  Downloading PyNaCl-1.5.0-cp36-abi3-win_amd64.whl (212 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 212.1/212.1 KB ? eta 0:00:00
Collecting cffi>=1.1
  Using cached cffi-1.15.0-cp310-cp310-win_amd64.whl (180 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Saved c:\srv\venv\piptst\wheelhouse\paramiko-2.11.0-py2.py3-none-any.whl
Saved c:\srv\venv\piptst\wheelhouse\bcrypt-3.2.2-cp36-abi3-win_amd64.whl
Saved c:\srv\venv\piptst\wheelhouse\cryptography-37.0.2-cp36-abi3-win_amd64.whl
Saved c:\srv\venv\piptst\wheelhouse\pynacl-1.5.0-cp36-abi3-win_amd64.whl
Saved c:\srv\venv\piptst\wheelhouse\six-1.16.0-py2.py3-none-any.whl
Saved c:\srv\venv\piptst\wheelhouse\cffi-1.15.0-cp310-cp310-win_amd64.whl
Saved c:\srv\venv\piptst\wheelhouse\pycparser-2.21-py2.py3-none-any.whl

Verify that the virtualenv is still empty (nothing has been installed):

(piptst) go|C:\srv\venv\piptst> pip list
Package    Version
---------- -------
pip        22.0.4
setuptools 60.10.0
wheel      0.37.1

Now install directly from wheelhouse directory:

(piptst) go|C:\srv\venv\piptst> pip install paramiko==2.11.0 --no-index --find-links=.\wheelhouse
Looking in links: .\wheelhouse
Processing c:\srv\venv\piptst\wheelhouse\paramiko-2.11.0-py2.py3-none-any.whl
Processing c:\srv\venv\piptst\wheelhouse\pynacl-1.5.0-cp36-abi3-win_amd64.whl
Processing c:\srv\venv\piptst\wheelhouse\six-1.16.0-py2.py3-none-any.whl
Processing c:\srv\venv\piptst\wheelhouse\bcrypt-3.2.2-cp36-abi3-win_amd64.whl
Processing c:\srv\venv\piptst\wheelhouse\cryptography-37.0.2-cp36-abi3-win_amd64.whl
Processing c:\srv\venv\piptst\wheelhouse\cffi-1.15.0-cp310-cp310-win_amd64.whl
Processing c:\srv\venv\piptst\wheelhouse\pycparser-2.21-py2.py3-none-any.whl
Installing collected packages: six, pycparser, cffi, pynacl, cryptography, bcrypt, paramiko
Successfully installed bcrypt-3.2.2 cffi-1.15.0 cryptography-37.0.2 paramiko-2.11.0 pycparser-2.21 pynacl-1.5.0 six-1.16.0

and verify that everything installed:

(piptst) go|C:\srv\venv\piptst> pip list
Package      Version
------------ -------
bcrypt       3.2.2
cffi         1.15.0
cryptography 37.0.2
paramiko     2.11.0
pip          22.0.4
pycparser    2.21
PyNaCl       1.5.0
setuptools   60.10.0
six          1.16.0
wheel        0.37.1
thebjorn
  • 26,297
  • 11
  • 96
  • 138
  • This fixes most of them. But it doesn't work for `paramiko`. I still get `ERROR: Could not find a version that satisfies the requirement pynacl>=1.0.1 (from paramiko==2.11.0) (from versions: none) ERROR: No matching distribution found for pynacl>=1.0.1 (from paramiko==2.11.0)` even though pynacl is in the directory. My command was `pip install --no-index --find-links "C:\Users\Jack\Downloads\paramiko" .\paramiko-2.11.0-py2.py3-none-any.whl` – joejoejoejoe4 Jun 26 '22 at 15:58
  • @jippyjoe4 see my updated answer. – thebjorn Jun 26 '22 at 19:17