pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.46k stars 3k forks source link

pip install and upgrade errors #2696

Closed raj454raj closed 9 years ago

raj454raj commented 9 years ago

This is the traceback when pip install twitter is given

> Downloading/unpacking twitter
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/index.py", line 194, in find_requirement
    page = self._get_page(main_index_url, req)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/index.py", line 568, in _get_page
    session=self.session,
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/index.py", line 670, in get_page
    resp = session.get(url, headers={"Accept": "text/html"})
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/download.py", line 237, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 327, in send
    timeout=timeout
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 488, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 222, in _get_conn
    return conn or self._new_conn()
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 683, in _new_conn
    return self._prepare_conn(conn)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 647, in _prepare_conn
    conn.connect()
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 190, in connect
    ssl_version=resolved_ssl_version)
  File "/home/raj/anaconda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 410, in ssl_wrap_socket
    cnx.set_tlsext_host_name(server_hostname)
AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'
Storing debug log for failure in /tmp/tmp94p6fO

Similar erri=or is raised in the case of upgrading any package. Is it a problem with pip or requests module or urllib3. Can anyone suggest a fix.

rbtcollins commented 9 years ago

That error is being thrown within the pip vendored code, so I'd say a pip issue.

What platform, Python version are you using?

rbtcollins commented 9 years ago

Also what pip version?

raj454raj commented 9 years ago

@rbtcollins : Thanks for you reply. Python 2.7.7 Pip 1.5.6 Any help?

rbtcollins commented 9 years ago

Hi sorry.

So - I'd suggest you try pip 6.1.1 as a first step. Thats quite a bit newer, and may include a fix.

raj454raj commented 9 years ago

Hey @rbtcollins. Again the same error pops up when installing pip with python get-pip.py

> Collecting pip
  Exception:
  Traceback (most recent call last):
    File "/tmp/tmpQjEY9r/pip.zip/pip/basecommand.py", line 246, in main
      status = self.run(options, args)
    File "/tmp/tmpQjEY9r/pip.zip/pip/commands/install.py", line 342, in run
      requirement_set.prepare_files(finder)
    File "/tmp/tmpQjEY9r/pip.zip/pip/req/req_set.py", line 345, in prepare_files
      functools.partial(self._prepare_file, finder))
    File "/tmp/tmpQjEY9r/pip.zip/pip/req/req_set.py", line 290, in _walk_req_to_install
      more_reqs = handler(req_to_install)
    File "/tmp/tmpQjEY9r/pip.zip/pip/req/req_set.py", line 467, in _prepare_file
      req_to_install.populate_link(finder, self.upgrade)
    File "/tmp/tmpQjEY9r/pip.zip/pip/req/req_install.py", line 251, in populate_link
      self.link = finder.find_requirement(self, upgrade)
    File "/tmp/tmpQjEY9r/pip.zip/pip/index.py", line 425, in find_requirement
      all_versions = self._find_all_versions(req.name)
    File "/tmp/tmpQjEY9r/pip.zip/pip/index.py", line 349, in _find_all_versions
      index_locations = self._get_index_urls_locations(project_name)
    File "/tmp/tmpQjEY9r/pip.zip/pip/index.py", line 323, in _get_index_urls_locations
      page = self._get_page(main_index_url)
    File "/tmp/tmpQjEY9r/pip.zip/pip/index.py", line 789, in _get_page
      return HTMLPage.get_page(link, session=self.session)
    File "/tmp/tmpQjEY9r/pip.zip/pip/index.py", line 878, in get_page
      "Cache-Control": "max-age=600",
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/sessions.py", line 476, in get
      return self.request('GET', url, **kwargs)
    File "/tmp/tmpQjEY9r/pip.zip/pip/download.py", line 367, in request
      return super(PipSession, self).request(method, url, *args, **kwargs)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/sessions.py", line 464, in request
      resp = self.send(prep, **send_kwargs)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/sessions.py", line 576, in send
      r = adapter.send(request, **kwargs)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 46, in send
      resp = super(CacheControlAdapter, self).send(request, **kw)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/adapters.py", line 370, in send
      timeout=timeout
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 539, in urlopen
      self._prepare_proxy(conn)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 727, in _prepare_proxy
      conn.connect()
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
      ssl_version=resolved_ssl_version)
    File "/tmp/tmpQjEY9r/pip.zip/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 296, in ssl_wrap_socket
      cnx.set_tlsext_host_name(server_hostname)
  AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'

Is there a way to get rid of pip completely and then start from scratch. PS: I am using Ubuntu 14.04 under proxy network I tried this also

python get-pip.py --proxy="http://proxy.iiit.ac.in:8080/

and

pip install -U pip

which leads to same traceback

rbtcollins commented 9 years ago

Try this:

raj454raj commented 9 years ago

Hey @rbtcollins sorry but I didn't understand the first part

nwork commented 9 years ago

I was able to correct this error by upgrading pyOpenSSL

raj454raj commented 9 years ago

@nwork : How did you upgraded pyOpenSSL since I get the error while upgrading by pip also. Please I urgently need to fix this issue.

nwork commented 9 years ago

via their github page https://github.com/pyca/pyopenssl

raj454raj commented 9 years ago

@nwork : Tried a lot no good still. Github page suggests pip install pyopenssl - which gives me requirement satisfied and on --upgrade it gives me -

Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement pyopenssl in /usr/local/lib/python2.7/dist-packages Downloading/unpacking pyopenssl Cleaning up... No distributions at all found for pyopenssl in /usr/local/lib/python2.7/dist-packages Storing debug log for failure in /home/raj/.pip/pip.log

Please help me !!!

nwork commented 9 years ago

I just downloaded the zip via the browser.. cd extractedDir sudo python setup.py install

dstufft commented 9 years ago

Hmm, I think this is another one that either @sigmavirus24 or @lukasa would have insight on, I think this is a urllib3 problem.

Lukasa commented 9 years ago

Looks like an old version of PyOpenSSL is installed, which is missing set_tlsext_host_name. That means it's a version lower than 0.13. Consider upgrading. =)

Lukasa commented 9 years ago

Separately, requests should probably version check pyopenssl before we inject it. Thoughts @sigmavirus24?

dstufft commented 9 years ago

Ok, I'm going to close this issue then since @Lukasa thinks it's just an old PyOpenSSL. Thanks!

sigmavirus24 commented 9 years ago

@Lukasa I'm okay with that. We should probably discuss that on a requests issue though

raj454raj commented 9 years ago

I am not able to upgrade my pyopenssl and hence the problem still remains

On Sun, 10 May 2015 01:12 Ian Cordasco notifications@github.com wrote:

@Lukasa https://github.com/Lukasa I'm okay with that. We should probably discuss that on a requests issue though

— Reply to this email directly or view it on GitHub https://github.com/pypa/pip/issues/2696#issuecomment-100536155.

sigmavirus24 commented 9 years ago

@raj454raj try uninstalling pyOpenSSL first

kaos commented 9 years ago

After upgrading pyOpenSSL I still have this issue. If I uninstall ndg-httpsclient, it goes away, but then I get a warning that a true SSL context object is not available, ssl is unusable.

/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

Not sure what is wrong, since I have a subset of the same set of packages/versions in another installation that works fine (although, that is a CentOS 6, while the one with issues is a RedHat 6, but still), with ndg-httpsclient present (and ssl working).

kaos commented 9 years ago

Solved it by running yum remove pyOpenSSL (somehow the older version from yum messed up the installation.. :p)

rasselin commented 8 years ago

We ran into this. We had to apt-get uninstall python-openssl (0.12), after which we're able to pip install pyOpenSSL (0.15.1) which resolves the issue.

inetfuture commented 8 years ago

apt-get remove python-openssl works for me.