conda update conda: Collecting package metadata (current_repodata.json): failed - python

Windows 11 x64, CMD
Microsoft Windows [Version 10.0.22621.1105]
(c) Microsoft Corporation. All rights reserved.
C:\Users\donhu>conda update conda
Collecting package metadata (current_repodata.json): failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
C:\Users\donhu>
How to run command success?

Run Anaconda cmd with Administrator permission.
conda update conda

Related

Can't install anything in the environment I have created

I have set up a new environment on conda.
Once it was created, I disabled threading so that the performance of the software I would be using will be maximised using:
conda env config vars set OMP_NUM_THREADS=1
conda env config vars set NUMEXPR_MAX_THREADS=1
I then tried to install the software and got the error
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
I though this could be specific to the software.
To test this, I tried installing python with
conda install -c conda-forge python
I got the same error here
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
It seems to be an issue with the environment, but I have set up other environments on this machine before and never had this issue.
Does anyone know what could be causing this issue?
I have now resolved this!
If anyone else has the same issue, going back into the base environment and then using "conda install -n name_of_environment python" worked.

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") On Linux

This question has been answered here but for Windows users. I am getting this error on a Linux machine on a 3rd party application under a Anaconda environment. I added the following paths to my PATH env:
<path>/anaconda2/lib
<path>/anaconda2/bin
But when I run:
import requests
requests.get("https://api.ipify.org")
I get the error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.ipify.org',
port=443): Max retries exceeded with url: / (Caused by SSLError("Can't
connect to HTTPS URL because the SSL module is not available."))
The 3rd party application and a conda shell both include those paths in the PATH env but it only works on the shell.
The error message says "SSL module is not available". Requests uses openssl for its "SSL module" so make sure openssl is installed and working correctly.
First run:
~$ conda list
You should see openssl and pyopenssl in the output
if you don't install openssl and pyopenssl
If openssl is installed run:
~$ openssl
If you get:
openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requires: Invalid argument
Run using the version number from above
~$ sudo find / -name libcrypto.so.[your version]
Then using the path to libcrypto.so.[your version] from the output of the above:
~$ sudo execstack -c [path to]/libcrypto.so.[your version]
Then run to test:
~$ openssl
OpenSSL>
You will need to do this for all environments
It turns out the _ssl.so module in the lib-dynload directory of my python environment was being overriden by the _ssl.so module in the 3rd party software, it was conflicting. So I have made a sym-link to my own module.

conda error ssl certificate : HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443

no matter what I do I get this error
C:\Users\MyPc>conda update --all
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/free/win-64/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))
I have searched all the internet , re-installed anaconda and did whatever is there on suggestion but this issue is still there.
Windows 10
C:\Users\MyPc>anaconda --version
anaconda Command line client (version 1.7.2)
C:\Users\MyPc>conda --version
conda 4.5.12
In my case I got this kind of error message when I try to run this command
conda install tensorflow
here is the Error message
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to download and install packages.
Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
This is the solution for that
step 01
go to your installation path of anaconda3
step 02
now go to the this file path
anaconda3\Library\bin
step 03
now select this DLL file and copy that
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
step 04
after that go to this file path and paste that to inside of that folder
anaconda3\DLLs
I had this same issue, and the thing that fixed it for me was to install an earlier 32-bit version of Conda. For some reason the newer 64-bit version seemed prone to this error. You can find an earlier version of Conda here:
https://repo.continuum.io/archive/
You should search for an Anaconda3 version that only has x86, not x86_64.
I had the same problem, the simple solution is:
open anaconda navigator from start menu, then run CMD.exe Prompt, and install from there, that's it.

How to install PIP for IDLE running Python 2.7.5 on Windows 10?

