How to trust host using pip 1.4.1 - python

I am stuck using pip 1.4.1 and have run up against a problem when upgrading package.
Could not fetch URL https://pypi.python.org/simple/pymongo/: There was a problem confirming
the ssl certificate: <urlopen error [Errno 1] _ssl.c:509: error:1407742E:SSL
routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version>
I have seen that later versions of pip you can do --trusted-host to ignore the certs warning. But on 1.4.1 it appears that this option is not available. How to fix?

The worst problem in your case is not untrusted host, the worst problem is too old versions of Python and OpenSSL. Your pip tried to use protocol version TLS v1 which PyPI stopped supporting long ago.
To install packages over the Net you need to upgrade OpenSSL, Python and pip. If you cannot upgrade you cannot install from PyPI directly. Then you can try to download packages from PyPI using a browser and install them from the local filesystem.
You can also use pip download on a host with more modern OpenSSL/Python/pip, transfer downloaded packages to the ancient host and install them there. See https://stackoverflow.com/a/14447068/7976758

Related

SSL certificate issues preventing pip package installs on windows

I installed Python 3.8 from the python.org downloads site onto my 64-bit Windows machine today. Shortly thereafter, I attempted to install the pyodbc package using pip from a command console opened as an administrator:
pip install pyodbc
The following error broke my connection on several attempts:
'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate
(_ssl.c:1108)')': /simple/pyodbc/
(I don't believe these issues are specific to the pyodbc package, but that just happens to be the package I've been trying to install). After some googling I tried
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pyodbc
after which I received the error
ERROR: Could not find a version that satisfies the requirement pyodbc (from versions: none)
ERROR: No matching distribution found for pyodbc
Based on this SO answer, I decided to execute
curl https://bootstrap.pypa.io/get-pip.py | python
after which I received the error
next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.
I'm not sure where to go from here. Python 3.8 is a fresh install, as is pip (which shows as version 19.2.3). Nevertheless there seems to be a problem confirming SSL certificates. How can I get pip installs working?
You have two separate issues:
You are behind a proxy/firewall or using an endpoint antivirus that messes with your CA cert store. Your --trusted-host is a workaround for that
pyodbc doesn't support Python 3.8 yet.

issue with emsdk on mac

I am trying to setup emsdk on mac with the following command:
./emsdk install latest
I cloned the repo from git. However, I get the following error upon running the command mentioned above:
** NOTICE **: The default SDK changed from `fastcomp` to `upstream`.
If you have problems, or wish to revert back to fastcomp for some other reason
you can add `-fastcomp` to explicitly install that fastcomp-based
SDK, .e.g ./emsdk install latest-fastcomp.
Installing SDK 'sdk-releases-upstream-b024b71038d1291ed7ec23ecd553bf2c0c8d6da6-64bit'..
Installing tool 'releases-upstream-b024b71038d1291ed7ec23ecd553bf2c0c8d6da6-64bit'..
Error: Downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/b024b71038d1291ed7ec23ecd553bf2c0c8d6da6/wasm-binaries.tbz2': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)>
Warning: Possibly SSL/TLS issue. Update or install Python SSL root certificates (2048-bit or greater) supplied in Python folder or https://pypi.org/project/certifi/ and try again.
Installation failed!
I have tried running the following to fix this but it did not solve the issue.
pip install certifi
Any other suggestions to fix the issue would be quite welcome.
I was able to upgrade the python version to 3.8.0 using pyenv. The upgrade helped me with the certificate issue.
brew install pyenv
pyenv install 3.8.0
pyenv global 3.8.0
or if inside the emsdk directory:
pyenv local 3.8.0
The command ./emsdk install latest ran successfully after the python upgrade.

issues during jupyter install using pip on Python 2.7.3

We are using python 2.7.3 and do not have Anaconda available for install in the organization approved package list. So we have been trying to manually install the dependencies using unofficial windows binaries provided by Christoph Gohlke. Currently we are stuck at installing terminado-0.8.1-py2.py3-none-any.whl. This needs a pywinpty package which is not available for Python 2.7.
We would appreciate any suggestions on how to proceed.
We would like to get Jupyter installed using any other possible option for python 2.7.3
installing jupyter using pip gives below error so we went with manual route to install individual packages
60: InsecurePlatformWarning: A true SSLContext object is not available. This pre
vents urllib3 from configuring SSL appropriately and may cause certain SSL conne
ctions to fail. You can upgrade to a newer version of Python to solve this. For
more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.ht
ml#ssl-warnings
InsecurePlatformWarning
Could not fetch URL https://pypi.org/simple/jupyter/: There was a problem conf
irming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max
retries exceeded with url: /simple/jupyter/ (Caused by SSLError(SSLError(1, '_ss
l.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol
version'),)) - skipping
Could not find a version that satisfies the requirement jupyter (from versions
: )
No matching distribution found for jupyter
You can:
Go to Python root folder and run the "Install Certificates.command" file.
Upgrade python version to 3.X.X and reinstall. You may follow https://www.youtube.com/watch?v=BVS3U1OQzO4
this worked for me on WIndows 10:
explicitly installing an older version of the package
PS> python2.exe -m pip install pywinpty==0.5.1
PS> python2.exe -m pip install notebook
PS> python2.exe -m pip install jupyter
Zero errors.
Reference:
https://pypi.org/project/pywinpty/0.5.1/

Python - Enable TLS1.2 on OSX

I have a virtualenv environment running python 3.5
Today, when I booted up my MacBook, I found myself unable to install python packages for my Django project. I get the following error:
Could not fetch URL <package URL>: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:646) - skipping
I gather that TLS 1.0 has been discontinued, but from what I understand, newer versions of Python should be using TLS1.2, correct? Even outside of my environment, running pip3 trips the same error. I've updated to the latest version of Sierra and have updated Xcode as well. Does anyone know how to resolve this?
Here is the fix:
curl https://bootstrap.pypa.io/get-pip.py | python
Execute from within the appropriate virtual environment.

python get-pip.py is giving SNI error - TLS is not available?

I am trying to install pip onto my windows laptop by running command python get-pip.py but I am getting the following error: c:\appdata\temp\tmplplp3q\pip.zip\pip\_vendor\urllib3\util\ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
My python version is 2.7.9. Any help would be greatly appreciated! Thanks
The suggested duplicate is different to my question as I can't install pip to begin with and the error is given way before I can try to download any package.
Have you already tried to install urllib3 with the secure extra? Try this way:
pip install urllib3[secure]
Alternatively, if it's not mandatory to use that old version, I would suggest to upgrade Python to the latest version, since your problem may be caused by the lack of SNI support on that ssl module.
EDIT: I am clearly assuming that you have pip regularly installed, since you said you're using Python v2.7.9 and then PIP comes installed with Python by default. Try to see if it's allright with pip:
python -m pip --version

Categories

Resources