GoogleCloudPlatform / artifact-registry-python-tools

Apache License 2.0
21 stars 11 forks source link

Cannot setup new virtual environment #45

Open tellett opened 1 year ago

tellett commented 1 year ago

Hi,

This isn't really an issue with this package, but it's likely the first place people are going to go. I'm secretly hoping that there may be a simple change that can be implemented here to mitigate the issue.

The urllib3 migration appears to be in the process of being worked on in google-auth, but when setting up a new virtual environment, pip cannot resolve a version of urllib3 that allows this package to be installed, which breaks our ability to setup new virtual environments, use pre-commit, etc.

How to reproduce (tested on python 3.9.15):

cd /tmp
mkdir foo
cd foo
python -m virtualenv venv
. ./venv/bin/activate
pip install --index-url=https://pypi.org/pypi --isolated --upgrade pip  # I have the artifact registry in my pip.conf
pip install --index-url=https://pypi.org/pypi --isolated  keyrings.google-artifactregistry-auth

The above results in:

... <truncated for brevity> ...
    Collecting google-auth==2.19.1
      Using cached google_auth-2.19.1-py2.py3-none-any.whl (181 kB)
    Collecting keyring
      Using cached keyring-23.13.1-py3-none-any.whl (37 kB)
    Collecting keyrings.google-artifactregistry-auth
      Using cached keyrings.google_artifactregistry_auth-1.1.2-py3-none-any.whl (10 kB)
stderr:
    ERROR: Could not find a version that satisfies the requirement urllib3<2.0 (from google-auth) (from versions: 2.0.2)
    ERROR: No matching distribution found for urllib3<2.0

The resolved versions I know work today (resolved with pip-tools a few weeks ago):

#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    make requirements[-dev,-lint,-gcpauth].txt
#

cachetools==5.3.0
    # via google-auth
certifi==2022.12.7
    # via requests
cffi==1.15.1
    # via cryptography
charset-normalizer==3.1.0
    # via requests
cryptography==40.0.1
    # via secretstorage
google-auth==2.17.1
    # via keyrings-google-artifactregistry-auth
idna==3.4
    # via requests
importlib-metadata==6.1.0
    # via keyring
jaraco-classes==3.2.3
    # via keyring
jeepney==0.8.0
    # via
    #   keyring
    #   secretstorage
keyring==23.13.1
    # via
    #   -r requirements-gcpauth.in
    #   keyrings-google-artifactregistry-auth
keyrings-google-artifactregistry-auth==1.1.2
    # via -r requirements-gcpauth.in
more-itertools==9.1.0
    # via jaraco-classes
pluggy==1.0.0
    # via keyrings-google-artifactregistry-auth
pyasn1==0.4.8
    # via
    #   pyasn1-modules
    #   rsa
pyasn1-modules==0.2.8
    # via google-auth
pycparser==2.21
    # via cffi
requests==2.28.2
    # via keyrings-google-artifactregistry-auth
rsa==4.9
    # via google-auth
secretstorage==3.3.3
    # via keyring
six==1.16.0
    # via google-auth
urllib3==1.26.15
    # via requests
zipp==3.15.0
    # via importlib-metadata
tellett commented 1 year ago

Perhaps relevant: googleapis/google-auth-library-python/pull/1290