You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Installing Python 3.9.8 with custom protected source fails #4856
When installing packages with pipenv with custom source protected by credentials fails with Python 3.9.8 (but works with 3.9.7).
Also tried using an older version of pipenv but it didn't work.
Expected result
The packages should install successfully.
Actual result
This is a snipped of logs of the failed installation:
[pipenv.exceptions.InstallError]: Looking in indexes: ***pypi-***.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/
[pipenv.exceptions.InstallError]: WARNING: 401 Error, Credentials not correct for https://pypi-***.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/attrs/
[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement attrs==21.2.0 (from versions: none)
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for attrs==21.2.0
Steps to replicate
Install Python 3.9.8 (default now for Github Actions Python version 3.9)
Configure custom source with credentials
run $ pipenv install
Not posting pipenv --support because it's the same as running on Github Actions on ubuntu-latest with Python 3.9, this might be the only relevant part of Pipfile:
[[source]]
name = "repo"
url = "https://aws:'${TOKEN}'@pypi-****.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/"
verify_ssl = true
The token is a JWT token created by aws codeartifact, so there are no percent-encodable characters. And without the apostrophes I get an ImportError: cannot import name 'project' from 'pipenv.core' .
It's the latest version of Pipenv 2021.11.09, here is a full traceback of replicating this in docker and trying to install requests
Installing requests...
Installing package: requests
Writing supplied requirement line to temporary file: 'requests'
Installing 'requests'
⠹ Installing requests...$ /root/.local/share/virtualenvs/root-BuDEOXnJ/bin/python -m pip install --pre --verbose --upgrade --exists-action=i -r /tmp/pipenv-nnx65vbj-requirements/pipenv-7eq0otob-requirement.txt -i 'https://aws:'"'"'<token>'"'"'@pypi-****.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/'
Using source directory: '/root/.local/share/virtualenvs/root-BuDEOXnJ/src'
Error: An error occurred while installing requests!
Error text: Using pip 21.3.1 from /root/.local/share/virtualenvs/root-BuDEOXnJ/lib/python3.9/site-packages/pip (python 3.9)
Looking in indexes: https://aws:****@pypi-****.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/
WARNING: 401 Error, Credentials not correct for https://pypi-****.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/requests/
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
Using pip 21.3.1 from /root/.local/share/virtualenvs/root-BuDEOXnJ/lib/python3.9/site-packages/pip (python 3.9)
Looking in indexes: https://aws:****@pypi-****.d.codeartifact.eu-west-1.amazonaws.com/pypi/<repo>/simple/
✘ Installation Failed
I can see the token is escaped very weirdly, so I tried your suggestion from above again (removing apostrophes) and after relocking the project it worked (but I can't get it to install on CI since I hit #4855).
So that's another workaround, but IMO it's still a bug since pipenv documentation suggests using the apostrophes which does not seem to work now :(.
Activity
frostming commentedon Nov 10, 2021
Try this
https://aws:${TOKEN}@....Also the token should be percent-encoded.
mskrip commentedon Nov 10, 2021
The token is a JWT token created by
aws codeartifact, so there are no percent-encodable characters. And without the apostrophes I get anImportError: cannot import name 'project' from 'pipenv.core'.But as I mentioned this works with Python 3.9.7
frostming commentedon Nov 10, 2021
Can you provide the full error traceback? What version of Pipenv are you using?
mskrip commentedon Nov 10, 2021
It's the latest version of Pipenv 2021.11.09, here is a full traceback of replicating this in docker and trying to install
requestsI can see the token is escaped very weirdly, so I tried your suggestion from above again (removing apostrophes) and after relocking the project it worked (but I can't get it to install on CI since I hit #4855).
So that's another workaround, but IMO it's still a bug since pipenv documentation suggests using the apostrophes which does not seem to work now :(.
oz123 commentedon Nov 11, 2021
Seems to me that pipenv imports the wrong attrs.
It should have imported :
Used to be like this before the version bump. Here is the current one:
pipenv/pipenv/vendor/pythonfinder/models/path.py
Line 10 in 1524315
Here is the previous version:
pipenv/pipenv/vendor/pythonfinder/models/path.py
Line 10 in e218469
py-pipenv: update to 2022.1.8
make the doc more accurate