I'm trying to install jupyter notebook
using pip
, so I first installed pip3
:
sudo apt-get install --no-install-recommends python3-pip
Then I ran:
sudo pip3 install jupyter
While downloading the package notebook
it waits for some seconds, then it fails with lots of errors, which end of them looks like this:
File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 231, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
My Ubuntu version is: 16.04 (Xenial), and I'm running on a fairly slow Internet connection.
The
notebook
package size is around6.9 MB
and if you running on a low speed internet connection there is a high chance that installation fails because of the timeout.I fixed the problem by updating the
pip3
, however I'm going to suggest another way too, If it's not possible for you to upgrade thepip3
, use this one, this would do the work too.You can use
--default-timeout
switch to fix this issue, e.g:It should ignore the timeout and installation will be done with success.
The other thing that worked for me was updating
pip3
, the one in the Ubuntu repositories is pretty old:8.1.1
and the last version at the time of writing this guide is:9.0.1
. I suggest this method simply because you don't have to runpip3
with--default-timeout
every time that you are trying to install a new package, and of course you can use an alias too ;) whatever works for you.By the way, I'm not a fan of installing python packages as root, so I suggest using
--user
switch to install it locally for yourself, but if you are trying to make this package wide system available, then go withsudo
.And if you get the same error, now you know how to fix it, just use
--default-timeout
switch to upgradepip
.Now it should work without any error:
I've fixed this issue on my server by following setup because the only timeout not helped me:
~/.pip/pip.conf on ubuntu machine with content below
[global] trusted-host = pypi.org files.pythonhosted.org
[install] timeout = 100
Seems like other "more trusted" hosts fine for some network providers and now in works great. More info in doc https://pip.pypa.io/en/stable/topics/configuration/#pip-config-file