My Case:
I have a isolated server(without internet and python 3.8.2) which as python virtual env at /apps/interface/usr/,
All my wheels are stored in https://my.private.org/
I am using pip 19.2.3 to install the packages.
Now,
I have pacakge named py, which has condition like "setup_requires=["setuptools-scm"]," (dependency).
py package is downloaded from https://my.private.org/
now, while trying to download setuptools-scm, its referring to https://files.pythonhosted.org/packages/... instead of https://my.private.org/
I have tried the below methods to redirect the pip to install wheels from https://my.private.org/ .
Point: The main package is getting installed from my personal repo, But the dependency packages is trying to download from public web which we don't have access to.
Method 1:
pip3.8 install py==1.8.1 --index-url https://user:psw#my.private.org/ --extra-index-url https://user:psw#my.private.org/ -v
Method 2:
updated /apps/interface/usr/lib/python3.8/distutils/distutils.cfg
[easy_install]
find_links = https://user:psw#my.private.org/
index-url = https://user:psw#my.private.org/
but no use.
Method 3:
updated below files (tried with each file)
/etc/xdg/pip/pip.conf
/etc/pip.conf
/root/.pip/pip.conf
/root/.config/pip/pip.conf
/apps/interface/usr/pip.conf
Below is the error I am getting
raise DistutilsError("Download error for %s: %s"
distutils.errors.DistutilsError: Download error for https://files.pythonhosted.org/packages/ad/d3/e54f8b4cde0f6fb4f231629f570c1a33ded18515411dee6df6fe363d976f/setuptools_scm-4.1.2-py2.py3-none-any.whl#sha256=69258e2eeba5f7ce1ed7a5f109519580fa3578250f8e4d6684859f86d1b15826: [Errno 101] Network is unreachable
Hoping to find what is the issue.
Note: Below is Error details
Downloading from URL https://my.private.org/py/py-1.8.1.tar.gz (from https://my.private.org/py/)
|████████████████████████████████| 215kB 74kB/s
Added py==1.8.1 from https://my.private.org/py/py-1.8.1.tar.gz to build tracker '/tmp/pip-req-tracker-gohcv4uc'
Running setup.py (path:/tmp/pip-install-xp37jgnc/py/setup.py) egg_info for package py
Running command python setup.py egg_info
Traceback (most recent call last):
File "/usr/local/lib/python3.8/urllib/request.py", line 1319, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/local/lib/python3.8/http/client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1004, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/http/client.py", line 944, in send
self.connect()
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/ssl_support.py", line 173, in connect
sock = socket.create_connection(
File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 766, in open_url
return open_with_auth(url, self.opener)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 961, in _socket_timeout
return func(*args, **kwargs)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 1080, in open_with_auth
fp = opener(request)
File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/ssl_support.py", line 160, in https_open
return self.do_open(
File "/usr/local/lib/python3.8/urllib/request.py", line 1322, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-xp37jgnc/py/setup.py", line 42, in <module>
main()
File "/tmp/pip-install-xp37jgnc/py/setup.py", line 5, in main
setup(
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/dist.py", line 716, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "/apps/interface/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 780, in resolve
dist = best[req.key] = env.best_match(
File "/apps/interface/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/apps/interface/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
return cmd.easy_install(req)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
dist = self.package_index.fetch_distribution(
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 655, in fetch_distribution
dist = find(requirement)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 635, in find
loc = self.download(dist.location, tmpdir)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 579, in download
found = self._download_url(scheme.group(1), spec, tmpdir)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 824, in _download_url
return self._attempt_download(url, filename)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 830, in _attempt_download
headers = self._download_to(url, filename)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 729, in _download_to
fp = self.open_url(url)
File "/apps/interface/usr/lib/python3.8/site-packages/setuptools/package_index.py", line 779, in open_url
raise DistutilsError("Download error for %s: %s"
distutils.errors.DistutilsError: Download error for https://files.pythonhosted.org/packages/ad/d3/e54f8b4cde0f6fb4f231629f570c1a33ded18515411dee6df6fe363d976f/setuptools_scm-4.1.2-py2.py3-none-any.whl#sha256=69258e2eeba5f7ce1ed7a5f109519580fa3578250f8e4d6684859f86d1b15826: [Errno 101] Network is unreachable
Cleaning up...
Removing source in /tmp/pip-install-xp37jgnc/py
Removed py==1.8.1 from https://packages.zeomega.org/py/py-1.8.1.tar.gz from build tracker '/tmp/pip-req-tracker-gohcv4uc'
Removed build tracker '/tmp/pip-req-tracker-gohcv4uc'
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Finally found the issue,
the easy_install was not honoring index_url configured. Thats main because of the hard coded url in easy_install.py. I changed the url as suggested in below link and its worked fine.
you can find the anwere here
Related
C:\Users\matth>pip3 install pygame
Collecting pygame
Using cached pygame-2.1.2.tar.gz (10.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [80 lines of output]
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1037, in _send_output
self.send(msg)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 975, in send
self.connect()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1075, in _create
self.do_handshake()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\config.py", line 225, in main
deps = CFG.main(**kwds)
^^^^^^^^^^^^^^^^
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\config_win.py", line 497, in main
and download_win_prebuilt.ask(**download_kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\download_win_prebuilt.py", line 290, in ask
update(x86=x86, x64=x64)
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\download_win_prebuilt.py", line 273, in update
download_prebuilts(download_dir, x86=x86, x64=x64)
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\download_win_prebuilt.py", line 124, in download_prebuilts
download_sha1_unzip(url, checksum, temp_dir, 1)
File "C:\Users\matth\AppData\Local\Temp\pip-install-g18yr5c2\pygame_2c1b94c764cc404881a71cf0ac51d63e\buildconfig\download_win_prebuilt.py", line 54, in download_sha1_unzip
response = urllib.urlopen(request).read()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.193.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:992)>
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip ed561079ec622b0bab5a9e02976f5d540b0622da
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
New answer (Feb 2023)
pip install pygame-ce
^ pygame-ce (pygame community edition) is a modern fork of pygame by many pygame contributors that supports 3.11 out of the box, just recently launched. See https://github.com/pygame-community/pygame-ce/tree/main
Short answer
pip install pygame --pre is necessary right now due to your Python version
Long answer
Your traceback shows you are using Python 3.11, which was just released earlier today. Pygame is a "C extension" and needs to re-release itself with new "wheels" (binaries) for every new minor release of Python (3.9, 3.10, 3.11, etc.)
The latest "full" pygame release, 2.1.2, was released a while back and doesn't come with wheels for 3.11, so your system tries to build pygame from source. It fails to do so, because you don't have a pygame development environment set up.
However, the latest pre release of pygame, 2.1.3.dev8 (released recently) has wheels for 3.11, so your system will not need to compile pygame from source.
Once pygame 2.1.3 is released, this extra flag (which tells it to look for pre releases), won't be necessary.
If you are using poetry. Do the following:
poetry add pygame=2.1.3.dev8
If you are using pip. Do the following:
pip install pygame --pre
Install python 3.10 and wait for pygame to be ready for 3.11 and then install pygame for that version. You can also have 2 version of python installed.
To work with each one use:
py -3.10 script.py
py -3.11 script.py
I have installed and imported the twitter package in python. After initializing a Twitter class instance as t this is what I tried.
>>> t.statuses.home_timeline
<twitter.api.TwitterCall object at 0x10646e160>
>>> print(t.statuses.home_timeline)
<twitter.api.TwitterCall object at 0x106d1f2e0>
>>> t.statuses.home_timeline()
The last line returned the following -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1319, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1004, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 944, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1399, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twitter/api.py", line 334, in __call__
return self._handle_response(req, uri, arg_data, _timeout)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/twitter/api.py", line 341, in _handle_response
handle = urllib_request.urlopen(req, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1362, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1322, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>
I am unable to resolve this. Also, I tried searching for a similar question but couldn't get it in case it is already there I apologise for the trouble.
Config -
MacOS Catalina 10.15.4
The error comes up in Python3.8, no such problem in Python2.7(the default python on my machine)
Note:
Have tried using pip install certifi for the python3 version and pip gives me a message saying "Requirement already satisfied". Also checked the folders in python3 and found a directory called etc with a folder openssl in it. OpenSSL folder itself was empty.
To fix this issue run command:
pip install certifi
Edit: For Mac OS users, go in the Applications folder and expand the Python folder. Now first run (or double click) the Install Certificates.command and then Update Shell Profile.command
Here is my code, very simple.
import urllib.request
x = urllib.request.urlopen('https://www.google.com/')
print(x.read())
and it is giving me this error:
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/myName/Library/Preferences/PyCharmCE2017.1/scratches/scratch_3.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/MattAltro/Library/Preferences/PyCharmCE2017.1/scratches/scratch_3.py", line 3, in <module>
x = urllib.request.urlopen('https://www.google.com/')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>
Process finished with exit code 1
Please help!!
It appears you have a security problem with SSL.
It works for me.
Does it produce the same error all the times?
Have you the lock when you go to https://www.google.com/ in your browser? If not, this is not a python problem, but a connection problem.
In some cases, you want to disable security checks with additional arguments verify=False.
Looks like you are on OS X and Python 3.6. Python 3.6 needs a post-install step to make SSL working. There are two options evidently:
install the certifi package
run the /Applications/Python 3.6/Install Certificates.command
I had my python installed through Homebrew, so I didn't have the .command file, and this tried with just the certifi package. The package would install fine, but SSL still wouldn't work. I ended up downloading Python 3.6 (from python.org) and running the Install Certificates.command. It worked fine from there.
Trying to setup a python flask server in a controlled environment, no access to internet
# python setup.py install
Traceback (most recent call last):
File "setup.py", line 9, in <module>
use_setuptools()
File "/tmp/app_dependencies/SQLObject-3.1.0/ez_setup.py", line 150, in use_setuptools
version = _resolve_version(version)
File "/tmp/app_dependencies/SQLObject-3.1.0/ez_setup.py", line 358, in _resolve_version
resp = urlopen(meta_url)
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1198, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 97] Address family not supported by protocol>
Was able to install from a wheel file
pip install SQLObject-version.whl
If you're installing from sources without an Internet connection you have to have dependencies — FormEncode, PyDispatcher and backend drivers — installed before installing SQLObject.
I'm running OS X El Capitan on Python 3.5.2 via Anaconda and have spaCy 0.101.0.
I'm trying to install the spaCy English language model using python -m spacy.en.download. However when I do that, I get an error that says urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>. The complete Traceback is as follows:
Traceback (most recent call last):
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1260, in connect
server_hostname=server_hostname)
File "/Users/bsherman/anaconda/lib/python3.5/ssl.py", line 377, in wrap_socket
_context=self)
File "/Users/bsherman/anaconda/lib/python3.5/ssl.py", line 752, in __init__
self.do_handshake()
File "/Users/bsherman/anaconda/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
File "/Users/bsherman/anaconda/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/bsherman/anaconda/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/Users/bsherman/anaconda/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/spacy/en/download.py", line 13, in <module>
plac.call(main)
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/spacy/en/download.py", line 9, in main
download('en', force)
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/spacy/download.py", line 24, in download
package = sputnik.install(about.__title__, about.__version__, about.__models__[lang])
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/sputnik/__init__.py", line 37, in install
index.update()
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/sputnik/index.py", line 84, in update
index = json.load(session.open(request, 'utf8'))
File "/Users/bsherman/anaconda/lib/python3.5/site-packages/sputnik/session.py", line 43, in open
r = self.opener.open(request)
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 1297, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 1256, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>
Run in terminal:
/Applications/Python 3.5.2/Install Certificates.command
or update certifi package via pip
I've come cross this issue several times before and pip install pip-system-certs did the trick for me.
https://pypi.org/project/pip-system-certs/