Python: Install a Package Offline

Depending on your system configuration, you may not be able to install Python packages using PIP or Conda commands. On my work computer, due to IT restrictions , I need to log off of the VPN in order to install packages through traditional means. This if fine for when I am working at home, but at the office I’m stuck on the network and would have to wait to go home to get on a regular network to do so.

A work around I found is to download the package from the repository site and install using the offline command.

**** Note – for this example, I am using the Anaconda install of Python. So I will be downloading a package from the Anaconda repository and using the Conda install commands.

Start by going to https://anaconda.org/conda-forge

This is the package repository for the Anaconda instance of Python

In the search bar located at the top of the page, type in the package you are looking for. In this example, I will be installing the Selenium package.

Type selenium in the search bar and look at your results (note, click the word selenium below after the / – if you click conda-forge it will not return the results you want)

Next choose the Files tab

Find the file that matches your operating system

Next open the Anaconda CMD window

Now type: conda install –offline “file path” (note the two dashes — before offline)

conda install –offline “C:\Users\larsobe\Downloads\selenium-3.141.0-py37h4ab8f01_1002.tar.bz2”

And it will install –

Tip – if you don’t want to type the path name in: go to the file in your file explore, hold down the shift key and right click, and you will see and option for Copy as Path, that will copy the file path for you, so you just need to go to the cmd window and hit ctrl-v

Please Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s