Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install Python libraries

I am not able to install any Python libraries. I am using pip 9.0.1 and python 2.7. I am getting the following error:

EN-NishantS:~ 8417$ pip install presto-python-client
Collecting presto-python-client
  Could not find a version that satisfies the requirement presto-python-client (from versions: )
No matching distribution found for presto-python-client

On running with pip install -vvv I am getting the following:

Collecting presto-python-client
  1 location(s) to search for versions of presto-python-client:
  * https://pypi.python.org/simple/presto-python-client/
  Getting page https://pypi.python.org/simple/presto-python-client/
  Looking up "https://pypi.python.org/simple/presto-python-client/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/presto-python-client/ HTTP/1.1" 403 170
  Status code 403 not in [200, 203, 300, 301]
  Could not fetch URL https://pypi.python.org/simple/presto-python-client/: 403 Client Error: TLSv1.2+ is required for url: https://pypi.python.org/simple/presto-python-client/ - skipping
  Could not find a version that satisfies the requirement presto-python-client (from versions: )
Cleaning up...
No matching distribution found for presto-python-client
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/index.py", line 514, in find_requirement
    'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for presto-python-client
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
"GET /pypi/pip/json HTTP/1.1" 403 170
Status code 403 not in [200, 203, 300, 301]
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/outdated.py", line 128, in pip_version_check
    resp.raise_for_status()
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/models.py", line 862, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 403 Client Error: TLSv1.2+ is required for url: https://pypi.python.org/pypi/pip/json
like image 286
nish Avatar asked Apr 09 '18 13:04

nish


People also ask

Why pip install is not working?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.


2 Answers

I successfully upgraded Python 3 on macOS v10.13 (High Sierra) using sudo pip3 install --upgrade pip.

To upgrade the High Sierra version 2.7 I had to use sudo pip2 install --upgrade pip.

like image 163
Milliways Avatar answered Oct 08 '22 08:10

Milliways


Your HTTP request to PyPI fails with an HTTP 403 (Forbidden) error:

HTTPError: 403 Client Error: TLSv1.2+ is required for url:

https://pypi.python.org/pypi/pip/json

Apparently pip is trying to access PyPI via HTTPS (which is encrypted and fine), but with an old (insecure) SSL version. Your system seems to be out of date. It might help if you update your packages.

On Debian-based systems I'd try:

apt-get update && apt-get upgrade python-pip

On Red Hat Linux-based systems:

yum update python-pip # (or python2-pip, at least on Red Hat Linux 7)

On Mac:

sudo easy_install -U pip

You can also try to update openssl separately.

like image 45
Dominique Barton Avatar answered Oct 08 '22 08:10

Dominique Barton