Télécharger une librairie python via pip derrière un proxy.

Résolu/Fermé
Kikumachi - 14 janv. 2019 à 13:44
[Dal] Messages postés 6174 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 2 février 2024 - 29 janv. 2019 à 12:33
Bonjour,

J'ai un sacré problème pour télécharger une librairie python, cela fait deux jours que je me casse la tête dessus et je viens de trouver la cause de mon problème, mais je ne suis pas plus avancé qu'avant !

Petit contexte : Je suis sous windows 10, avec une connexion proxy (dont je connais l'URL du serveur et le numéro de port), et j'ai téléchargé Python 3.7.2 récemment, toutefois j'ai besoin de certaines bibliothèques afin de pouvoir coder de façon correcte. Pour cela je voudrais utiliser la commande pip. J'ai donc installé pip avec succès sur mon ordinateur (j'ai bien dans Program Files/Python3.7.2/Scripts plusieurs dossiers "pip", "pip3" chacun d'environ 90 Ko), et je tape, pour télécharger par exemple la librairie "matplotlib" :

pip3 install matplotlib --proxy HTTPS_PROXY


Où HTTPS_PROXY est une variable d'environnement définie comme suit :

https://[Username:passwd@]proxy.server:proxyPort
comme indiqué dans l'aide de la commande.

J'obtenais alors l'erreur suivante :

  File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\operations\prepare.py", line 218, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\req\req_install.py", line 164, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\index.py", line 572, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\index.py", line 530, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\index.py", line 675, in _get_pages
page = self._get_page(location)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\index.py", line 793, in _get_page
return _get_html_page(link, session=self.session)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\index.py", line 144, in _get_html_page
"Cache-Control": "max-age=0",
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\requests\sessions.py", line 525, in get
return self.request('GET', url, **kwargs)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_internal\download.py", line 396, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\requests\sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\requests\sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\requests\adapters.py", line 410, in send
conn = self.get_connection(request.url, proxies)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\requests\adapters.py", line 304, in get_connection
proxy_url = parse_url(proxy)
File "c:\program files (x86)\python3.7.2\lib\site-packages\pip\_vendor\urllib3\util\url.py", line 196, in parse_url
host, url = url.split(']', 1)
ValueError: not enough values to unpack (expected 2, got 1)


Je suis donc allé voir le fichier de la dernière ligne d'erreur "url.py", et après avoir conduit quelques tests à base de "print", j'ai remarqué que l'erreur venait de mon "Username", qui possède le caractère "/" !

Or ce caractère est considéré dans le fichier qui analyse HTTPS_PROXY comme un séparateur dans le programme, afin de construire les chemins d'URL (par exemple vers le lien possédant la librairie), il est utilisé dans une fonction "split". Mon username possédant ce caractère, il se retrouve alors coupé en deux, avec "[Début d'username" stocké dans la variable "url" du programme, et "FinUsername:passwd@]proxy.server:proxyPort" stocké dans la variable "path" du programme, et le parsing ne peut plus avoir lieu ensuite car le programme doit extraire l'username et le Password ensemble depuis une seule variable et le fait à l'aide de crochets, mais ces crochets se retrouvent dans "path" et "url" (le programme unpackant "url" qui possède le crochet gauche, ne retrouve pas le crochet droit et considère alors qu'il n'y a qu'un seul élément.

Suite à cela, j'ai pensé changer mon nom d'utilisateur, mais je n'y suis pas autorisé, je voudrais donc savoir :
- s'il y a un autre moyen de télécharger la bibliothèque
- S'il y a un moyen de modifier le programme url.py afin que le "/" de mon nom d'utilisateur ne soit pas considéré comme délimitant un chemin d'URL.

Merci d'avance pour votre aide !

1 réponse

[Dal] Messages postés 6174 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 2 février 2024 1 083
Modifié le 14 janv. 2019 à 14:42
Salut Kikumachi,

A tout hasard, essaye de remplacer le "/" dans ta variable d'environnement par "%2F" (qui est la version URL encoded de ce caractère).


Dal
1
Bonjour,

Merci pour votre conseil. J'ai essayé de remplacer le "/" par "%2F" et cela me donne une autre erreur :


  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x066262B0>, 'Connection to proxy.serverProxy timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x06626410>, 'Connection to proxy.serverProxy timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x06626510>, 'Connection to proxy.serverProxy timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x066265D0>, 'Connection to proxy.serverProxy timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x06626690>, 'Connection to proxy.serverProxy timed out. (connect timeout=15)')': /simple/matplotlib/

Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib


Il semblerait qu'il ne trouve pas la librairie matplotlib, ou que j'aie oublié de préciser une option, mais je ne suis pas sûr de ce dont il s'agit.
0
[Dal] Messages postés 6174 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 2 février 2024 1 083
Modifié le 14 janv. 2019 à 16:18
je n'ai jamais utilisé pip avec un proxy, mais cela vient peut être de la syntaxe de ta ligne de commande, où tu utilises l'option
--proxy HTTPS_PROXY
...

d'après
pip help
, le format de cette option est :

 --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.

en fait, si tu définis HTTPS_PROXY (et HTTP_PROXY) en variables d'environnement, pip devrait respecter ce qui y figure, sans que tu aies à passer autre chose, essaye alors
pip3 install matplotlib
. L'option de ligne de commande
--proxy
ne serait utile que si tu n'as pas définit de variable d'environnement, ou si tu veux passer un autre proxy que celui définit au niveau du système par la variable d'environnement.
0
Re-bonjour,

J'ai remarqué que pendant tout ce temps j'avais ouvert l'invite de commande en tant qu'utilisateur et non en tant qu'administrateur.
J'ai du coup ré-essayé ce que vous m'aviez dit et j'obtiens l'erreur suivante :

  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x05AC3F90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/matplotlib/

Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x05AC3A90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/matplotlib/

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x05AC32F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/matplotlib/

Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x05AE9330>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/matplotlib/

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0623A290>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/matplotlib/
Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib
0
[Dal] Messages postés 6174 Date d'inscription mercredi 15 septembre 2004 Statut Contributeur Dernière intervention 2 février 2024 1 083
Modifié le 15 janv. 2019 à 10:35
Là, je sèche un peu :-) l'erreur est visiblement déclenchée par la classe urllib3.connection.VerifiedHTTPSConnection

https://urllib3.readthedocs.io/en/latest/reference/#urllib3.connection.VerifiedHTTPSConnection

Il se peut que pip ne valide pas bien le certificat SSL du site lorsque la connexion passe par le proxy, dans ce cas, tu pourrais essayer d'ajouter
--trusted-host pypi.python.org
à la ligne de commande (sauf si tu as customisé pip.conf pour pointer vers un autre repository).

Sinon, ajoute l'option
-v
à la ligne de commande pip install (-v pour verbose), on aura peut-être plus d'infos sur la nature du problème qui semble affecter la connexion HTTPS, et copie-colle la commande que tu tapes suivie de l'intégralité des messages qu'elle produit.
0
J'ai essayé de taper
pip install matplotlib -v 

J'obtiens :
Collecting matplotlib
Getting page https://pypi.python.org/simple/matplotlib/

Starting new HTTPS connection (1): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A320>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (2): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=3, connect=None, read=None, redirect=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A470>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (3): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=2, connect=None, read=None, redirect=None)
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A550>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (4): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=1, connect=None, read=None, redirect=None)
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A668>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (5): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=0, connect=None, read=None, redirect=None)
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A780>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (6): pypi.python.org
Could not fetch URL https://pypi.python.org/simple/matplotlib/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/matplotlib/ (Caused by ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A898>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')) - skipping

1 location(s) to search for versions of matplotlib:
https://pypi.python.org/simple/matplotlib/
Getting page https://pypi.python.org/simple/matplotlib/

Starting new HTTPS connection (7): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9AA90>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (8): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=3, connect=None, read=None, redirect=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9AD30>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (9): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=2, connect=None, read=None, redirect=None)
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9AE10>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (10): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=1, connect=None, read=None, redirect=None)
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9AF28>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (11): pypi.python.org
Incremented Retry for (url='/simple/matplotlib/'): Retry(total=0, connect=None, read=None, redirect=None)
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995BAF080>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Starting new HTTPS connection (12): pypi.python.org
Could not fetch URL https://pypi.python.org/simple/matplotlib/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/matplotlib/ (Caused by ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995BAF198>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')) - skipping
Could not find a version that satisfies the requirement matplotlib (from versions: )
Cleaning up...
No matching distribution found for matplotlib


Exception information:
Traceback (most recent call last):
File "c:\program files (x86)\python3.5\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\commands\install.py", line 294, in run
requirement_set.prepare_files(finder)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\req\req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "c:\program files (x86)\python3.5\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\req\req_set.py", line 461, in _prepare_file
req_to_install.populate_link(finder, self.upgrade)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\req\req_install.py", line 250, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\index.py", line 571, in find_requirement
'No matching distribution found for %s' % req
pip.exceptions.DistributionNotFound: No matching distribution found for matplotlib
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 134, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 88, in create_connection
raise err
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 78, in create_connection
sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 539, in urlopen
self._prepare_proxy(conn)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 727, in _prepare_proxy
conn.connect()
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 204, in connect
conn = self._new_conn()
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 139, in _new_conn
(self.host, self.timeout))
pip._vendor.requests.packages.urllib3.exceptions.ConnectTimeoutError: (<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A278>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=5)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\adapters.py", line 370, in send
timeout=timeout
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 597, in urlopen
_stacktrace=sys.exc_info()[2])
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\retry.py", line 271, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A278>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=5)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\program files (x86)\python3.5\lib\site-packages\pip\utils\outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\sessions.py", line 477, in get
return self.request('GET', url, **kwargs)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\download.py", line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\program files (x86)\python3.5\lib\site-packages\pip\_vendor\requests\adapters.py", line 419, in send
raise ConnectTimeout(e, request=request)
pip._vendor.requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017995B9A278>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=5)'))


J'ai également essayé de taper la commande :
pip install matplotlib --trusted-host pypi.python.org

et j'obtiens :
Collecting matplotlib
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6A320>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6A4A8>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6A5C0>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6A6D8>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6A7F0>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6ABE0>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6AD68>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6AE80>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B6AF98>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001C975B7C0F0>, 'Connection to proxy.rd.francetelecom.fr timed out. (connect timeout=15)')': /simple/matplotlib/

Could not find a version that satisfies the requirement matplotlib (from versions: )
No matching distribution found for matplotlib
0