What I’m trying to do:
I am trying to use anvil-uplink within a Managed Notebook launched from the Vertex AI Workbench within a Google Cloud Project. This setup puts the user in a Jupyter Lab environment. I create a custom computing environment (venv) within which I install various python modules. In particular, I install the earthengine-api, which is maintained by Google folks. I go through standard authentication channels and everything is fine. I realize that I forgot to install the anvil-uplink module. I install it into the environment. I restart the kernel and go through the authentication process again. However, the anvil-uplink module has broken something. I receive this trace:
ERROR: Error initializing plugin EntryPoint(name='Google Auth', value='keyrings.gauth', group='keyring.backends').
Traceback (most recent call last):
File "/home/jupyter/.local/lib/python3.7/site-packages/keyring/backend.py", line 204, in _load_plugins
init_func = ep.load()
File "/opt/conda/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 203, in load
module = import_module(match.group('module'))
File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/conda/lib/python3.7/site-packages/keyrings/gauth.py", line 18, in <module>
from google.auth.transport import requests
ModuleNotFoundError: No module named 'google.auth.transport'; 'google.auth' is not a package
The trace appears to have broken something at the root level (see below).
What I’ve tried and what’s not working:
I tried to rebuild the environment, placing the anvil-uplink installation before the Google module installations, thinking the latter would replace any broken authentication pathways used in anvil-uplink. This didn’t work. Googling suggested that maybe I need to uninstall + reinstall, or otherwise update, the keyring module. I tried adding this to my workflow, prior to the installation of other modules. It didn’t work, but the above trace was thrown at a different location during environment set-up – after/during handling of argparse from within anvil-uplink.
Requirement already satisfied: anvil-uplink in /home/jupyter/.local/lib/python3.7/site-packages (0.4.0)
Requirement already satisfied: six in /opt/conda/lib/python3.7/site-packages (from anvil-uplink) (1.16.0)
Requirement already satisfied: future in /home/jupyter/.local/lib/python3.7/site-packages (from anvil-uplink) (0.18.2)
Requirement already satisfied: ws4py in /home/jupyter/.local/lib/python3.7/site-packages (from anvil-uplink) (0.5.1)
Requirement already satisfied: argparse in /home/jupyter/.local/lib/python3.7/site-packages (from anvil-uplink) (1.4.0)
ERROR: Error initializing plugin EntryPoint(name='Google Auth', value='keyrings.gauth', group='keyring.backends').
Traceback (most recent call last):
File "/home/jupyter/.local/lib/python3.7/site-packages/keyring/backend.py", line 204, in _load_plugins
init_func = ep.load()
File "/opt/conda/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 203, in load
module = import_module(match.group('module'))
File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/conda/lib/python3.7/site-packages/keyrings/gauth.py", line 18, in <module>
from google.auth.transport import requests
ModuleNotFoundError: No module named 'google.auth.transport'; 'google.auth' is not a package
I tried reinstalling google-auth, but it didn’t work.
I would have thought that creating a new environment would have resolved the issue, but it appears that the keyring module is accessed from the global root. Even if I try to update it there, I receive the error. In addition, if I subsequently try to create another new environment, but I remove the installation of anvil-uplink, the same error appears during installation of pycparser. And so, to “fix” this, I end up having to rebuild the entire virtual machine.
I don’t really understand what’s happening (too novice). Could anyone offer me some guidance on where to look for the issue, or otherwise how to structure my environment set-up to avoid whatever conflict is happening? I recognize that my particular setup, within Vertex AI, makes this challenging to debug, but any suggestions would be appreciated.
Thanks!