python pip install failures - python

i am trying to install a library pynput using
sudo pip install pynput
but i am getting this error log. This has been happening with any other python package. everything used to work fine suddenly these errors are appearing i tried to copy error log from
~/.pip/pip.log
and this is what i have:
Using version 1.4 (newest of versions: 1.4, 1.3.10, 1.3.9, 1.3.8.1, 1.3.7, 1.3.6, 1.3.5, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3, 1.2, 1.1.7, 1.1.6, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1, 1.0.6, 1.0.5, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0, 0.6, 0.5.1, 0.5, 0.4, 0.3, 0.2)
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
Exception:
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 1198, in prepare_files
do_download,
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 546, in unpack_http_url
resp = session.get(target_url, stream=True)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 467, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 330, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 562, in urlopen
body=body, headers=headers)
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 1017, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1051, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 826, in send
self.connect()
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 145, in connect
match_hostname(self.sock.getpeercert(),
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 313, in getpeercert
for value in get_subj_alt_name(x509)
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 94, in get_subj_alt_name
asn1Spec=general_names)
File "/usr/local/lib/python2.7/dist-packages/pyasn1/codec/ber/decoder.py", line 825, in __call__
stGetValueDecoder, self, substrateFun
File "/usr/local/lib/python2.7/dist-packages/pyasn1/codec/ber/decoder.py", line 391, in valueDecoder
r.verifySizeSpec()
File "/usr/local/lib/python2.7/dist-packages/pyasn1/type/base.py", line 252, in verifySizeSpec
def verifySizeSpec(self): self._sizeSpec(self)
File "/usr/local/lib/python2.7/dist-packages/pyasn1/type/constraint.py", line 32, in __call__
'%s failed at: \"%s\"' % (self, sys.exc_info()[1])
ValueConstraintError: ConstraintsIntersection(ConstraintsIntersection(), ValueSizeConstraint(1, 64)) failed at: "ValueSizeConstraint(1, 64) failed at: "SubjectAltName().setComponents(GeneralName(componentType=NamedTypes(NamedType('otherName', AnotherName(componentType=NamedTypes(NamedType('type-id', ObjectIdentifier('<no value>')), NamedType('value', ...........

A similar issue exists here.
The problem seems to be that the PyPI certificate now has more than 64 SAN names on it, breaking the hardcoded maximum in older versions of requests.
Make sure you have recent versions of both the requests and urllib3 modules.

You need to update pip. Just enter this command
curl https://bootstrap.pypa.io/get-pip.py | sudo python
After update bash -l
That's it.

I got it working by.
removing requests, urllib manually from
/usr/local/lib/python2.7/dist-packages
and reinstalling requests with sudo easy_install requests
then sudo easy_install pip==9.0.1

Try updating pip using
sudo -H pip2 install --upgrade pip
command.

Below solution worked for me.
Uninstall pip2
Install pip2 using PyPI (Refer 'Install pip From PyPI' section in https://www.howtodojo.com/2016/03/install-use-pip-ubuntu-14-04/)
Note: Install from ubuntu repository didn't work in my case.
Then I no longer got ValueConstraintError while installing any module using pip2 (ex: pip2 install invoke)

Related

Installing pygame with using pip but it shows error [duplicate]

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

pgame will not install [duplicate]

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

Docker - Timeout value connect was Timeout

I have just started out with Docker, and I am currently trying to run docker-compose run --rm setup on a docker-compose.yml file, but whenever I do, I receive the following:
Traceback (most recent call last):
File "/home/wickywills/.local/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
command()
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command
handler(command, command_options)
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 750, in run
run_one_off_container(container_options, self.project, service, options)
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/cli/main.py", line 1136, in run_one_off_container
rescale=False
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/project.py", line 388, in up
warn_for_swarm_mode(self.client)
File "/home/wickywills/.local/lib/python2.7/site-packages/compose/project.py", line 614, in warn_for_swarm_mode
info = client.info()
File "/home/wickywills/.local/lib/python2.7/site-packages/docker/api/daemon.py", line 90, in info
return self._result(self._get(self._url("/info")), True)
File "/home/wickywills/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/home/wickywills/.local/lib/python2.7/site-packages/docker/api/client.py", line 189, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 515, in get
return self.request('GET', url, **kwargs)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 582, in urlopen
timeout_obj = self._get_timeout(timeout)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 309, in _get_timeout
return Timeout.from_float(timeout)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 154, in from_float
return Timeout(read=timeout, connect=timeout)
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 97, in __init__
self._connect = self._validate_timeout(connect, 'connect')
File "/home/wickywills/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
"int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int or float.
Pip Freeze
backports.ssl-match-hostname==3.5.0.1
boto==2.40.0
cached-property==1.3.0
certifi==2017.4.17
chardet==3.0.4
colorama==0.3.9
cryptography==1.5
docker==2.4.2
docker-compose==1.14.0
docker-pycreds==0.2.1
dockerpty==0.4.1
docopt==0.6.2
duplicity==0.7.6
enum34==1.1.6
functools32==3.2.3.post2
idna==2.5
ipaddress==1.0.18
jsonschema==2.6.0
lockfile==0.12.2
mysql-connector-python==2.1.3
mysql-utilities==1.6.3
ndg-httpsclient==0.4.2
paramiko==2.0.0
pexpect==4.2.0
ptyprocess==0.5.1
pyasn1==0.1.9
pycrypto==2.6.1
pygobject==3.22.0
pyodbc==3.0.10
pyOpenSSL==16.1.0
pysqlite==2.7.0
python-cloudfiles==1.7.10
PyYAML==3.12
requests==2.18.1
six==1.10.0
texttable==0.8.8
urllib3==1.21.1
websocket-client==0.44.0
Seems like this is a common issue, without a real solution. I am running Ubuntu 16.10, and followed the installation instructions as per the Docker documentation. Can anyone advise?
Your error looks similar to this issue. The user closed the issue saying it was fixed by a new release of requests, so I would try upgrading requests in your virtual environment:
pip install --upgrade requests
From the comments, it sounds like you actually need to uninstall and then reinstall, rather than just upgrading.
pip uninstall requests
pip install requests
Just in case someone have the same problem as me (same error message) the previous commands were not enough to correct the problem.
There was an old useless urllib3 install inside requests...
So I did:
rm -rf ~/.local/lib/python2.7/site-packages/requests/packages/urllib3/
And it worked!

Cannot install and upgrade python packages on Ubuntu 14.04

I am trying to install some python packages but I am getting this kind of error every time.
The directory '/home/username/.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.
The directory '/home/username/.cache/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.
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
I looked it up on this site and Stack Overflow and all the solutions suggest installing
wheel
or
setuptools
But I am getting
Requirement already satisfied
The same problem occurs for trying to upgrade python packages.
Some of the commands that give me this error are:
sudo pip install -U textblob
My pip version is pip 8.1.1
What should I do?
Try, as suggested by the error message, running:
sudo -H pip install -U textblob
It is also well worth making sure that your version of pip is up to date with:
sudo python -m pip install -U pip
or
sudo -H python -m pip install -U pip
This happens to me frequently. Try this:
pip install textblob --user
This will work fine with other packages as well.
Thanks !

Urllib3 socks5 proxy error: 'socks' has no attribute 'create_connection'

I need Robobrowser to use Tor, easiest way i thought would be like this: Robobrowser with Sessions.
But i encountered a strange problem with requests, or more specific urllib3:
AttributeError: module 'socks' has no attribute 'create_connection'
As documented in Urllib3 Documentation create_connection is an attribute from socks.
Urllib3 version: 1.19.1
Requests version: 2.12.4
PySocks version: 1.6.5
import requests
session = requests.Session()
session.proxies = {'http':'socks5://127.0.0.1:9050'}
response = session.get('http://www.icanhazip.com', timeout=2)
print(response.text)
edit:
Stacktrace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/contrib/socks.py", line 79, in _new_conn
conn = socks.create_connection(
AttributeError: module 'socks' has no attribute 'create_connection'
It is because your python instance can't find the required socks libraries.
The libraries in /usr/lib/python* are installed via sudo apt-get install python3-requests etc.
However apt-get can't install the required pysocks libraries that the urllib3 uses. sudo apt-get install python3-socks won't work.
What will work is if you install it via sudo -H pip3 install pysocks urllib3[socks] requests[socks]
This will install it under here sudo ls -lrtah /usr/local/lib/python*/dist-packages/
Make sure you terminal session has /usr/lib:/usr/local/lib in the system path. If your python instance still can't find your socks library, then make sure both paths are part of your ~/.bashrc PYTHON_PATH export.

Categories

Resources