N
N
Nikolay Baranenko2016-08-29 14:51:52
Python
Nikolay Baranenko, 2016-08-29 14:51:52

How to correctly execute pip install if the connection to the internet is only through a proxy?

Hello.
On one of the machines running Windows, the only way to connect to the Internet is through a proxy.
How to correctly configure the python interpreter (version 3.5) so that it becomes possible to roll packets using an internet connection through a proxy?
ps
tried this way

cd "C:\Program Files\Python35\Scripts"
set HTTP_PROXY= user_proxy:[email protected]:1111
pip install pysnmp

and like this
“C:\Program Files\Python35\scripts\pip.exe” –-proxy http://user_proxy:[email protected]:1111 install requests

result is negative...
Collecting requests
Exception:
Traceback (most recent call last):
  File "c:\program files\python35\lib\site-packages\pip\basecommand.py", line 21
5, in main
    status = self.run(options, args)
  File "c:\program files\python35\lib\site-packages\pip\commands\install.py", li
ne 299, in run
    requirement_set.prepare_files(finder)
  File "c:\program files\python35\lib\site-packages\pip\req\req_set.py", line 37
0, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\program files\python35\lib\site-packages\pip\req\req_set.py", line 52
2, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", lin
e 268, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "c:\program files\python35\lib\site-packages\pip\index.py", line 442, in
find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "c:\program files\python35\lib\site-packages\pip\index.py", line 400, in
find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "c:\program files\python35\lib\site-packages\pip\index.py", line 545, in
_get_pages
    page = self._get_page(location)
  File "c:\program files\python35\lib\site-packages\pip\index.py", line 648, in
_get_page
    return HTMLPage.get_page(link, session=self.session)
  File "c:\program files\python35\lib\site-packages\pip\index.py", line 757, in
get_page
    "Cache-Control": "max-age=600",
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\session
s.py", line 487, in get
    return self.request('GET', url, **kwargs)
  File "c:\program files\python35\lib\site-packages\pip\download.py", line 378,
in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\session
s.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\session
s.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\cachecontrol\ada
pter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\adapter
s.py", line 370, in send
    conn = self.get_connection(request.url, proxies)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\adapter
s.py", line 273, in get_connection
    proxy_manager = self.proxy_manager_for(proxy)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\adapter
s.py", line 179, in proxy_manager_for
    **proxy_kwargs)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\package
s\urllib3\poolmanager.py", line 284, in proxy_from_url
    return ProxyManager(proxy_url=url, **kw)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\package
s\urllib3\poolmanager.py", line 229, in __init__
    proxy = parse_url(proxy_url)
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\package
s\urllib3\util\url.py", line 189, in parse_url
    raise LocationParseError(url)
pip._vendor.requests.packages.urllib3.exceptions.LocationParseError: Failed to p
arse: user_proxy:pwd

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Inishev, 2016-08-29
@drno-reg

pip install --proxy http://user:[email protected]:port <package>
That is, two hyphens before the option name and set the protocol

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question