hundreds-midnight-75494
12/17/2023, 7:16 PMvictorious-lawyer-58417
12/18/2023, 5:25 PMhundreds-midnight-75494
12/18/2023, 5:32 PMGOOGLE_APPLICATION_CREDENTIALS environment variable to the container and mounting the json "key" file as a volume.
from there, using pip in the container "just works", but it seems like metaflow/conda/pip doesn't respect that same flowvictorious-lawyer-58417
12/18/2023, 5:37 PM@pypi and @conda . I opened an issue herevictorious-lawyer-58417
12/18/2023, 5:37 PMbulky-afternoon-92433
12/19/2023, 3:45 PM@pypi : What is happening under the hood upon environment resolving is that we call pip config list and parse it for any index-url and extra-index-url entries. The assumption with the implementation is that for private repositories, the url will contain the required credentials.
This should be simple to verify if you are able to call the pip config list to see what is included in the index-url strings.
In the mean time, the same page lists an option for authenticating with a service account key, which adds auth credentials as part of the url. This should work with the current versions, unless its not an option for your use case.bulky-afternoon-92433
12/19/2023, 3:56 PMhundreds-midnight-75494
12/19/2023, 3:59 PMhundreds-midnight-75494
12/19/2023, 4:00 PMbulky-afternoon-92433
12/19/2023, 4:01 PMdry-beach-38304
12/19/2023, 4:03 PMhundreds-midnight-75494
02/26/2024, 2:18 PMbrainy-truck-72938
03/13/2024, 1:12 PMhundreds-midnight-75494
03/13/2024, 4:21 PMpip.conf and .pyirc files and just let the application default credentials do their magic.
I have tested a pip install from our repo directly from the local environment and it works just fine, but when trying to install the same requirements from within metaflow, the auth doesn't get passed through.brainy-truck-72938
03/18/2024, 8:42 PMfrom there, using pip in the container "just works"In my case i.e. the local setup, I still have to do the following i.e. pass
--extra-index-url .
This is irrespective of if I use GOOGLE_APPLICATION_CREDENTIALS or not.
This is because I am not using any .pypirc file and the output for pip config list is empty for me..
Thus, I always need --extra-index-url , both with and without GOOGLE_APPLICATION_CREDENTIALS
How does your docker container get to know about the --extra-index-url / address of the repository...brainy-truck-72938
03/18/2024, 8:43 PMpip.conf or perhaps .pypirc , just that it doesn't have the creds, but it does have the repo URL, is it?hundreds-midnight-75494
03/18/2024, 8:45 PMpip.conf as well as .pypirc and if we do not pass in the credentials, it just works with ADC locally, but when it is time to run on the cluster, it doesn't "pass through"hundreds-midnight-75494
03/18/2024, 8:46 PMbrainy-truck-72938
03/18/2024, 8:47 PMpip.conf / .pypirc where the repo URL is kinda fetched from
AND
you use GOOGLE_APPLICATION_CREDENTIALS which has the file (mounted)
so it is using both, correct?hundreds-midnight-75494
03/18/2024, 8:47 PMbrainy-truck-72938
03/18/2024, 8:48 PMflow.py looks like? not the business logic, only the usage of these decorators and stuff..hundreds-midnight-75494
03/18/2024, 8:48 PMbrainy-truck-72938
03/18/2024, 8:49 PMGOOGLE_APPLICATION_CREDENTIALS , pointing to the mounted file?hundreds-midnight-75494
03/18/2024, 8:49 PMbrainy-truck-72938
03/18/2024, 8:49 PMflow.py looks, that could help a bit...hundreds-midnight-75494
03/18/2024, 8:57 PM@pypi_base(
packages={
'google-cloud-bigquery': '3.11.4',
'google-cloud-logging': '3.8.0',
'google-cloud-storage': '2.12.0',
'dynaconf': '3.2.3',
'gcsfs': '2023.9.2',
'pandas': '2.1.1',
'pandas-gbq': '0.19.2',
'prophet': '1.1.1',
'holidays': '0.18.0',
'internalpackagename1': '1.9.0',
'internalpackagename2': '0.1.16',
'internalpackagename3': '0.1.46',
},
python="3.9",
)
the relevant part would be this , I replaced the names of the packages by internalpackagename1-2-3 but you get the idea 🙂brainy-truck-72938
03/18/2024, 8:58 PMhundreds-midnight-75494
03/18/2024, 9:00 PM.pypirc and pip.conf, it works flawlessly across the board, but if we remove the credential part, it will only work for local flow runs, not remote onesbrainy-truck-72938
03/18/2024, 9:02 PMGOOGLE_APPLICATION_CREDENTIALS
• mount the file
further, you run remote runs on kubernetes / argo-workflows / batch, etc.?brainy-truck-72938
03/18/2024, 9:02 PMbrainy-truck-72938
03/18/2024, 9:07 PMkeyrings.google-artifactregistry-auth in your list of packages in the pypi_base decorator and let me know if that works? @hundreds-midnight-75494hundreds-midnight-75494
03/18/2024, 9:09 PMbrainy-truck-72938
03/18/2024, 9:10 PMkeyrings.google-artifactregistry-auth in one of my conda environments, and thus, even using GOOGLE_APPLICATION_CREDENTIALS was failing..brainy-truck-72938
03/18/2024, 9:11 PMkeyring and keyrings.google-artifactregistry-auth just for a sanity check firsthundreds-midnight-75494
03/18/2024, 9:11 PMhundreds-midnight-75494
03/18/2024, 9:11 PMbrainy-truck-72938
03/18/2024, 9:11 PMpypi_basehundreds-midnight-75494
03/18/2024, 9:12 PMbrainy-truck-72938
03/18/2024, 9:13 PMkeyrings.google-artifactregistry-auth
only then, the variable GOOGLE_APPLICATION_CREDENTIALS seems to work...brainy-truck-72938
03/18/2024, 9:20 PMkeyrings.google-artifactregistry-auth installed?brainy-truck-72938
03/19/2024, 3:20 PMhundreds-midnight-75494
03/19/2024, 3:21 PMbrainy-truck-72938
03/19/2024, 3:21 PMhundreds-midnight-75494
03/19/2024, 3:22 PMhundreds-midnight-75494
03/19/2024, 3:22 PMhundreds-midnight-75494
03/19/2024, 3:23 PMbrainy-truck-72938
03/19/2024, 3:23 PMkeyrings.google-artifactregistry-auth is not installedhundreds-midnight-75494
03/19/2024, 3:23 PMhundreds-midnight-75494
03/19/2024, 3:24 PMbrainy-truck-72938
03/19/2024, 3:24 PMkeyrings.google-artifactregistry-auth should be installed first...hundreds-midnight-75494
03/19/2024, 3:24 PMhundreds-midnight-75494
03/19/2024, 3:24 PMbrainy-truck-72938
03/19/2024, 3:25 PMbrainy-truck-72938
03/19/2024, 3:25 PMbrainy-truck-72938
03/19/2024, 3:26 PMkeyrings.google-artifactregistry-auth is not installedbrainy-truck-72938
03/19/2024, 3:26 PMbrainy-truck-72938
03/19/2024, 3:26 PMkeyrings.google-artifactregistry-auth is installed, it works out of the boxbrainy-truck-72938
03/19/2024, 3:27 PMbrainy-truck-72938
03/19/2024, 3:27 PMGOOGLE_APPLICATION_CREDENTIALS=~/Desktop/outerbounds/mf-af-gcp-exploration-f72606b8ba0c.json pip install swagger-petstore-open-api-3-0-client --extra-index-url <https://us-python.pkg.dev/mf-af-gcp-exploration/demo/simple/>hundreds-midnight-75494
03/19/2024, 3:28 PMbrainy-truck-72938
03/19/2024, 3:29 PMkeyrings.google-artifactregistry-auth and keyring should solve ithundreds-midnight-75494
03/19/2024, 3:31 PMbrainy-truck-72938
03/19/2024, 3:32 PMdry-beach-38304
03/19/2024, 4:07 PMhundreds-midnight-75494
03/19/2024, 5:40 PMpip install <privatepackage> works just fine, but running the flow.py doesn't. I think @brainy-truck-72938 is right that it is because the artifactregistry-auth keyring is missing at the time of execution and installing that package from inside the flow would probably solve it.
After a bit more experimentation, it is still failing as it's asking for the authentication for the private repo before even pulling from pypi (see https://stackoverflow.com/questions/67253141/python-pip-priority-order-with-index-url-and-extra-index-url).
Is there a way to cheat this with multiple @pypi decorators for the flow and therefore set up a form of "dependency graph"?hundreds-midnight-75494
03/19/2024, 5:49 PMdry-beach-38304
03/19/2024, 6:00 PM--with kubernetes does not
• inside the flow, you are NOT doing any additional pip install
is that ocrrect?hundreds-midnight-75494
03/19/2024, 6:07 PM.pypirc and pip.conf it fails. However, if I do pip install locally on the computer, it will install the private package without an issue.hundreds-midnight-75494
03/19/2024, 6:08 PMdry-beach-38304
03/19/2024, 6:09 PMdry-beach-38304
03/19/2024, 6:09 PMbrainy-truck-72938
03/19/2024, 6:09 PMkeyrings.google-artifactregistry-auth locally and check that it will STOP workinghundreds-midnight-75494
03/19/2024, 6:10 PMdry-beach-38304
03/19/2024, 6:11 PMkeyrign and keyrings.google-artifactregistry-auth are the two that enable this thing to work and somehow, when using the pypi decoraotr, they are not there and so it is failing.hundreds-midnight-75494
03/19/2024, 6:11 PMhundreds-midnight-75494
03/19/2024, 6:12 PMhundreds-midnight-75494
03/19/2024, 6:12 PMbrainy-truck-72938
03/19/2024, 6:12 PMkeyrings.google-artifactregistry-auth dependency somewhere when using GCPhundreds-midnight-75494
03/19/2024, 6:13 PMdry-beach-38304
03/19/2024, 6:13 PMhundreds-midnight-75494
03/19/2024, 6:19 PMdry-beach-38304
03/19/2024, 6:27 PMMETAFLOW_DEBUG_CONDA=1 and it will give you a lot of details. I’d actually bei nterestered in what it says there if you don’t mind trying it out.hundreds-midnight-75494
03/19/2024, 6:28 PMdry-beach-38304
03/19/2024, 6:28 PMhundreds-midnight-75494
03/19/2024, 6:29 PMhundreds-midnight-75494
03/19/2024, 6:30 PMhundreds-midnight-75494
03/19/2024, 6:30 PMdry-beach-38304
03/19/2024, 6:31 PMdry-beach-38304
03/19/2024, 6:31 PMhundreds-midnight-75494
03/19/2024, 6:31 PM'-i', '<https://us-python.pkg.dev/privaterepo>', '--extra-index-url', '<https://pypi.org/simple>',hundreds-midnight-75494
03/19/2024, 6:31 PMhundreds-midnight-75494
03/19/2024, 6:32 PMdry-beach-38304
03/19/2024, 6:32 PMdry-beach-38304
03/19/2024, 6:33 PMhundreds-midnight-75494
03/19/2024, 6:34 PMhundreds-midnight-75494
03/19/2024, 6:35 PM[global]
index-url = <https://pypi.org/simple>
extra-index-url = <https://us-python.pkg.dev/privaterepo>hundreds-midnight-75494
03/19/2024, 6:35 PMpip.confhundreds-midnight-75494
03/19/2024, 6:36 PM.pypirc is:
[distutils]
index-servers =
general
privaterepo
[general]
repository: <https://pypi.org/simple>
[privaterepo]
repository: <https://us-python.pkg.dev/privaterepo>hundreds-midnight-75494
03/19/2024, 6:39 PMLooking in indexes: <https://us-python.pkg.dev/privaterepo>, <https://us-python.pkg.dev/privaterepo>, <https://pypi.org/simple>
Keyring provider requested: auto
Keyring provider set: subprocess with executable /home/metaflow-user/miniforge-pypy3/bin/keyring
User for us-python.pkg.dev: Collecting keyring==24.3.1
Obtaining dependency information for keyring==24.3.1 from <https://files.pythonhosted.org/packages/7c/23/d557507915181687e4a613e1c8a01583fd6d7cb7590e1f039e357fe3b304/keyring-24.3.1-py3-none-any.whl.metadata>
Using cached keyring-24.3.1-py3-none-any.whl.metadata (20 kB)
User for us-python.pkg.dev: Collecting keyrings.google-artifactregistry-auth-gcloud==1.1.4
Obtaining dependency information for keyrings.google-artifactregistry-auth-gcloud==1.1.4 from <https://files.pythonhosted.org/packages/26/0c/f30848a1d290eda52b8534e8c6409177f5958df0ed5b1d984214fe423cc4/keyrings.google_artifactregistry_auth_gcloud-1.1.4-py3-none-any.whl.metadata>
Using cached keyrings.google_artifactregistry_auth_gcloud-1.1.4-py3-none-any.whl.metadata (4.6 kB)
User for us-python.pkg.dev: Link requires a different Python (3.9.0 not in: '>=3.6, <3.9'): <https://files.pythonhosted.org/packages/d5/ac/dda6bfd193975437575cdf170bb371570a802579e50b1b79d46eb12ea350/google-cloud-bigquery-2.6.2.tar.gz> (from <https://pypi.org/simple/google-cloud-bigquery/>) (requires-python:>=3.6, <3.9)
Link requires a different Python (3.9.0 not in: '>=3.6, <3.9'): <https://files.pythonhosted.org/packages/d9/ac/48b6e72972ae1949774b8bf84935640c1f1a5827780a7160f9b8964bb368/google_cloud_bigquery-2.6.2-py2.py3-none-any.whl> (from <https://pypi.org/simple/google-cloud-bigquery/>) (requires-python:>=3.6, <3.9)
Collecting google-cloud-bigquery==3.11.4
Obtaining dependency information for google-cloud-bigquery==3.11.4 from <https://files.pythonhosted.org/packages/cc/6a/d0ef792288f2fa2cfea80899a82de302b3332dfda41984fe114e2cfbf700/google_cloud_bigquery-3.11.4-py2.py3-none-any.whl.metadata>
Using cached google_cloud_bigquery-3.11.4-py2.py3-none-any.whl.metadata (8.5 kB)
User for us-python.pkg.dev: Collecting google-cloud-logging==3.8
Obtaining dependency information for google-cloud-logging==3.8 from <https://files.pythonhosted.org/packages/b0/90/08669c4471bf9d9cfd51b5533c3b197a2c19f36c65747ee82f522275f9cc/google_cloud_logging-3.8.0-py2.py3-none-any.whl.metadata>
Using cached google_cloud_logging-3.8.0-py2.py3-none-any.whl.metadata (4.8 kB)
User for us-python.pkg.dev: Collecting google-cloud-storage==2.12,>=2.5.0
Obtaining dependency information for google-cloud-storage==2.12,>=2.5.0 from <https://files.pythonhosted.org/packages/68/b8/cb00819641313e67b640857ffff2c5afdcdcfb4940def9f1502bf614a6d9/google_cloud_storage-2.12.0-py2.py3-none-any.whl.metadata>
Using cached google_cloud_storage-2.12.0-py2.py3-none-any.whl.metadata (6.1 kB)
Pretty-printed STDERR:
WARNING: 401 Error, Credentials not correct for <https://us-python.pkg.dev/privaterepo/keyring/>
WARNING: 401 Error, Credentials not correct for <https://us-python.pkg.dev/privaterepo/keyrings-google-artifactregistry-auth-gcloud/>
WARNING: 401 Error, Credentials not correct for <https://us-python.pkg.dev/privaterepo/google-cloud-bigquery/>
WARNING: 401 Error, Credentials not correct for <https://us-python.pkg.dev/privaterepo/google-cloud-logging/>
WARNING: 401 Error, Credentials not correct for <https://us-python.pkg.dev/privaterepo/google-cloud-storage/>hundreds-midnight-75494
03/19/2024, 6:40 PMdry-beach-38304
03/19/2024, 6:48 PMhundreds-midnight-75494
03/19/2024, 6:52 PMhundreds-midnight-75494
03/19/2024, 6:53 PMhundreds-midnight-75494
03/19/2024, 6:55 PMhundreds-midnight-75494
03/19/2024, 6:55 PMdry-beach-38304
03/19/2024, 7:52 PMdry-beach-38304
03/19/2024, 7:52 PMdry-beach-38304
03/19/2024, 7:54 PM/home/metaflow-user/miniforge-pypy3/lib/pypy3.9/site-packages/metaflow_extensions/netflix_ext/plugins/conda/utils.py, you should see a line (around 73) that says _BUILDER_ENVS_PACKAGES. Could you add the two packages there (keyring and the google auth one)?dry-beach-38304
03/19/2024, 7:54 PMdry-beach-38304
03/19/2024, 7:56 PM# We add a few more packages that we need to support building wheels
# Conda typically includes pip but no harm adding it there too
# All packages included are miniscule and have no dependencies.
but if it works, I can see about making this configurable so you can choose to load those other packages if needed.hundreds-midnight-75494
03/19/2024, 8:01 PMbrainy-truck-72938
03/19/2024, 8:03 PMkeyrings.google-artifactregistry-auth , right? irrespective of how we are kinda adding it..hundreds-midnight-75494
03/19/2024, 8:07 PMkeyring and keyrings.google-artifactregistry-auth packages were not part of the flow itself in the first place. My original misconception was that since it was installed locally, metaflow should be able to use it intrinsically. Then after that, it pointed us to the whole prioritization of repos.hundreds-midnight-75494
03/19/2024, 8:08 PMbrainy-truck-72938
03/19/2024, 8:09 PMdry-beach-38304
03/19/2024, 8:10 PMpip … to do the resolution. That environment doesn’t have the required packages to do the auth. The “fix” I mentioned was simply to add those packages to that builder environment and then install it from there.hundreds-midnight-75494
03/19/2024, 8:11 PMdry-beach-38304
03/19/2024, 8:11 PMdry-beach-38304
03/19/2024, 8:12 PMhundreds-midnight-75494
03/19/2024, 8:13 PMhundreds-midnight-75494
03/19/2024, 8:13 PMdry-beach-38304
03/19/2024, 8:14 PMGOOGLE_APPLICATION_CREDENTIALS sufficient to say this is needed)?dry-beach-38304
03/19/2024, 8:14 PMdry-beach-38304
03/19/2024, 8:14 PMMETAFLOW_CONDA_BUILDER_PACKAGES ?hundreds-midnight-75494
03/19/2024, 8:14 PMGOOGLE_APPLICATION_CREDENTIALS , it would be a great indicator.hundreds-midnight-75494
03/19/2024, 8:15 PMMETAFLOW_CONDA_BUILDER_PACKAGES , it would give more flexibility but would be potentially harder to discover for the usersbrainy-truck-72938
03/19/2024, 8:17 PMhundreds-midnight-75494
03/19/2024, 8:24 PMdry-beach-38304
03/26/2024, 9:14 AMhundreds-midnight-75494
03/27/2024, 7:57 PMbrainy-truck-72938
03/27/2024, 8:27 PMhundreds-midnight-75494
03/27/2024, 8:54 PM