sherlock requirements installation problem [duplicate] - python

This question already has answers here:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
(41 answers)
Closed 2 years ago.
I am using kali linux
kali#kali:~$ uname -a
Linux kali 5.9.0-kali2-amd64 #1 SMP Debian 5.9.6-1kali1 (2020-11-11) x86_64 GNU/Linux
I was trying to install sherlock from Github [https://github.com/sherlock-project/sherlock].
1.clone the repo:
kali#kali:~/Downloads$ git clone https://github.com/sherlock-project/sherlock.git
2.cd to sherlock:
kali#kali:~/Downloads$ cd sherlock/
3.ls:
kali#kali:~/Downloads/sherlock$ ls
CODE_OF_CONDUCT.md Dockerfile README.md requirements.txt sites.md
CONTRIBUTING.md images removed_sites.json sherlock
docker-compose.yml LICENSE removed_sites.md site_list.py
4.install requirements:
kali#kali:~/Downloads/sherlock$ python3 -m pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/beautifulsoup4/
WARNING: Retrying (Retry(total=3..
WARNING: Retrying (Retry(total=2...
WARNING: Retrying (Retry(total=1...
WARNING: Retrying (Retry(total=0...
Could not fetch URL https://pypi.org/simple/beautifulsoup4/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/beautifulsoup4/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement beautifulsoup4>=4.8.0 (from -r requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for beautifulsoup4>=4.8.0 (from -r requirements.txt (line 1))
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
I tried to install requirements with sudo user, it was still not working.
I tried all the answers provides here [https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in/62264725#62264725] but none of them worked.
Please help. Thanks!

Try using stem from PyPi instead of Git version. It should fix the issue installing the stem module.

Related

Problem when installing Python from source, SSL package missing even though openssl installed

The Problem
Trying to install Python-3.11.1 from source on Zorin OS (Ubuntu16 based) I get the following errors when I try to pip install any package into a newly created venv:
python3.11 -m venv venv
source venv/bin/active
pip install numpy
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
Obviously, the SSL package seems to be missing, however I made sure to have both openssl and libssl-dev installed before installing python. More specifically, I made sure to have all packages installed lined out here.
The Exact Steps I Took To Install
Make sure all packages that are required are installed (the once above)
cd .../python-installs
Download Python from python.org
tar -xvzf Python-3.11.1.tgz
cd Python-3.11.1 and then
./configure \
--prefix=/opt/python/3.11.1 \
--enable-shared \
--enable-optimizations \
--enable-ipv6 \
--with-openssl=/usr/lib/ssl \
--with-openssl-rpath=auto \
LDFLAGS=-Wl,-rpath=/opt/python/3.11.1/lib,--disable-new-dtags
make <- Note that I get a lot off error messages from gcc here, very similar to this, however it seems its successful at the end
make altinstall
Parts of this installation process are from [1], [2]
Running python3.11 seems to work fine, however I cannot pip install anything into a venv created by Python3.11.1.
Other Possible Error Sources
Before trying to reinstall Python3.11.1, I always made sure to delete all files in the following places that were associated with Python3.11.1:
/usr/local/bin/...
/usr/local/lib/...
/usr/local/man/man1/...
/usr/local/share/man/man1/...
/usr/local/lib/pkgconfig/...
/opt/python/...
I also tried adding Python-3.11.1 to PATH by adding
PATH=/opt/python/3.11.1/bin:$PATH
to /etc/profile.d/python.sh, but it didn't seem to do much in my case.
When configuring the python folder I am using --with-openssl=/usr/lib/ssl, though perhaps I need to use something else? I tried --with-openssl=/usr/bin/openssl but that doesn't work because openssl is a file and not a folder and it gives me an error message and doesn't even configure anything.
Conclusion
From my research I found that most times this error relates to the openssl library not being installed (given that python versions >= 3.10 will need it to be installed), and that installing it and reinstalling python seemed to fix the issue. However in my case it doesn't, and I don't know why that is.
The most likely cause is that something is wrong with my openssl configuration, but I wouldn't know what.
Any help would be greatly appreciated.
After some more research, I realized that I didn't have libbz2-dev installed, which is obviously the first thing one should check if they get the errors above but oh well. For anyone who still finds himself struggling, here are my complete steps I took:
Make sure the following libraries are installed
apt show libbz2-dev
apt show openssl
apt show libssl-dev
# Other libraries that might also be needed
apt show liblzma-dev
cd .../python-installs
Download the target Python version from python.org as Gzipped tar ball
tar -xvzf Python-3.11.1.tgz
sudo mkdir opt/python
sudo mkdir opt/python/3.11.1
cd Python-3.11.1 and then
./configure --prefix=/opt/python/3.11.1 \
--enable-optimizations
make <- Note that I still get a lot of error messages from gcc, also get a always_inline not in line error message
sudo make altinstall
Add PATH=/opt/python/3.11.1/bin:$PATH to the file /etc/profile.d/python.sh
reboot
Then to test if the error is gone one can for example test:
python3.11 -m venv venv
source venv/bin/active
pip install pandas
python3.11
import pandas
exit()
If there are no errors then everything worked out. Obviously the version needs to be changed to the actual target version of yours.
Note
If you your newly installed python version does not appear in terminal, it might be because the file /etc/profile.d/python.sh already existed with the Path to the python version (for example, if you had to install it multiple times). In that case, delete the file (or at least the PATH to the target version) and then recreate it. After rebooting it should appear in terminal.

How to fix Python PIP update failing

I am trying to install and use python on Windows 11 for purposes of Meraki API calls. I have installed Python version 3.11 and am now trying to run
pip install --upgrade requests
pip install --upgrade meraki
but these command return the following error
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
WARNING: There was an error checking the latest version of pip.
I don't think the firewall is blocking it but I am not sure what I need to look for in the firewall - does anyone know the addresses that need to be unblocked?
Or is there another reason for this error?
Thanks!
I tried adding a firewall rule but didn't know what I needed to add.
Try to use another pip index-url
For example:
pip install --upgrade requests -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

Any conda or pip operation give SSL Error in windows 10

I have tried installing or updating new packages in my windows 10 system wherein I have installed Anaconda3 (2019 version).But everytime I get the same SSL error. I would have suspect it could be company firewall issue , if the I could have accessed that in Home wifi network. But everywhere I get the same error .
While running COnda Search, I get this error :
conda search
Loading channels: 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."))'))
And with Pip install I get this error :
pip install keras
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting keras
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/keras/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/keras/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/keras/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/keras/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/keras/
Could not fetch URL https://pypi.org/simple/keras/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/keras/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement keras (from versions: )
No matching distribution found for keras
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
I have OpenSSL installed from this location "https://slproweb.com/products/Win32OpenSSL.html" and have the lib folder set in the PATH variable. But nothing it working . Please suggest .
I was able to solve the issue following THIS instructions.
Basically:
* copy the following files from CONDA_PATH\Library\bin to CONDA_PATH\DLLs
libcrypto-1_1-x64.*
libssl-1_1-x64.*
On Miniconda, Win11 Pro x64. Wanted to create a new env and conda install pip and got the same issue suddenly.
Update base
conda update --all in (base) first and then trying conda install pip or whatever you tried again.
Didn't work
Install latest OpenSSL
Didn't work
Copy latest OpenSSL DLLs to \bin and \DLLs directory
Copy libcrypto-3-x64.dll + libssl-3-x64.dll
from C:\Program Files\OpenSSL-Win64\bin
to C:\Users\username\anaconda3\Library\bin
and to C:\Users\username\anaconda3\Library\DLLs
Didn't work
Copy existing dlls from \bin to \DLLs
Copy libcrypto-1_1-x64.dll and libssl-1_1-x64.dll
from C:\Users\username\miniconda3\Library\bin
to C:\Users\username\miniconda3\DLLs
Worked
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."))
Solutions to above issues:
1. Try using Anaconda powershell prompt as shown in below image:
2. via base environement
a. conda activate base
b. conda update --all
Note:
a. Conda always create default environment as base. we can activate the base environment to upgrade the conda.
This worked for me:
conda install openssl
Download openssl here https://sourceforge.net/projects/openssl/ and insta;; in the main folder
Try to execute the conda commands with the Anaconda Prompt
This worked for me. Such a simple fix.
Taken from: https://github.com/conda/conda/issues/8273
Current Behavior Environment: Windows 2016 Server Installer:
https://repo.anaconda.com/archive/Anaconda3-2018.12-Windows-x86_64.exe
with the fresh installation neither conda nor pip are able to work
Steps to Reproduce Start Anaconda Prompt conda search conda gives an error message: Can't connect to HTTPS URL because the SSL module is
not available
Environment Information conda version : 4.5.12
Resolution I did a trace with Process Monitor.
D:\Anaconda3\DLLs_ssl.pyd search for the OpenSSL DLLs but in the
wrong/current location! As they are not found the search goes to
C:\Windows\System32 where we have the same DLLs, installed by an other
application, but with a different version. :-(
The DLLs delivered by Anaconda3 are located here:
D:\Anaconda3\Library\bin
My workaround: I have copied the following files libcrypto-1_1-x64. libssl-1_1-x64. from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.**
And it works as a charm!

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

How can I make PyCharm ignore SSL errors when installing libraries?

I am trying to install the requests library to my Python environment in PyCharm while on a company network that uses self-signed SSL certificates. As a result, installing a library with File > Settings > Project > Project Interpreter > Install fails with an HTTPS error:
Collecting requests
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection
broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x0368D5D0>: Failed to establish a new connection:
[Errno 11003] getaddrinfo failed',)': /simple/requests/
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
I tried making pip trust my company's root certificate by adding --cert C:\COMPANY-CAROOT.pem to my install options, which was interpreted as:
pip install --cert C:\COMPANY-CAROOT.pem requests
I also tried opening File > Settings > Project > Server Certificates and checking Accept non-trusted certificates automatically, but ran into the same issue.
How can I get PyCharm to ignore SSL certificate errors when installing external libraries?
I faced the same issue. The way I resolved it was by adding all the packages I wanted to install in a .txt file, e.g. requirements.txt containing all the package-names and their versions.
Then from the Terminal (can also be the PyCharm Terminal), I did:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt
The key here is the use of --trusted-host. Adding the packages in a file is just for convenience.
Alternatively you can create a pip.ini file and add the trusted hosts there.

Categories