ImportError: cannot import name ’secretmanager‘ from ‚‘ (unknown location)

The following error is rather annoying when dealing with Google Cloud functions.

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. This is likely due to a bug in the user code. Error message: Code in file can't be loaded.
Detailed stack trace:
Traceback (most recent call last):
  File "/env/local/lib/python3.7/site-packages/google/cloud/functions/", line 359, in check_or_load_user_function
  File "/env/local/lib/python3.7/site-packages/google/cloud/functions/", line 236, in load_user_function
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/user_code/", line 4, in <module>
    from import secretmanager
ImportError: cannot import name 'secretmanager' from '' (unknown location)

The solution to that is to place a requirements.txt in your project with:


Further read: