Skip to content

Installing Python 3.9.8 with custom protected source fails #4856

Closed

Description

@mskrip

Issue description

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

Activity

  1. frostming commented on Nov 10, 2021

    @frostming
    Contributor

    Try this https://aws:${TOKEN}@....
    Also the token should be percent-encoded.

  2. mskrip commented on Nov 10, 2021

    @mskrip
    Author

    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' .

    But as I mentioned this works with Python 3.9.7

  3. frostming commented on Nov 10, 2021

    @frostming
    Contributor

    Can you provide the full error traceback? What version of Pipenv are you using?

  4. mskrip commented on Nov 10, 2021

    @mskrip
    Author

    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 :(.

  5. oz123 commented on Nov 11, 2021

    @oz123
    Contributor

    Seems to me that pipenv imports the wrong attrs.
    It should have imported :

    from pipenv.vendor import attrs
    

    Used to be like this before the version bump. Here is the current one:

    .

    Here is the previous version:

    from pipenv.vendor import attr

  6. added a commit that references this issue on Jan 21, 2022
  7. added a commit that references this issue on May 21, 2025
    1524315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions