How to install pywinrm on offline environment

This guide shows how to install pywinrm (Python package) on offline (blocked internet access) situations.

Note: The entire procedures for setting up to manage Windows Server with Ansible are the following posts.

Preparations

Refer to the following post and install Ansible.

>> Ansible: How to install on offline environment

Procedures

1. Download packages

(1) Download the following whl files on an online (internet-accessible) environment.
Note: File name is as of the day I installed.

(2) Copy the downloaded whl files to the server that pywinrm is to be installed on.

2. Install pip

(1) Install pip

chmod 755 pip-22.0.3-py3-none-any.whl
python3 pip-22.0.3-py3-none-any.whl/pip install --no-index pip-22.0.3-py3-none-any.whl

(2) Confirm that pip is installed correctly.

pip -V

If it shows the following, pip is installed correctly.

pip 22.0.3 from /home/infraya/.local/lib/python3.9/site-packages/pip (python 3.9)

3. Install required packages

(1) Install whl packages in sequence.

  • wheel
chmod 755 wheel-0.37.1-py2.py3-none-any.whl
pip install wheel-0.37.1-py2.py3-none-any.whl
  • xmltodict
chmod 755 xmltodict-0.12.0-py2.py3-none-any.whl
pip install xmltodict-0.12.0-py2.py3-none-any.whl
  • ntlm_auth
chmod 755 ntlm_auth-1.5.0-py2.py3-none-any.whl
pip install ntlm_auth-1.5.0-py2.py3-none-any.whl
  • chardet
chmod 755 chardet-4.0.0-py2.py3-none-any.whl
pip install chardet-4.0.0-py2.py3-none-any.whl
  • charset-normalizer
chmod 755 charset_normalizer-2.0.11-py3-none-any.whl
pip install charset_normalizer-2.0.11-py3-none-any.whl
  • certifi
chmod 755 certifi-2021.10.8-py2.py3-none-any.whl
pip install certifi-2021.10.8-py2.py3-none-any.whl
  • urllib3
chmod 755 urllib3-1.26.8-py2.py3-none-any.whl
pip install urllib3-1.26.8-py2.py3-none-any.whl
  • idna
chmod 755 idna-3.3-py3-none-any.whl
pip install idna-3.3-py3-none-any.whl
  • requests
chmod 755 requests-2.27.1-py2.py3-none-any.whl
pip install requests-2.27.1-py2.py3-none-any.whl
  • pycparser
chmod 755 pycparser-2.21-py2.py3-none-any.whl
pip install pycparser-2.21-py2.py3-none-any.whl
  • cffi
chmod 755 cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
pip install cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
  • cryptography
chmod 755 cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl
pip install cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl
  • requests_ntlm
chmod 755 requests_ntlm-1.1.0-py2.py3-none-any.whl
pip install requests_ntlm-1.1.0-py2.py3-none-any.whl
  • six
chmod 755 six-1.16.0-py2.py3-none-any.whl
pip install six-1.16.0-py2.py3-none-any.whl

(2) Check the dependencies of packages.

pip check

If it shows the following, no problems.

No broken requirements found.

4. Install pywim

(1) Install pywinrm.

chmod 755 pywinrm-0.4.2-py2.py3-none-any.whl
pip install pywinrm-0.4.2-py2.py3-none-any.whl

(2) Check the dependencies of packages.

pip check

If it shows the following, no problems.

No broken requirements found.

That’s about it.

If you proceed to install requests_credssp, refer to the following post.
>> How to install requests_credssp on offline environment