How to install PIP packages Offline?
Are you trying to install a package offline? Or Is the package size large & PIP install keeps failing from Pypi.org?
Well, if that is the case then first downloading the package to your PC would be better than directly installing it via pip install <package name>.
So, let’s take a look at the process step by step. I’ve also included a video at the end of this article for better clarity.
Let’s get started:
- First, open pypi.org or anywhere really, where the package file is.
- We are looking for either .whl (wheel extension) or .tar.gz. The earlier one will get installed pretty quickly because .wheel format is natively supported by Python programming language.
- With .tar.gz the file will be processed & then converted to .whl format & then installed in your system.
- For our example, we’ll take a look at pypi.org download process.
- Search for your library.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-220855.png)
Select it from the list of packages.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221001.png)
Click on Download files
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221024.png)
You’ll be able to see all the download files related to that library.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221039.png)
- Download any one of the files…let’s take .whl one for example.
- Once it is downloaded…locate it in your File Explorer.
- By default, it will be in your downloads folder.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221155.png)
Hold shift-key & right-click the file…we are looking for copy as path option.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221235.png)
- Click on it & the file path will be copied to your clipboard.
- Now open command prompt from start menu or run-command dialog box.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221521.png)
- Type pip install & ctrl+v to paste the file path currently in your clipboard.
- The result would look something like in the image below.
- You do not need to remove the quotes.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221700-1024x166.png)
- Hit Enter key & wait for the installation to finish.
- You’ll see a success message if the library was successfully installed.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-221736-1024x60.png)
- To cross-check the installation. You can open Python shell & try to import the library you just installed.
- If you don’t see any error then your installation was successful.
![](https://codejana.com/wp-content/uploads/2023/07/Screenshot-2023-07-01-234641-1024x227.png)
But if you receive PIP Install Invalid Syntax Error, then follow the link on how to resolve it.
Checkout the video below to see the steps in action & if you find them useful then please do subscribe to Code Jana YouTube channel.