Installing twisted on Windows 10 64 bit under python 2.7 - python

Does anyone know how to do this. I have googled and the best that I could come up with was to do:
pip install autobahn[twisted]
when I do that I get this error in the command window
C:\Users\<User Name>\Desktop>pip install autobahn[twisted]
Collecting autobahn[twisted]
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: 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/security.html#snimissingwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading autobahn-18.3.1-py2.py3-none-any.whl (283kB)
100% |################################| 286kB 1.0MB/s
Collecting txaio>=2.7.0 (from autobahn[twisted])
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "c:\python27\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\python27\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "c:\python27\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "c:\python27\lib\site-packages\pip\download.py", line 853, in _download_http_url
stream=True,
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "c:\python27\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\python27\lib\site-packages\pip\_vendor\requests\adapters.py", line 497, in send
raise SSLError(e, request=request)
SSLError: [Errno 1] _ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
I have no idea how to fix the error

Go to University of California Irvine's Unofficial Windows Binary for Python Extension Packages and download the Twisted wheel file. This is the easy way. The hard way requires a compiler (comes packaged in Windows Built Tools) to be installed.
PLEASE NOTE!!!! For anyone stumbling onto this thread, only the latest package is available for download (usually) through the University of California Irvine site, so it would be wise to SAVE the binaries for future use. This is very useful if a specific version is required. Otherwise the specific compiler needs to used to compile packages.
References
Microsoft Visual C++ Compiler for Python 3.4
https://wiki.python.org/moin/WindowsCompilers

Related

Python 2.7 PIP install to use Artifactory as proxy

I have configured Jfrog Artifactory as remote repo for PIP module. When I install the pexcept module on Centos 7 OS, its downloading using the Artifactory proxy , but its giving below error message. Also it trying to connect https://pypi.python.org/pypi/pip/json website.
Any tips to fix below error? Also How can I force pip command to use always internal Artifacotry proxy not to connect any external repo directly.
Requirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /usr/lib/python2.7/site-packages (from pexpect)
Installing collected packages: pexpect
Compiling /tmp/pip-build-bKzDu5/pexpect/pexpect/_async.py ...
File "/tmp/pip-build-bKzDu5/pexpect/pexpect/_async.py", line 20
transport, pw = yield from asyncio.get_event_loop()\
^
SyntaxError: invalid syntax
Successfully installed pexpect-4.7.0
Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/utils/outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 487, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 467, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5c16190d10>: Failed to establish a new connection: [Errno 97] Address family not supported by protocol',))
remote site setting:
I am presently using artifactory for just this purpose. I did find that some packages did not resolve well. After changing to https://files.pythonhosted.org as the registry URL everything just fell into place.
my other settings are
Repository URL: https://files.pythonhosted.org
Registry Layout simple-layout
Pypi settings
Registry URL: https://pypi.org
Registry Suffix: simple

Unable to install twisted inside virtualenv on ubuntu 12.04

I am trying to install twisted inside virtualenv, everything seems to go fine but at the end this error is displayed.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-14YOyA/twisted/
The OS is ubuntu 12.04, does someone have any idea ?
here is the displayed text:
(solidwork)root#rico-TravelMate-5744Z:/home/rico# pip install twisted
Collecting twisted
/home/rico/solidwork/local/lib/python2.7/site-packages/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
SNIMissingWarning
/home/rico/solidwork/local/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections 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.html#ssl-warnings
InsecurePlatformWarning
Downloading Twisted-17.9.0.tar.bz2 (3.0MB)
100% |████████████████████████████████| 3.0MB 77kB/s
Complete output from command python setup.py egg_info:
Couldn't find index page for 'incremental' (maybe misspelled?)
No local packages or download links found for incremental>=16.10.1
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-14YOyA/twisted/setup.py", line 21, in <module>
setuptools.setup(**_setup["getSetupArgs"]())
File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 221, in __init__
self.fetch_build_eggs(attrs.pop('setup_requires'))
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 245, in fetch_build_eggs
parse_requirements(requires), installer=self.fetch_build_egg
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 576, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 821, in best_match
return self.obtain(req, installer) # try and download/install
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 833, in obtain
return installer(requirement)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/dist.py", line 294, in fetch_build_egg
return cmd.easy_install(req)
File "/home/rico/solidwork/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/easy_install.py", line 583, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('incremental>=16.10.1')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-14YOyA/twisted/

errors trying to installing "wireless" with pip

I am trying to install "wireless" with pip. I am not sure why it isn't working. I have tried using sudo's -H flag but nontheless I'm still getting the same errors. I am running Mac OSX Yosemite.
sudo pip install wireless
The directory '/Users/student/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/student/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting wireless
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: 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/security.html#snimissingwarning.
SNIMissingWarning
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading wireless-0.3.2.tar.gz
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/Library/Python/2.7/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning

pip fails to make a secure connection to pypi server

Yesterday I tried to install some python packages with pip and it just won't work.
paquete#paquete-ultrabook:~$ pip install isort -v
Downloading/unpacking isort
Could not fetch URL https://pypi.python.org/simple/isort/: connection error: [Errno 0] _ssl.c:344: error:00000000:lib(0):func(0):reason(0)
Will skip URL https://pypi.python.org/simple/isort/ when looking for download links for isort
Could not fetch URL https://pypi.python.org/simple/: connection error: [Errno 0] _ssl.c:344: error:00000000:lib(0):func(0):reason(0)
Will skip URL https://pypi.python.org/simple/ when looking for download links for isort
Cannot fetch index base URL https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/isort/: connection error: [Errno 0] _ssl.c:344: error:00000000:lib(0):func(0):reason(0)
Will skip URL https://pypi.python.org/simple/isort/ when looking for download links for isort
Could not find any downloads that satisfy the requirement isort
Cleaning up...
Removing temporary dir /tmp/pip_build_paquete...
No distributions at all found for isort
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for isort
Storing debug log for failure in /tmp/tmpl86YQE
I've been arround searching for an answer in the internet without success. A lot of answers from 2012 suggest to downgrade, but the bug that was troublesome had been fixed since that.
paquete#paquete-ultrabook:~$ pip -V
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
Some people had issues with their python interpreter, but it seems to connect fine to the server.
paquete#paquete-ultrabook:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib
>>> conn = httplib.HTTPSConnection("pypi.python.org")
>>> conn.request("GET","/simple/")
>>> res = conn.getresponse()
>>> print res.status, res.reason
200 OK
As additional information, I did an elementaryos fresh install a few weeks ago. This happens to ALL packages. I have installed everything through apt, so this seems Any ideas?
Update
Following the suggestion by #andersson I tried to install pip's latest version. Then this poped out
paquete#paquete-ultrabook:~$ sudo python3 Downloads/get-pip.py -v
The directory '/home/paquete/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/paquete/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 253, in ssl_wrap_socket
context.load_verify_locations(ca_certs)
ssl.SSLError: unknown error (_ssl.c:2734)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/adapters.py", line 370, in send
timeout=timeout
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 762, in _validate_conn
conn.connect()
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 255, in ssl_wrap_socket
raise SSLError(e)
pip._vendor.requests.packages.urllib3.exceptions.SSLError: unknown error (_ssl.c:2734)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmp8w985p0e/pip.zip/pip/utils/outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/sessions.py", line 476, in get
return self.request('GET', url, **kwargs)
File "/tmp/tmp8w985p0e/pip.zip/pip/download.py", line 367, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/sessions.py", line 464, in request
resp = self.send(prep, **send_kwargs)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/tmp/tmp8w985p0e/pip.zip/pip/_vendor/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
pip._vendor.requests.exceptions.SSLError: unknown error (_ssl.c:2734)
It seems to be a generic problem.
My problem was slightly different. It looks like the https://pypi.python.org/simple/ certificate was renewed in June 2016, so if the date of your OS is prior to that date, you'll have problems validating the certificate, no matter if the proper CA certs are installed.
I have also some issues with default (1.5.4) pip version. Can you successfully update pip to up-to-date (6.1.1) version or you have already tried and instalation failed with both pip versions?
Promptly solved by:
sudo update-ca-certificates

Python pip install requires server_hostname

I finished installing pip on linux, the pip list command works. But when using the pip install command it got the following error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/commands/install.py", line 339, in run
requirement_set.prepare_files(finder)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/req/req_set.py", line 333, in prepare_files
upgrade=self.upgrade,
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/index.py", line 305, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/index.py", line 783, in _get_page
return HTMLPage.get_page(link, req, session=self.session)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/index.py", line 872, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/sessions.py", line 473, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/download.py", line 365, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/cachecontrol/adapter.py", line 43, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/adapters.py", line 370, in send
timeout=timeout
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
body=body, headers=headers)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
conn.connect()
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.7-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 254, in ssl_wrap_socket
return context.wrap_socket(sock)
File "/usr/local/lib/python2.7/ssl.py", line 350, in wrap_socket
_context=self)
File "/usr/local/lib/python2.7/ssl.py", line 537, in __init__
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
How can I fix this?
pip 6.1.0 has been released, fixing this issue. You can upgrade with:
pip --trusted-host pypi.python.org install -U pip
to self-upgrade.
Original answer:
This is caused by a change in Python 2.7.9, which urllib3 needs to account for. See issue #543 for that project. Your OpenSSL libraries do not support SNI, which means urllib3 won't pass in the host name to the SSL socket wrapper, but Python 2.7.9 expects the hostname to be passed in anyway for different purposes.
urllib3 is indirectly used by requests (see requests issue 2435), which in turn is being used by pip.
I've opened a ticket to track this from pip's perspective.
The underlying issues have been fixed by the project maintainers, and awaiting a new release. You could install the current development version of pip if you are impatient:
pip install --trusted-host=github.com -U https://github.com/pypa/pip/archive/develop.zip
This'll install pip-6.1.0.dev0, when 6.1.0 is fully released you can upgrade again with pip install -U pip to get the final release from PyPI.
I get the same issue, and find that it can be avoided (pip 6.0.8) in my case as follows
pip --trusted-host pypi.python.org install <thing>
It is related to urllib3.
You can resolve it with urllib3 version 1.25.8.
Download that version of urllib3 manually and install it.
Even though you install thia version, pip will still use its own version.So you have to remove it and replace it.
Usually, installed module is on PythonXX/Lib/site-packages
Delete urllib3 in PythonXX/Lib/site-packages/pip/_vendor
Move "PythonXX/Lib/site-packages/urllib3" to "PythonXX/Lib/site-packages/pip/_vendor".
I encountered this problem and tried the above methods, but not work. I finally find it is because I turn on the VPN. When I turn off the VPN, I can successfully download packages.

Categories