Docker - Timeout value connect was Timeout - python

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!

Related

pip install raise ValueError("check_hostname requires server_hostname") while VPN is on

pip install <package> gives exception.
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
while VPN is on, let say. My only option is VPN. I can not turn it off. How to solve this problem.
Pip Version pip 21.1.1 Python 3.9.5 Conda version conda 4.10.1
Here is a full exception.
WARNING: Ignoring invalid distribution -rllib3 (c:\programdata\anaconda3\envs\pycharm\lib\site-packages)
WARNING: Ignoring invalid distribution -rllib3 (c:\programdata\anaconda3\envs\pycharm\lib\site-packages)
ERROR: Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\cli\base_command.py", line 180, in _main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\cli\req_command.py", line 204, in wrapper
return func(self, options, args)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
requirement_set = resolver.resolve(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 127, in resolve
result = self._result = resolver.resolve(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 473, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _merge_into_criterion
if not criterion.candidates:
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 139, in __bool__
return bool(self._sequence)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
return any(self)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 129, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 30, in _iter_built
for version, func in infos:
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 258, in iter_index_candidate_infos
result = self._finder.find_best_candidate(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\package_finder.py", line 879, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\package_finder.py", line 824, in find_all_candidates
page_candidates = list(page_candidates_it)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\package_finder.py", line 783, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\collector.py", line 512, in fetch_page
return _get_html_page(location, session=self.session)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\collector.py", line 422, in _get_html_page
resp = _get_html_response(url, session=session)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\index\collector.py", line 120, in _get_html_response
resp = session.get(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_internal\network\session.py", line 449, in request
return super().request(method, url, *args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\connection.py", line 500, in _connect_tls_proxy
return ssl_wrap_socket(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\ProgramData\Anaconda3\envs\PyCharm\lib\ssl.py", line 997, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
WARNING: Ignoring invalid distribution -rllib3 (c:\programdata\anaconda3\envs\pycharm\lib\site-packages)
WARNING: Ignoring invalid distribution -rllib3 (c:\programdata\anaconda3\envs\pycharm\lib\site-packages)
WARNING: Ignoring invalid distribution -rllib3 (c:\programdata\anaconda3\envs\pycharm\lib\site-packages)
You should try execute pip with --proxy paramenter like this:
pip --proxy <proxy> install <module>
Or you can try setting up environment-variables as explainded here https://pip.pypa.io/en/stable/user_guide/?highlight=proxy#using-a-proxy-server
Nevertheless, using a VPN should not prompt this kind of problemns, probably it's not well configured therefore, all the traffic doesn't go through it.
Check that you have your 0.0.0.0 IP route pointing to the vpn first.
If you use VPN try to disconnect it, it will solve the problem. VPN changes the proxy server setting.
Only solution for me was to upgrade pip via whl.
Download the latest whl and then pip installed the pip upgrade (pip-21.2.4-py3-none-any.whl) from the whl.
Once I upgraded PIP, then PIP could install as expected.
Copying additional detail from comment as per request.
Go to pypi.org and search for pip.py (pypi.org/search/?q=pip.py&o=). Download the file to your local computer (pip-21.2.4-py3-none-any.whl). Then, at prompt, "pip install ". It fixed mine. Hopefully it does yours too!
There is another better way to solve this.
Just need to upgrade pip version by using:
python -m pip install --upgrade pip

python pip install failures

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)

How to completely remove and install again PIP on MacOS Sierra (10.x)?

Had PIP working normally until few days ago.
Not sure how.
Trying to run it now and now show issues.
Adding full stack bellow of the error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 390, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 290, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 194, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 367, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 312, in __init__
proxy = parse_url(proxy_url)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py", line 189, in parse_url
raise LocationParseError(url)
LocationParseError: Failed to parse: user:pass
Want to try to reinstall pip completely.
What is recommended way to do it?
Your pip and Python installations are fine. What's wrong is your proxy configuration.
On OS X, both environment variables and the OS X network configuration can supply proxy information. First find out what configuration you have with:
python2.7 -c 'import urllib, pprint; pprint.pprint(urllib.getproxies())'
then look for any incorrect configuration in both your network settings (in the system configuration, check active networks for the proxies tab), and in your environment variables for *_proxy entries (http_proxy, https_proxy, etc.).
You can manually override proxies by setting one on the command line with the --proxy switch:
pip --proxy= install ...
Note the empty --proxy=; or you can set a specific proxy.
If you really did need to re-install your Python setup, you appear to have installed yours with Homebrew, so you can re-install it with brew install -f python#2.
Download Anaconda (or Miniconda), run it, and restart your terminal then start using environments.
to create an environment type
conda create -n my_project_name python=3.6
conda activate my_project_name
Now do all the pip installs and conda installs you want.
Your path is fixed. Pip is fixed. Go crazy.
Edit:
Now that you've posted your full traceback it looks like you need to feed the proxy a username and password. Here is one way to do it.
pip install --proxy=https://user#mydomain:port somepackage

How to create a local pypi mirror?

I want to create a local pypi mirror according to the web tutorial.
set local pypi mirror
Here is my way.
wget https://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py
sudo pip2.7 install pep381client
mkdir mirror
pep381run /tmp/mirror
An error info occurs here:
Traceback (most recent call last):
File "/usr/local/bin/pep381run", line 23, in <module>
state = pep381client.Synchronization.initialize(targetdir)
File "/usr/local/lib/python2.7/dist-packages/pep381client/__init__.py", line 96, in initialize
status.projects_to_do = set(xmlrpc().list_packages())
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1331, in single_request
response.msg,
xmlrpclib.ProtocolError: <ProtocolError for pypi.python.org/pypi: 403 Must access using HTTPS instead of HTTP>
How to create a local pypi mirror ?
pep381client seems to be quite outdated (last updated in 2011). You need something more fresh like devpi or pypi-server.

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 !

Categories

Resources