Asking for password fails when using private PyPI
See original GitHub issueHi, is it possible to make pipenv to ask for user and password to private PyPI repository (nexus) like pip does? Or even better to provide some sort of paramater to specify what user and password to use.
I can use workaround and store those credentials into Pipfile, but that is not secure enough nor convinient (I have to edit it manually). We deploy code using Jenkins (environment + code). Right now we use only pip for that and we are looking for something smarter. Upgrading to pipenv right now would mean injecting credentials into Pipfile during build. And that does not seem to be pythonic way at all 😃
My Pipfile:
[[source]]
url = "https://user:pass@nexus/repository/pypi-all/simple"
verify_ssl = true
[packages]
[dev-packages]
For this to work I have pip.ini configuration file set up.
[global]
index = https://nexus/repository/pypi-all/pypi
index-url = https://nexus/repository/pypi-all/simple
cert=C:\Users\user\AppData\Roaming\pip\nexus.cer
[distutils]
index-servers = nexus
[nexus]
repository = https://nexus/repository/pypi-internal/
cert=C:\Users\user\AppData\Roaming\pip\nexus.cer
Describe your environment
Windows 7 x64 6.1.7601 Python 3.6.3 pipenv version 8.3.1
Expected result
Being asked for user/password when installing from password protected private PyPI repository (like pip does).
or doing the same by running something like:
pipenv install requests --user XX --pass YY
Actual result
When I have no user:pass in Pipfile then i get:
C:\Users\user\Downloads>pipenv install numpy --verbose
Installing numpy…
Installing 'numpy'
$ "C:\\Users\\user\\.virtualenvs\\Downloads-a87zm7tz\\Scripts\\pip.exe" install --verbose "numpy" -i https://nexus/repository/pypi-all/simple --exists-action w
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Collecting numpy
1 location(s) to search for versions of numpy:
* https://nexus/repository/pypi-all/simple/numpy/
Getting page https://nexus/repository/pypi-all/simple/numpy/
Looking up "https://nexus/repository/pypi-all/simple/numpy/" in the cache
No cache entry available
Starting new HTTPS connection (1): nexus
"GET /repository/pypi-all/simple/numpy/ HTTP/1.1" 401 0
User for nexus: Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
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:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 75, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "c:\users\user\appdata\local\programs\python\python36\Lib\socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
chunked=chunked)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 352, in _make_request
self._validate_conn(conn)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 831, in _validate_conn
conn.connect()
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 254, in connect
conn = self._new_conn()
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 151, in _new_conn
self, "Failed to establish a new connection: %s" % e)
pip._vendor.requests.packages.urllib3.exceptions.NewConnectionError: <pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003A43400>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\adapters.py", line 423, in send
timeout=timeout
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 640, in urlopen
_stacktrace=sys.exc_info()[2])
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\retry.py", line 287, 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 NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003A43400>:
Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\utils\outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\adapters.py", line 487, in send
raise ConnectionError(e, request=request)
pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003A43400>: Failed to esta
blish a new connection: [Errno 11004] getaddrinfo failed',))
Error: An error occurred while installing numpy!
Exception:
Traceback (most recent call last):
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\sessions.py", line 602, in send
r = dispatch_hook('response', hooks, r, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\_vendor\requests\hooks.py", line 31, in dispatch_hook
_hook_data = hook(hook_data, **kwargs)
File "c:\users\user\.virtualenvs\downloads-a87zm7tz\lib\site-packages\pip\download.py", line 181, in handle_401
username = six.moves.input("User for %s: " % parsed.netloc)
EOFError: EOF when reading a line
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (8 by maintainers)
Top GitHub Comments
out of scope, for now
I stuck with this problem to, I really want to use
pipenv
and I want to declare additional indexes inPipfile
, but I don’t want to store credentials inPipfile
, also I don’t want to configurepip.conf
because it’s not very useful on CI.As possible proposal we can use env variables, something like this:
For now it’s very strange to my mind that we can define additional indexes in
Pipfile
, but we need to go to another place (pip.conf
) to configure credentials. I want to use one place to configure indexes and I don’t want to store credentials inPipfile
because I want to commit this file into my repo…