I just downloaded the python 2.7.5 desktop application with Python (command line) and IDLE. I can run a simple python script directly in IDLE but I cannot access python from the windows command prompt. I tried downloading get-pip.py but I couldn't find the location of setup.py on my computer and when I try to run get-pip.py from another location using IDLE it shows this error:
"Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '_ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping [31m Could not find a version that satisfies the requirement pip (from versions: )[0m [31mNo matching distribution found for pip[0m"
How can I install PIP?
Thanks in advance.
Use miniconda2 or minoconda3. Why? Miniconda has a windows installer that if installed correctly, updates the path for you. Miniconda also loads precompiled binaries so you do not need a C++ compiler, which is an annoying problem to run into on windows. Plus miniconda makes virtual enviornment setup a breeze with the command line. Also it comes with PIP if you need to fall back to it.
https://conda.io/miniconda.html

Error installing python package with pip (TLSV1_ALERT_PROTOCOL_VERSION)

I'm on Suse Linux Enterprise 11 SP4 and I'm trying to install a python package using pip but it's failing with the following error:
Env:
$ python --version
Python 3.6.6
$ pip --version
pip 10.0.1 from /home/<<user>>/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pip (python 3.6)
Command:
$ pip install sendgrid
Error:
Collecting sendgrid
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)': /simple/sendgrid/
...
...
Could not fetch URL https://pypi.org/simple/sendgrid/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/sendgrid/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)) - skipping
Could not find a version that satisfies the requirement sendgrid (from versions: )
No matching distribution found for sendgrid
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:841)'),)) - skipping
I have tried all this solutions but none of them had work on SLES.
Any ideas?
Thanks in advance
You can ignore SSL errors by setting pypi.org and files.pythonhosted.org as trusted hosts.
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
Or:
Try installing using the wheel of the package
Finally I get it to work!
Seems that the openssl library that came installed by default on SLES 11 SP4 (libopenssl-devel) is really outdated (OpenSSL 0.9.8)
To verify this you can run:
$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 0.9.8j-fips 07 Jan 2009
The trick is to uninstall libopenssl-devel and install libopenssl1-devel like this:
IMPORTANT: Note that you will be asked to take an option, please select deinstallation of libopenssl-devel-0.9.x-x.xxx.x.x.x
$ sudo zypper install libopenssl1-devel
Loading repository data...
Reading installed packages...
Resolving package dependencies...
Problem: libopenssl1-devel-1.0.1g-0.58.9.1.x86_64 conflicts with libopenssl-devel < 1.0.1 provided by libopenssl-devel-0.9.8j-0.106.9.1.x86_64
Solution 1: deinstallation of libopenssl-devel-0.9.8j-0.106.9.1.x86_64
Solution 2: do not install libopenssl1-devel-1.0.1g-0.58.9.1.x86_64
Choose from above solutions by number or cancel [1/2/c] (c): 1
Resolving dependencies...
Resolving package dependencies...
The following NEW package is going to be installed:
libopenssl1-devel
The following package is going to be REMOVED:
libopenssl-devel
1 new package to install, 1 to remove.
Overall download size: 3.3 MiB. After the operation, 698.0 KiB will be freed.
Continue? [y/n/? shows all options] (y):
Retrieving package libopenssl1-devel-1.0.1g-0.58.9.1.x86_64 (1/1), 3.3 MiB (19.6 MiB unpacked)
Retrieving: libopenssl1-devel-1.0.1g-0.58.9.1.x86_64.rpm [done]
Removing libopenssl-devel-0.9.8j-0.106.9.1 [done]
Installing: libopenssl1-devel-1.0.1g-0.58.9.1 [done]
Now procede to recompile/reinstall your python env with:
$ CFLAGS=-I/usr/include/openssl1 LDFLAGS=-L/usr/lib64 pyenv install 3.6.6
Finally verify that your OpenSSL version is the new one and proceed to install your package with pip:
$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 1.0.1g 7 Apr 2014
$ pip install sendgrid
Hope it helps you!
Please see 'Security Module in SUSE Linux Enterprise 11' for more info

Categories