Skip to content

Unable to import flask #1212

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

Closed
zjn0505 opened this issue Nov 10, 2017 · 6 comments
Closed

Unable to import flask #1212

zjn0505 opened this issue Nov 10, 2017 · 6 comments
Assignees

Comments

@zjn0505
Copy link

zjn0505 commented Nov 10, 2017

In which file did you encounter the issue?

/appengine/standard/flask/hello_world/main.py

Did you change the file? If so, how?

no

Describe the issue

Like it is said in the guide, "Flask is bundled into the runtime". I suppose as long as flask is added to libraries in app.yaml, I should be able to import it from main.py. That is what has been implemented after this commit. But I still get ImportError: No module named flask.

I've tested on online console and local env that I can't import flask simply by adding it to app.yaml, and I tested PIL in the same way, which managed to be imported.

@michaelawyu
Copy link
Contributor

michaelawyu commented Nov 14, 2017

Hi @zjn0505 ! If you do not mind me asking, are you running your application directly (python main.py) or with dev_appserver.py (dev_appserver.py app.yaml)?

@zjn0505
Copy link
Author

zjn0505 commented Nov 20, 2017

Hi @michaelawyu, I ran it with dev_appserver.py app.yaml in local terminal and from the cloud console, both failed with ImportError: No module named flask

@michaelawyu
Copy link
Contributor

Hi @zjn0505 , what version of gcloud are you currently using? You can check it by running gcloud --version in the terminal.

@zjn0505
Copy link
Author

zjn0505 commented Nov 20, 2017

Local env is:

Google Cloud SDK 179.0.0
app-engine-go
app-engine-python 1.9.62
bq 2.0.27
core 2017.11.06
gsutil 4.28

Cloud env is:

Google Cloud SDK 179.0.0
alpha 2017.09.15
app-engine-go
app-engine-java 1.9.59
app-engine-php " "
app-engine-python 1.9.62
beta 2017.09.15
bq 2.0.27
cloud-datastore-emulator 1.3.0
core 2017.11.06
datalab 20171003
docker-credential-gcr
gcd-emulator v1beta3-1.0.0
gsutil 4.28
kubectl
pubsub-emulator 2017.09.15

@michaelawyu
Copy link
Contributor

michaelawyu commented Nov 21, 2017

Thanks, @zjn0505 !

Do you have Extra Libraries component for Python installed? It can be installed with

gcloud components install app-engine-python-extras

After installing this extra library you should be able to use built-in flask library without a problem. For more information, refer to this page :)

@zjn0505
Copy link
Author

zjn0505 commented Nov 21, 2017

This is it, thank you.

@zjn0505 zjn0505 closed this as completed Nov 21, 2017
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