Environment variables in Pipfile does not resolve
See original GitHub issueWhen I add a second source in my Pipfile with a private pypi registry, and then try to run pipenv update (or anything else which tries to install from it), I’m getting an error.
I’ve found similar issue, both of which are closed: https://github.com/pypa/pipenv/issues/2351 https://github.com/pypa/pipenv/issues/1906
If I set the username and password as part of the source url directly in the Pipfile it works as expected, also when I create a ~/.netrc file with the machine, login and password.
Expected result
I expect the packages defined in Pipfile to be installed
Actual result
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead.
Running $ pipenv lock then $ pipenv sync.
Locking [dev-packages] dependencies…
Using pip: -i https://pypi.python.org/simple --extra-index-url https://${PYPI_AUTH}@pypi.domain.io/pypi
ROUND 1
Current constraints:
Finding the best candidates:
Finding secondary dependencies:
------------------------------------------------------------
Result of round 1: stable, done
Locking [packages] dependencies…
Using pip: -i https://pypi.python.org/simple --extra-index-url https://${PYPI_AUTH}@pypi.domain.io/pypi
ROUND 1
Current constraints:
privatepackage
Finding the best candidates:
User for pypi.domain.io:
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org
INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.domain.io
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 85, in <module>
main()
File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 74, in main
system=system,
File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 65, in resolve
allow_global=system,
File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 442, in resolve_deps
pre,
File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 352, in actually_resolve_reps
resolved_tree.update(resolver.resolve(max_rounds=PIPENV_MAX_ROUNDS))
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
has_changed, best_matches = self._resolve_one_round()
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 193, in _resolve_one_round
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 193, in <setcomp>
best_matches = {self.get_best_match(ireq) for ireq in constraints}
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/resolver.py", line 257, in get_best_match
best_match = self.repository.find_best_match(ireq, prereleases=self.prereleases)
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 157, in find_best_match
all_candidates = self.find_all_candidates(ireq.name)
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 142, in find_all_candidates
candidates = self.finder.find_all_candidates(req_name)
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/index.py", line 456, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/index.py", line 606, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/index.py", line 723, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/index.py", line 832, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/requests/sessions.py", line 602, in send
r = dispatch_hook('response', hooks, r, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/requests/hooks.py", line 31, in dispatch_hook
_hook_data = hook(hook_data, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/download.py", line 181, in handle_401
username = six.moves.input("User for %s: " % parsed.netloc)
EOFError: EOF when reading a line
When possible, provide the verbose output (--verbose
), especially for locking and dependencies resolving issues.
Steps to replicate
Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "https://${PYPI_AUTH}@pypi.domain.io/pypi"
verify_ssl = true
name = "private-pypi"
[packages]
privatepackage = {version = "*", index = "private-pypi"}
[requires]
python_version = "3.6"
Command
env PYPI_AUTH="user:password" pipenv update
[Edit]: Updated Pipfile to fix spelling error.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Don’t mind netrc, that was merely a distraction of mine it seems. My problem is that pipenv does not read env variables as expected.
So I got around doing as suggested and updated pipenv version, and did a few tests to see where this started working.
Fedora 28, Python 3.6.5, pip 9.0.3: 11.10.0: Failed 11.10.1, 11.10.2, 11.10.3, 11.10.4, 2018.5.18, 2018.6.25, 2018.7.1: Working
Shame on me that I did not update to newest version before testing.
It works well in the past couple of releases.