PIP fails all package installs Could not fetch url Read timeout - python

Any package install with pip I do keeps failing with Could not fetch url error, I'm able to access https://pypi.org/simple/prefect/ directly and ping pypi.org.
I'm on ubuntu 20.04.4 on windows 10, I'm not on any proxy or vpn, PIP v20.0.2 and Python 3.8.10, I tried 3.9 and 3.10 and still the same issue.
OpenSSL 1.1.1f and method 1.2
Scoured a lot of posts on stackoverflow but still unable to resolve my issue.

Related

Ubuntu Server 14. Error 'pip install package'

List item
WARNING: pip is configured with locations that require TLS/SSL,
however the ssl module in Python is not available
An error occurs on Ubuntu Server 14, when trying to install some kind of framework, I tried to reinstall Python, I tried absolutely everything. Help!
Python 3.10.10
OpenSSL - last version

Default PIP in python virtual environment is ancient, how to fix it?

I used python3 -m venv to create a virtual environment, in that virtual environment my settings are:
python 3.5.2
pip 8.1.1
Mac OS 10.13.6
That pip version is extremely OLD and leads to a problem described below: how do I get venv to install a newer version of pip?
Whenever I run "pip install " I get an error of the form:
Could not fetch URL https://pypi.python.org/simple/<any_package>/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) - skipping
I have tried this with = flask, gunicorn, and requests and believe that it's not a package specific problem.
What I tried to fix the problem:
I came across this link which suggested I should upgrade pip somehow: https://github.com/pypa/pip/issues/5226
So I upgraded pip up to the latest version:
pip 20.0.2 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip (python 3.5)
But the problem persisted. So then I upgraded venv to the latest version.
But the problem persisted again.
I did some more research online and came across the following github issue: https://github.com/pypa/pip/issues/5363
Which had as part of the problem statement text very similar to my TLS issue, but none of the answers there seemed to be able to fix the problem (pasting each one resulted in the same TLS issue).
Finally I found something that worked:
From this question: Upgrading pip/installing django - [SSL: TLSV1_ALERT_PROTOCOL_VERSION]
The solution below:
curl https://bootstrap.pypa.io/get-pip.py | python3
Upgrades my "virtual enviromnet's pip" to the correct version. But I yet to figure out how to get my default pip (when I create a new virtual environment) to be up to date.
As of today, it is not possible.
Starting with Python 3.9 it should be possible to do something like path/to/pythonX.Y -m venv --upgrade-deps .venv, and that would upgrade pip and setuptools in the newly created virtual environment:
https://bugs.python.org/issue34556
https://github.com/python/cpython/pull/13100
https://docs.python.org/3.9/library/venv.html
You could try virtualenv instead, if it suits your workflow better. As far as I know it tries to always install the latest version of pip in the virtual environments it creates.
https://pypi.org/project/virtualenv/
There is an example of code at the end of venv's documentation showing how to create a tool that downloads and installs up-to-date pip and setuptools:
https://docs.python.org/3/library/venv.html#an-example-of-extending-envbuilder
User wim made an interesting suggestion here:
https://stackoverflow.com/a/60217751
I have a tool called ve that does something similar:
https://pypi.org/project/ve/
There are some answers to similar questions, suggesting to modify the wheel files bundled with ensurepip in Python's standard library, but I wouldn't recommend that.
Similar questions:
How to get "python -m venv" to directly install latest pip version
Why 'python3 -m venv myenv' installs older version of pip into myenv than any version of pip I can find anywhere on the system?

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

Module installation in python returning "Could not find any downloads that satisfy the requirement" error?

Unfortunately I cannot install any modules on python 3.4 32 Bit using the pip command due to the following error.
How do I get around the problem. I have removed all other installations of python and have installed the 32 Bit version rather than the 64 Bit one?
Thanks
Edit 1:
At the moment I can't even upgrade pip
Edit 2
Unfortunately it still returns an error.
Try upgrading your pip with
python -m pip install -U pip
If this fails too, it has to be a network problem. See if you're properly connected to internet.
Seems like you might be using an old version of PIP which is facing SSL certification issues and is hence unable to connect. You can do a manual reinstall of pip using these commands.:
python -m pip uninstall pip setuptools
Then, download this script
Finally, run the script with:
python get-pip.py

Installing txMYSQL on Python

I am trying to establish MYSQL connection with my twisted server script. I found out that txMYSQL is a good choice to use, I dowloaded the package out of Github and tried installing from the setup.py file, but it didn't work.
I tried inslalling txMYSQL by using easy_install txmysql but it dosen't appear to be found through this command since its not on pythons server.
How can I install txMYSQL ?
I am currently using python 2.7.8 on my Windows machine.
Try to install using pip and referencing Github repo. I tried here and worked well on a Ubuntu 12.04.4
pip install git+https://github.com/hybridlogic/txMySQL.git

Categories

Resources