Can't import google-cloud-storage
Hello,
I'm using the enterprise version, and I have setup a gcloud resource.
I can't figure out how to import
from google.gloud import storage
that systematically fails, since it doesn't pick up that it needs to install google-cloud-storage
.
I've tried to formally add it at the top of the script using this
What am I doing wrong ? And how can I get it to work ?
Thank you so much for your help12 Replies
#requirements: #google-cloud-storageWhat is the error with ^ is that the name of the library on pypi ?
Yes
so what does it say when it runs your script with that?
raceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/wrapper.py", line 10, in <module>
from u.charles import engrossing_script as inner_script
File "/tmp/u/charles/engrossing_script.py", line 4, in <module>
from google.cloud import storage
ModuleNotFoundError: No module named 'google'
in the install part
(of the logs)
my bad. this error is without the formal import
with the formal import
job=01955b7f-1958-89a1-ed3b-6afd7ea34c59 tag=python3 worker=wk-default-b6wrz-LRQe3 hostname=windmill-workers-796dfcb94c-b6wrz
resolving dependencies...
content of requirements:
google-cloud-storage
env deps from local cache: cachetools==5.5.2, certifi==2025.1.31, charset-normalizer==3.4.1, google-api-core==2.24.1, google-auth==2.38.0, google-cloud-core==2.4.2, google-crc32c==1.6.0, google-resumable-media==2.7.2, googleapis-common-protos==1.68.0, idna==3.10, proto-plus==1.26.0, protobuf==5.29.3, pyasn1==0.6.1, pyasn1-modules==0.4.1, requests==2.32.3, rsa==4.9, urllib3==2.3.0
--- UV PIP INSTALL ---
To be installed:
google-cloud-storage==3.1.0
Starting isolated installation... (20 tasks in parallel)
[1/1] + google-cloud-storage==3.1.0 << (S3) | in 139ms
env set in 150ms
Copying some packages from cache to job_dir...
--- PYTHON (3.11) CODE EXECUTION ---
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/wrapper.py", line 10, in <module>
from u.charles import engrossing_script as inner_script
File "/tmp/u/charles/engrossing_script.py", line 5, in <module>
import wmill
ModuleNotFoundError: No module named 'wmill'
yes so now you need to put all dependencies in there
if you override, you need to put everything explicitely
here wmill is missing
OK, so everything needs to be explicit
great
thanks so much
yw
Continuing in this thread. I'm seeing some weird issue with relative imports.
I have a fucntion living in f/production/helpers/media_helpers.py
Trying to import it using
from f.production.helpers.media_helpers import *
I get
ExecutionErr: exit code for "python run": 1, last log lines:
(
File "/tmp/windmill/cache/py_runtime/cpython-3.11.11-linux-aarch64-gnu/lib/python3.11/importlib/resources/_common.py", line 9, in <module>
from typing import Union, Optional
File "/tmp/windmill/cache/python_311/typing==3.10.0.0/typing.py", line 1359, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/tmp/windmill/cache/python_311/typing==3.10.0.0/typing.py", line 1007, in new
self._abc_registry = extra._abc_registry
^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Callable' has no attribute '_abc_registry'try with wmill==1.473.0
I figured it out there was another mistake thanks for the help