"Search for package" during poetry init does not work behind a corporate proxy
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- [x ] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: Ubuntu 18.04.1 LTS
- Poetry version: 0.12.3
- Link of a Gist with the contents of your pyproject.toml file: n/a poetry init fails without generating pyproject.toml file
Issue
When running poetry init in an environment behind a corporate proxy, and attempting to interactively resolve dependencies, it times out during the first run of “Search for package” with the following trace
Would you like to define your dependencies (require) interactively? (yes/no) [yes]
Search for package: requests
[error]
[Errno 110] Connection timed out
Exception trace:
/home/smulcahy/.poetry/lib/poetry/_vendor/py2.7/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/smulcahy/.poetry/lib/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/home/smulcahy/.poetry/lib/poetry/_vendor/py2.7/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/smulcahy/.poetry/lib/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/home/smulcahy/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/smulcahy/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/smulcahy/.poetry/lib/poetry/console/commands/init.py in handle() at line 116
self._determine_requirements(self.option("dependency"))
/home/smulcahy/.poetry/lib/poetry/console/commands/init.py in _determine_requirements() at line 162
matches = self._get_pool().search(package)
/home/smulcahy/.poetry/lib/poetry/repositories/pool.py in search() at line 98
results += repository.search(query, mode=mode)
/home/smulcahy/.poetry/lib/poetry/repositories/pypi_repository.py in search() at line 203
hits = client.search(search, "or")
/usr/lib/python2.7/xmlrpclib.py in __call__() at line 1243
return self.__send(self.__name, args)
/usr/lib/python2.7/xmlrpclib.py in __request() at line 1602
verbose=self.__verbose
/usr/lib/python2.7/xmlrpclib.py in request() at line 1283
return self.single_request(host, handler, request_body, verbose)
/usr/lib/python2.7/xmlrpclib.py in single_request() at line 1311
self.send_content(h, request_body)
/usr/lib/python2.7/xmlrpclib.py in send_content() at line 1459
connection.endheaders(request_body)
/usr/lib/python2.7/httplib.py in endheaders() at line 1038
self._send_output(message_body)
/usr/lib/python2.7/httplib.py in _send_output() at line 882
self.send(msg)
/usr/lib/python2.7/httplib.py in send() at line 844
self.connect()
/usr/lib/python2.7/httplib.py in connect() at line 1255
HTTPConnection.connect(self)
/usr/lib/python2.7/httplib.py in connect() at line 821
self.timeout, self.source_address)
/usr/lib/python2.7/socket.py in create_connection() at line 575
raise err
The problem seems to arise in xmlrpclib which doesn’t include built-in support for http or https proxies. https://docs.python.org/2/library/xmlrpclib.html#example-of-client-usage includes an example of how to instruct xmlrpclib to use a proxy. I’m not sure if the same approach will work for xmlrpc.client.
I’m not sure if poetry wants to default to the proxies defined in the users environment variables if they’re set (typically some of http_proxy, https_proxy, no_proxy, HTTP_PROXY, HTTPS_PROXY, NO_PROXY) or to explicitly require a user to pass a proxy arg to poetry. Either one works although using the environment variables if set is what other tools do by default.
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:17 (4 by maintainers)
Top GitHub Comments
Current versions of Poetry respect the
PROXY_
/proxy_
environmental variables inpoetry search
.I’m getting the same ImportError and I’m not using any proxy.
Edit: traceback (poetry init -vvv)
Edit2: this seems to be fixed in 750e31de98b84e294ac6c5798ad8c4656be9dd2e cc @mulcahys