1

I am on a laptop with Ubuntu 18.04, and using python 3.6.5 although I also have Python 2.7.15rc1. Before attempting to install matplotlib I ran:

sudo apt-get update && sudo apt-get upgrade

which executed without errors.

Then I tried to install matplotlib for python 3 by running the following command:

python3 -m pip install matplotlib

This produced a long error message, which is repeated below:

Collecting matplotlib
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/matplotlib/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/matplotlib/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/matplotlib/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/matplotlib/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/matplotlib/
  Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Seeing that message at the end, I decided to oblige, but specifying that I wanted the installation for python3. So I ran the following:

python3 -m pip install --upgrade pip

Which also failed, with the following message:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/pip/
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))

You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Based on this answer, I ran curl https://bootstrap.pypa.io/get-pip.py, but instead of passing it into python3, I examined the output, and unfortunately it just says:

curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to bootstrap.pypa.io:443 

At this point I guess this is a connection problem, but I have no issues accessing the internet on Firefox (I am even posting this right now)...

I am connected to a home wi-fi router in Portugal, and I'm not behind any proxy (according to Ubuntu's Network Settings).

Disabling ipv6, as per this suggestion, didn't help with anything.

Adding sudo -H before my commands didn't solve the problem.

After running sudo ufw allow 443, the command python3 -m pip install --upgrade pip now returned:

Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 2.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/bin/pip'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Adding sudo -H doesn't solve this either. I don't know how exactly should I use the --user option.

What should I do?

Sirplentifus
  • 93
  • 1
  • 10
  • have you considered uninstalling it then install? – Onyambu Jul 29 '18 at 23:45
  • How do I re-install pip? Can't use pip... Do I do `sudo apt-get install python3-pip` ? – Sirplentifus Jul 30 '18 at 00:03
  • i thought you said the problem was with `matplotlib`. that is the one which you were to uninstall then install again. for `pip` look [install pip](https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows) – Onyambu Jul 30 '18 at 00:07
  • In any case, that didn't solve the problem. The only difference is that I seem to no longer get a message telling me to upgrade pip. However, `python3 -m pip --version` now outputs 9.0.1, which seems to be an older version than I had before... :( – Sirplentifus Jul 30 '18 at 00:09
  • I don't have matplotlib installed at all. – Sirplentifus Jul 30 '18 at 00:11
  • Can you provide the output of `which python3` and `python3 --version` ? – Pierre de Buyl Jul 30 '18 at 10:52
  • Furthermore, pip 18 is very recent and will not yet be present in Ubuntu's repositories, this is normal. And you can install matplotlib with `sudo apt-get install python3-matplotlib`. Ubuntu has version 2.1.1 which is recent enough for most needs. – Pierre de Buyl Jul 30 '18 at 10:54

1 Answers1

0

It seems it was an issue with my connection to the internet, although I'd still like to know more.

Connecting to the internet at a friend's house solved the issue.

Sirplentifus
  • 93
  • 1
  • 10