Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provided code location is not a loadable module. Did you specify the correct location for the module defining your function? #346

Open
dvmorris opened this issue Sep 30, 2024 · 1 comment
Assignees

Comments

@dvmorris
Copy link

Attempting to follow the python tutorial in README.md in a Google Cloud Shell environment, and I get the following error:

`

Steps to reproduce

main.py

import flask
import functions_framework

@functions_framework.http
def hello(request: flask.Request) -> flask.typing.ResponseReturnValue:
    return "Hello world!"

requirements.txt

functions-framework
flask

cmd

$ pip3 install -r requirements.txt 
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: functions-framework in /home/admin_/.local/lib/python3.10/site-packages (from -r requirements.txt (line 1)) (3.8.1)
Requirement already satisfied: flask in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 2)) (3.0.3)
Requirement already satisfied: click<9.0,>=7.0 in /usr/local/lib/python3.10/dist-packages (from functions-framework->-r requirements.txt (line 1)) (8.1.7)
Requirement already satisfied: cloudevents<2.0.0,>=1.2.0 in /home/admin_/.local/lib/python3.10/site-packages (from functions-framework->-r requirements.txt (line 1)) (1.11.0)
Requirement already satisfied: Werkzeug<4.0.0,>=0.14 in /usr/local/lib/python3.10/dist-packages (from functions-framework->-r requirements.txt (line 1)) (3.0.3)
Requirement already satisfied: watchdog>=1.0.0 in /home/admin_/.local/lib/python3.10/site-packages (from functions-framework->-r requirements.txt (line 1)) (5.0.3)
Requirement already satisfied: gunicorn>=22.0.0 in /home/admin_/.local/lib/python3.10/site-packages (from functions-framework->-r requirements.txt (line 1)) (23.0.0)
Requirement already satisfied: Jinja2>=3.1.2 in /usr/local/lib/python3.10/dist-packages (from flask->-r requirements.txt (line 2)) (3.1.4)
Requirement already satisfied: itsdangerous>=2.1.2 in /usr/local/lib/python3.10/dist-packages (from flask->-r requirements.txt (line 2)) (2.2.0)
Requirement already satisfied: blinker>=1.6.2 in /usr/local/lib/python3.10/dist-packages (from flask->-r requirements.txt (line 2)) (1.8.2)
Requirement already satisfied: deprecation<3.0,>=2.0 in /home/admin_/.local/lib/python3.10/site-packages (from cloudevents<2.0.0,>=1.2.0->functions-framework->-r requirements.txt (line 1)) (2.1.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gunicorn>=22.0.0->functions-framework->-r requirements.txt (line 1)) (24.1)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from Jinja2>=3.1.2->flask->-r requirements.txt (line 2)) (2.1.5)

$ functions-framework --target hello
Provided code location '/home/admin_/functions-framework-test' is not a loadable module.
Did you specify the correct location for the module defining your function?
Could not load the function, shutting down.
@dvmorris
Copy link
Author

This process works fine on my MacOS laptop, so I must be just misunderstanding something about my Cloud Shell environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants