ModuleNotFoundError. import 'flask' could not be found - python

Despite installing all the needed libraries(pandas, flask, sklearn, geopy), I received this error saying all of the libraries cannot be found . I am trying to run a simple flask app.

Related

Can't run the module flask in python

I've been trying to run a code from the internet but I get this error that says:
in
from flask import Flask
ModuleNotFoundError: No module named 'flask'
This is supposed to be a referrence to something i need to work with and i don't know how to fix this as it's not my code.
Here's the link to the code where i got it from:
https://www.geeksforgeeks.org/create-simple-blockchain-using-python/
I just need to run it once so that i could get working on my stuff too.
Edit: i use the basic idle from python btw...
Maybe you dont have flask installed in your dev environment. Do
pip install Flask
or
pip3 install Flask
to install flask

ModuleNotFoundError: No module named 'icalendar' google Cloud

I'm getting "ModuleNotFoundError: No module named 'icalendar' " after running google app deploy on Gcloud, I have installed the icalendar module using pip but to my surprise i'm getting an error when I try to deploy the app. I have spent hours on this your help will be much appreciated.
According to the official documentation :
Specifying Dependencies
Dependencies for Python applications are declared in a standard
requirements.txt
For example:
Flask==0.10.1
icalendar
Therefore I created a requirements.txt and included icalendar module. Then I deploy to App Engine gcloud app deploy and everything worked as expected.
You can follow this tutorial for better understanding the concept:
Quickstart for Python 3 in the App Engine Standard Environment
Pls. check pip list to see if that has been installed properly. If yes, pls. check that import statement in the python terminal.
If that works, then use which python and ensure that it is the same virtual environment where you are installing and running from.

Flask installed in server, but still receiving "no module named flask" error

I'm trying to deploy a small test app to a server, but even though Flask is installed on the server, I'm still getting a "no module named flask" error every time I try to run the app on the server.
This is the error message I get, and the server telling me that Flask is already installed
.
I have looked at some of the other solutions on this site, but I have to admit I am a complete noob and can't even understand what some of those solutions mean. There are some mentions of the path files being wrong, but I'm not sure what that means or how to fix it on the server. Can anyone explain what might have gone wrong and how to fix it?
Try
help('modules')
in Python shell, this will list all the available modules as explained here (follow the steps mentioned in that post's answer)
If it still doesn't resolve your issue, then try uninstalling and reinstalling flask module.
If it still doesn't work, you can try this instead
(or the answers listed below that post.)
Let me know if that works or not.

Cannot find an existing dependency when running a python module from Flask

I have a python module, it works fine, it uses pandas as one of its dependencies.
I added a Flask application in the middle with a rest service which has a service that imports and runs the very same module.
module = importlib.import_module('modules.' + script.module, package=__package__)
Both the python module and the flask app run with the same virtualenv activated, in which pandas is installed.
-BUT- when running this through the flask app, it throws an exception:
ImportError: No module named pandas
Tried to run the module without calling it from Flask and it works just fine...
=== UPDATE ===
I don't know why Flask is running on python 2 even though I'm running it with a virtualenv of python 3 activated.
This is the script I'm using to start my Flask app:
#!/bin/bash
export FLASK_APP=run.py
export FLASK_DEBUG=1
flask run
I'd appreciate any help
Thanks a lot
I've fixed it.
I haven't installed Flask within the virtualenv I was running, so I think that's why Flask was running on a different python version.
So I installed flask on my virtualenv and now it works.

Import Error for Flask-Bcrypt with Google App Engine: ImportError: No module named bcrypt._bcrypt

I am trying to deploy my flask application to Google App Engine. After much toil I've finally been able to upload my libraries but when I use the command dev_appserver.py I always get this error concering Flask-bcrypt:
File "/Users/drubio/Desktop/blackduck_directory/venv/gaenv/flask_bcrypt.py", line 27, in <module>
raise e
ImportError: No module named bcrypt._bcrypt
Has anyone encountered this problem before? I've found these resources regarding flask-bcrypt here Flask-bcrypt for GAE not working and here How to use py-bcrypt with GAE.
From these resources I've learned that FLask-Bcrypt might not be written as a pure python package which it needs to be for GAE to upload and second there is another alternative called py-bcrypt. However while looking at its github page, it seems to be abandonware so I don't want to waste time with that? Are there any suggestions anyone has out there?

Categories

Resources