How to fix "HTTP CONNECTION FAILED" error - python

I just updated my anaconda distribution using conda update --all. There were a few debug messages during the update but it otherwise finished successfully. However, now I can't update any packages. Any time I try, I now get this error:
I am working through a company proxy, but have verified that the proxy info in my .condarc file is accurate. I've also verified that anaconda.com is not blocked by my company. Additionally, I was previously able to update packages without this error. I get this error regardless of which package I try to update, or whether I specify a specific channel. Does anyone have any idea what this could be?
Here's my .condarc settings (excluding proxy information for obvious reasons):
ssl_verify: false
channel_priority: disabled
channels:
defaults
conda-forge
Here are the results of "conda info":
Any idea what the fix for this is?

found the answer (sort of)! It’s something to do with urllib3. I reinstalled conda and pinned urllib3 to version 1.25.11, and now conda updates fine!

Related

Which anaconda version comes with python 3.7 as default?

I want to use python3.7.13 with anaconda.
From conda documentation
conda install python=3.7.13 should do the job however since all this is taking place at my corporation which is blocked with firewall I get following error:
An HTTP error occurred when trying to retrieve this URL. HTTP errors are ofrten intermittent, and a simple retry will get you on your way. ProxyError(....
I've re-tried multiple times but no luck. After some googling I found that there is a workaround -> from this SO
But it increase risk of attack which I cannot afford.
So I am trying to find out version of Anaconda that comes with python 3.7.13 therefore I could ask my service team to download Anaconda for me.

pip install failing due to repeatedly changing sha256 (ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE)

I am currently trying to install many different libraries into my Python environment. I've currently tried using a virtual environment and conda environment still resulting in similar errors.
As I'm doing this on a VM, I have to go through my corporate proxy, hence my pip install command looks a little verbose like the following:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org h5py --proxy http://user:password#proxy.internet.mycompany.local:8080
This had been working fine to download many different packages (including ones that are currently failing now), I'm not too sure what has changed, but now the command results in the following error:
Collecting h5py
Downloading h5py-3.1.0-cp37-cp37m-win_amd64.whl
\ 4.8 kB ...
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the >package versions
, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered >with them
.
h5py from https://files.pythonhosted.org/packages/53/c2/77bd81922264520b492bd7bfd1a51a845bc1187445408a7a83db284fd566/h5py-3.1.0-cp37-cp37m-win_amd64.whl#sha256=02c391fdb980762a1cc03a4bcaecd03dc463994a9a63a02264830114a96e111f
:
Expected sha256 02c391fdb980762a1cc03a4bcaecd03dc463994a9a63a02264830114a96e111f
Got 3fbaf847f810d5f6970abb0c7754abcca7dea17d315036fe5e4b26f427adf3a6
Although this error will still stay largely the same, the "Got" sha256 will change on each attempt, i.e. the following for the last returned line:
Got ff8197d74c233317597b89612691bf420806046093628ac02f0a92df3ac8123a
Got 8be06806b22d49aaa9b94113d8b3e075539303da96386971600c21cb8b9f8460
To rectify this error I've attempted the following:
using '--no-cache-dir' as suggested other Stack Overflow answers to similar questions
reinstalling python/pip or trying other versions of Python.
trying to use miniconda/anaconda instead
contacting owner of libraries about the issue (although I'm fairly sure it isn't library specific as I can't download any packages)
attempted to access the link in the error output: https://files.pythonhosted.org/packages/53/c2/77bd81922264520b492bd7bfd1a51a845bc1187445408a7a83db28%204fd566/h5py-3.1.0-cp37-cp37m-win_amd64.whl#sha256=02c391fdb980762a1cc03a4bcaecd03dc463994a9a63a02264830114a96e111f. This results in the following page response - the console section of developer tools states the following error: Failed to load resource: the server responded with a status of 404 (Not Found)
I've found a few similar issues to this already on Stack Overflow, but I've found nothing that resolves this.

Errno 13 Permission denied when updating conda

I'm trying to update Anaconda using conda update --all.
I receive the following warning:
Warning: 2 possible package resolutions (only showing differing packages):
- anaconda::navigator-updater-0.2.1-py36_0
- defaults::navigator-updater-0.2.1-py36done
Then it begins:
## Package Plan ##
environment location: /Users/me/anaconda3
...Followed by all sorts of good things. The transaction is then prepared, verified and executed, after which I get the following errors:
ERROR conda.core.link:_execute(700): An error occurred while uninstalling package 'https://repo.continuum.io/pkgs/main/osx-64/xlrd-1.1.0-py36h336f4a2_1.tar.bz2::xlrd-1.1.0-py36h336f4a2_1'.
Rolling back transaction: done
[Errno 13] Permission denied: '/Users/me/anaconda3/lib/python3.6/site-packages/xlrd/__init__.py' -> '/Users/me/anaconda3/lib/python3.6/site-packages/xlrd/__init__.py.c~'
()
Being the newer coder that I am, I have no idea about the environment or what it takes to update this beyond monkey-typing in what I've been told to do. What the heck do these mean and how do I solve them? I would imagine that updating would be simple, as it is going back to the folder that it came from, so why is it saying there there is an Error 13 which, as my research seems to indicate, is an admin privileges issue? (I am admin on my machine, using a Mac with interactive shell zsh.)
So it seems like the version of conda that you are using was prone to these errors. Searching it up brings up a multitude of similar errors and the common solution is to always update conda, just like you tried.
From #soapy1 comment from here, states that:
Looks like this is fixed on master, it should be resolved in the next release of conda
My advice would be, if possible, uninstall and install anaconda. This will install with the latest packages and the error shouldn't persist. You should follow the documentation on doing this safely.

Update URLs used by conda for Linux 64 packages

I am using conda version 3.19.0 from Ubuntu 14.04 64-bit. When I try conda update conda I receive:
$ conda update conda
Fetching package metadata: .......Error: Could not find URL: http://repo.continuum.io/pkgs/gpl/linux-64/
The output of conda --debug update conda is not very informative in this case. But I did notice at http://repo.continuum.io/pkgs/ that the correct URL now seems to be:
http://repo.continuum.io/pkgs/free/linux-64/
Is there a way to change conda's configuration to look there instead of the gpl/linux-64 URL that appears to be deprecated?
I have never manually adjusted .condarc. Will removing the /gpl/... URL there solve it without requiring me to do additional manual URL management and without compromising any other conda defaults or settings?
As you suspect, this error is caused by an offending entry in your ~/.condarc, namely the following entry under channels:
http://repo.continuum.io/pkgs/gpl
Remove or comment this entry s.t. you're left with the following:
channels:
- http://repo.continuum.io/pkgs/free

How to enable proxy servers with anaconda python

We are trying to get the conda install (on windows 8) to work behind a firewall via a proxy server. Currently, we are able to use pip to install packages while on our company network by using this at the command prompt:
pip install pandas --proxy=http://abc.def.xyz.com:1234
No passwords need to be specified, just the proxy server and port. The conda documentation states that proxy servers are possible:
# Proxy settings: http://[username]:[password]#[server]:[port]
proxy_servers:
http: http://user:pass#corp.com:8080
https: https://user:pass#corp.com:8080
I have tried this with various combinations to see if I can get it to work with or without putting in my username and password.
# formats tried:
http: http://user:pass#abc.def.xyz.com:1234
http: http://abc.def.xyz.com:1234
I cannot seem to get it to work. Tried various combinations of quoting things too (passwords have special chars). Also tried with and without the domain\user.
I can see under the hood, conda is using urlib3 (while pip may be using urlib proxy handler?). Note that having your username and password in a file is generally frowned upon.
I know we could set up our own http or file location channel and put all the packages there and add the channel to the .condarc config settings. However I would prefer not to have to manage a repository of packages and versions locally.
So.... is there a way to specify, in the .condarc file the proxy server and port (without user and password) so that conda install works behind a firewall just like pip install on the command line? Or even an inline call like pip has and works... something like:
conda install pandas --proxy=abc.def.xyz.com:1234
Thanks in advance...
PS: I really love conda. I spent last weekend setting up many virtual environments on my home PC. Documentation was great and everything worked flawlessly. Overall, much better than pip... if only we could only get this to work inside our company :)
Well, this is embarrassing, but good news. I solved my problem with one more attempt at a change in the condarc file.
https: https://abc.def.xyz.com:1234
I guess pip worked ok with regular http, while conda's addresses are all https sites:
https://repo.continuum.io/pkgs/free/win-64/
I should have caught that!
Well, I am now just happy that we have a solution to use conda behind our firewall, and without needing a user and password. Awesome!
Late answer but maybe other people faced with this problem can benefit.
Create a .condarc file contaninig :
channels:
- defaults
# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True
proxy_servers:
http: http://172.**.*.***:8080
https: https://172.**.*.***:8080
ssl_verify: False
Change IP adresses with your own proxy settings.
Put this file in your user's main folder (for me : C:\Users\bakayim)
Restart your anaconda prompt
Open Anaconda command and execute below command:
set HTTP_PROXY=http://username:password#proxyurl.com:8080
set HTTPS_PROXY=https://username:password#proxyurl.com:8443
I also set 2 Windows environment variables: (don't know if it was necessary)
Name: http_proxy
Variable: http://username:password#Proxyadresse:Proxyport
Name: https_proxy
Variable: https://username:password#Proxyadresse:Proxyport
what wokred for me was the following .condarc file
channels:
- r
- defaults
proxy_servers:
http: http://username:password#Proxyadresse:Proxyport
https: https://username:password#Proxyadresse:Proxyport
ssl_verify: true
I can confirm that .condarc didn't have desired effect in my case (Windows 7). With conda info I could verify that it was loaded but it didn't have any effect.
I had to set forementioned environment variables in order to get connection from behind a proxy.
I was done as follows in command prompt:
set http_proxy=[protocol:your_proxy_address_here:port]
set https_proxy=[protocol:your_proxy_address_here:port]
Remove brackets. To verify (list) your concurrent settings just type: set
The new version of Anaconda comes with .condar file in the user directory C:\Users\User_name\.condarc.
so all to do is just to edit the content as below:
channels:
- defaults
show_channel_urls: True
allow_other_channels: True
proxy_servers:
http: http://172.**.*.***:8080
https: https://172.**.*.***:8080
ssl_verify: true
That's what worked for me.

Categories