Have you tried to install a Python package in Anaconda, but got a connection timeout error? If so, I’ll show you one workaround that can be used to install packages in Anaconda when facing a connection timeout.
Install a package in Anaconda when facing a connection timeout
Normally, If you want to install a Python package in Anaconda, you can open the Anaconda Prompt and then type the following command to install your desired package:
pip install + packagename
In the following example, I tried to install the cx_Oracle package:
I then got the following connection timeout error:
If the pip install + packagename method did not work for you, and you are using Anaconda, you may try to execute the steps below:
Step 1 – Download the needed package
Search for your desired package by going to The Python Package Index (PyPI).
Then, type the name of the package that you seek in the search bar. Here, I typed cx_Oracle in the search bar:
Click on your desired package. Here, I chose the cx_Oracle 6.2.1 package:
Press on the “Download files” under the Navigation menu:
Click on the version that you wish to download (for example: cx_Oracle-6.2.1-cp36-cp36m-win_amd64.whl):
Step 2 – Place the downloaded file in a location of your choosing
Now place the file that you just downloaded in a location of your choosing.
For example, I placed the downloaded file in a folder on my desktop, under the following path:
Step 3: Install the package
For the final step, open the Anaconda Prompt. Then type cd\ and press Enter:
Now type cd + the location where your downloaded file is stored.
In my case, I typed the command below, and then pressed Enter:
Finally, type pip install + full file name.
For our example, type :
pip install cx_Oracle-6.2.1-cp36-cp36m-win_amd64.whl
Don’t forget to include the extension of the file name. In our case it’s “.whl”
Once you’re done, press Enter and your package will now get installed.