You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the functions-framework to develop on my local machine and I have created a python venv for the project. Following is a description of my issue:
I have installed the firebase_admin lib within the venv and I am importing it within the src code.
I am running the command: functions-framework --source ./src/main.py --target main
The above command fails with following error: ModuleNotFoundError: No module named 'firebase_admin'
The above error does not occur if I install the firebase_admin lib outside the venv (global scopte)
Is there a way to specify which python env to use or is always set to the global python scope?
The text was updated successfully, but these errors were encountered:
Hi, sorry you're running into a bit of trouble here. The python functions framework uses pip and your requirements.txt only to manage dependencies (make sure that every package your function depends on is listed in the requirements.txt). See specifying python dependencies for more details on the specifics.
Many users use a venv for local development and add the venv folder to their .gcloudignore to avoid uploading it (and to allow pip to manage dependencies as specified in their requirements.txt) on deploy.
It may be worth converting this to a feature request if there are workflows that you're using with your virtualenv that aren't well supported when using pip on deploy.
I'm not sure if its related, but I was having a similar problem:
# Setup virtual env
$ python3.12 -m venv .venv
$ source .venv/bin/activate
# Install everything in virtual env
$ pip install -r requirements.txt
# Now run
$ functions-framework
...
ModuleNotFoundError: No module named 'google.cloud.logging'
google.cloud.logging is in my requirements.txt, but when I run which functions-framework I was getting /opt/homebrew/bin/functions-framework, not the expected .venv/bin/functions-framework. This explains why it couldn't find the installed dependencies.
On my mac, running rehash fixed this:
$ which functions-framework
/opt/homebrew/bin/functions-framework
$ rehash
$ which functions-framework
..../.venv/bin/functions-framework
I am using the functions-framework to develop on my local machine and I have created a python venv for the project. Following is a description of my issue:
functions-framework --source ./src/main.py --target main
ModuleNotFoundError: No module named 'firebase_admin'
Is there a way to specify which python env to use or is always set to the global python scope?
The text was updated successfully, but these errors were encountered: