How to - Install Python and Paramiko in offline Windows environment (Optimized Method)

After using more and more Paramiko and Python for automation of endpoint testing and changed requirements for the the usage of Paramiko in newer versions my old how-to becomes outdated.

With the newest release of Python, Python 3.6, I started to optimize the installation process to reduce complexity and make the installation process more simple. Instead of downloading manually all required files from the different homepages I use Python included functions for this work. 

Step by Step overview:

1. Creation of reference system

For preparation of the required files and for verification I'm using normally a test system i setup in VMware Fusion on my MacBook. For the Microsoft operating system I use the trial version from Microsoft Technet Evaluation Center for 180 days testing. After the system is finally setup based on my requirements I create a snapshot to have a valid reference point for my installation.

2. Installation of Python in reference system and downloading of required packages

After setting up the reference system I create a snapshot of the virtual machine I start the installation of Python. After finishing the installation
pip download paramiko --dest c:\paramiko
The process of downloading can be seen in the command line and would look similar to that.
Collecting paramiko
  Downloading paramiko-2.1.1-py2.py3-none-any.whl (172kB)

    100% |████████████████████████████████| 174kB 2.2MB/s

  Saved c:\paramiko\paramiko-2.1.1-py2.py3-none-any.whl

Collecting pyasn1>=0.1.7 (from paramiko)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
  Saved c:\paramiko\pyasn1-0.1.9-py2.py3-none-any.whl
Collecting cryptography>=1.1 (from paramiko)
  Downloading cryptography-1.7.1-cp36-cp36m-win32.whl (901kB)
    100% |████████████████████████████████| 911kB 1.1MB/s
  Saved c:\paramiko\cryptography-1.7.1-cp36-cp36m-win32.whl
Collecting six>=1.4.1 (from cryptography>=1.1->paramiko)
  Downloading six-1.10.0-py2.py3-none-any.whl
  Saved c:\paramiko\six-1.10.0-py2.py3-none-any.whl
Collecting idna>=2.0 (from cryptography>=1.1->paramiko)
  Downloading idna-2.2-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 4.0MB/s
  Saved c:\paramiko\idna-2.2-py2.py3-none-any.whl
Collecting setuptools>=11.3 (from cryptography>=1.1->paramiko)
  Downloading setuptools-32.3.1-py2.py3-none-any.whl (479kB)
    100% |████████████████████████████████| 481kB 1.6MB/s
  Saved c:\paramiko\setuptools-32.3.1-py2.py3-none-any.whl
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko)
  Downloading cffi-1.9.1-cp36-cp36m-win32.whl (146kB)
    100% |████████████████████████████████| 153kB 3.3MB/s
  Saved c:\paramiko\cffi-1.9.1-cp36-cp36m-win32.whl
Collecting pycparser (from cffi>=1.4.1->cryptography>=1.1->paramiko)
  Downloading pycparser-2.17.tar.gz (231kB)
    100% |████████████████████████████████| 235kB 2.2MB/s
  Saved c:\paramiko\pycparser-2.17.tar.gz
Successfully downloaded paramiko pyasn1 cryptography six idna setuptools cffi py
cparser
After downloading the files can be found in the folder c:\paramiko ready for further usage.

3. Creation of requirements.txt file

After all files are downloaded I created a requirements.txt file to put the installaton of the packages in the right order. The order for the installation of Paramiko is the following:
six-1.10.0-py2.py3-none-any.whl
pyasn1-0.1.9-py2.py3-none-any.whl

idna-2.2-py2.py3-none-any.whl
pycparser-2.17.tar.gz
cffi-1.9.1-cp36-cp36m-win32.whl
cryptography-1.7.1-cp36-cp36m-win32.whl
paramiko-2.1.1-py2.py3-none-any.whl 

I take the files together with the requirements.txt file and put them all into a ZIP file called Paramiko_Install_2_1_1.Zip. 

4. Verification of installation

To install Paramiko in an offline environment copy all required files into one folder together with the requirements.txt file after you installed Python. Open the Windows CLI and go to the directory where the files of the Paramiko_Install_2_1_1.zip are extracted to. There insert the command:
pip install -r requirements.txt
 After starting the command the installation process should look like:
Processing c:\paramiko\pycparser-2.17.tar.gz 
Processing c:\paramiko\six-1.10.0-py2.py3-none-any.whl

Processing c:\paramiko\pyasn1-0.1.9-py2.py3-none-any.whl
Processing c:\paramiko\idna-2.2-py2.py3-none-any.whl
Processing c:\paramiko\cffi-1.9.1-cp36-cp36m-win32.whl
Processing c:\paramiko\cryptography-1.7.1-cp36-cp36m-win32.whl
Processing c:\paramiko\paramiko-2.1.1-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=11.3 in c:\users\administrator\appdat
a\local\programs\python\python36-32\lib\site-packages(from cryptography==1.7.1->-r requirements.txt (line 6))
Installing collected packages: six, pyasn1, idna, pycparser, cffi, cryptography, paramiko
Running setup.py install for pycparser ... done
Successfully installed cffi-1.9.1 cryptography-1.7.1 idna-2.2 paramiko-2.1.1 pyasn1-0.1.9 pycparser-2.17 six-1.10.0
After the installation is finished without errors Paramiko and Python can be used on that Windows machine.











Comments

Post a Comment

Popular posts from this blog

How to - Removing CTL and ITL from 7900-series phones via SSH

How to - Install Python 3.4 and Paramiko in offline Windows environment