3

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.

0
4

The notebook package size is around 6.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 the pip3, use this one, this would do the work too.

You can use --default-timeout switch to fix this issue, e.g:

sudo pip --default-timeout=1000 install jupyter

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 run pip3 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 with sudo.

pip3 install --upgrade pip --user

And if you get the same error, now you know how to fix it, just use --default-timeout switch to upgrade pip.

Now it should work without any error:

pip3 install jupyter --user

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.