No module named flask windows

Содержание
  1. ImportError: No module named flask_restful
  2. 4 Answers 4
  3. Flask — WSGI — No module named ‘flask’
  4. 6 Answers 6
  5. Getting Error: ‘No module named flask’ in VSCode even when I have installed flask
  6. 6 Answers 6
  7. error of «ModuleNotFoundError: No module named ‘flask'» when installing #72
  8. Comments
  9. banpie commented Oct 25, 2018
  10. Please follow the guide below
  11. Make sure you are using the latest version: run git pull to update your version from Lyndor directory
  12. Before submitting an issue make sure you have:
  13. What is the purpose of your issue?
  14. If the purpose of this issue is a bug report, or you are not completely sure then provide the full terminal output as follows:
  15. Answer questions related to your Environment which will help in reproducing the issue:
  16. The issue was encountered on: 💻
  17. Login method:
  18. Enter the python version you are using for download. Find your python version by typing in terminal python -V
  19. If the purpose of this issue is a bug report please provide all kinds of example URLs where you encountered issues (replace following example URLs by yours):
  20. Description of your issue, suggested a solution and other information
  21. banpie commented Oct 25, 2018
  22. ankitsejwal commented Oct 25, 2018
  23. banpie commented Oct 26, 2018
  24. arjunhpes commented Apr 14, 2020
  25. ankit3110 commented Aug 6, 2020
  26. ankit3110 commented Aug 6, 2020
  27. ankit3110 commented Aug 6, 2020
  28. ankit3110 commented Aug 6, 2020
  29. saksham1709 commented Sep 6, 2020
  30. ankitsejwal commented Sep 6, 2020
  31. ankit3110 commented Sep 7, 2020
  32. ImportError: No module named flask_wtf
  33. 13 Answers 13

ImportError: No module named flask_restful

I am trying to deploy appengine flex python app but getting the following in Stackdriver log stderr after deployment

entry_point.py in line 5 has

And my requirement.txt has

Not sure why its still complaining about Flask-Restful

4 Answers 4

Imports are case sensitive on certain platforms, namely Linux (Windows and Mac may or may not care about case). The package Flask-RESTful isn’t all lowercase like most packages (as per PEP 8 recommendation), so import flask_restful as restful will yield an import error unless the proper case is used.

ImportError: No module named flask_restful

Seems that you don’t have flask_restful installed, to install run:

in your Terminal and then run your app.

I had the same problem. I was running my app using the «Play» button of Visual Studio Code and was stuck. Everything was already installed. After a while I realized that I had to use the console of the IDE and start the program from there:

I was running it under a Virtual Environment

basically your project root directory is not matching with your python root directory for this specific (flask_restful) package,,

uninstall python application and reinstall it on window programs files, you should install python in your window programs not separately

i resolved it by this procedure (happy coding)

Flask — WSGI — No module named ‘flask’

I’ve been following Sentdex’ Flask tutorial. He’s using a Venv to set up his Flask, but didn’t set his Python up to work with a Venv. I’ve tried installing Flask globally — yet it still doesn’t work. Trying to browse to the server returns a 500 Internal Server Error

Читайте также:  Драйвер для регулировки яркости для ноутбука windows 10

I’m getting the usual no module named flask error.

errorFGL.log

__init__.py

flaskapp.wsgi

fgl-database.conf

6 Answers 6

As is polite behaviour when finding the solution, I googled around a bit more, and somehow managed to find a solution from a YouTube commment by Nathan Nichols here:

    Edit /etc/apache2/sites-available/FlaskApp.conf

Add the following two lines before the «WSGIScriptAlias» line:

  • Restart Apache with «service apache2 restart»
  • I of course replaced the Python version with python3.5, which is what I’m running.

    I wasted about 25 minutes finding a solution to this and after following all the other resources I could find, I also did the following:

    Make sure to have ‘-py3’ at the end of libapache2-mod-wsgi-py3 or the runtime will default to Python2.7

    First install python-virtualenv

    Then from the Flask app directory where you put the wigs python files run

    This will create env directory inside the Flask directory and contains the local python installation.

    Next activate the virtual environment by this command source env/bin/activate

    After activating the virtual environment run pip install flask

    Run pip —version

    You will see something like this

    pip 19.0.3 from /var/www/html/flaskapp/env/local/lib/python2.7/site-packages/pip (python 2.7)

    Copy this python path

    Add above lines in FlaskApp.conf in sites-available directory of apache

    Note put python-path what you get after running pip —version

    Getting Error: ‘No module named flask’ in VSCode even when I have installed flask

    I want to debug an application using Python and Flask in VSCode. I have installed Flask and the app runs perfectly fine through cmd. But, when I try to debug it through VSCode, it gives the following error:

    Can you please help me.

    6 Answers 6

    Sometimes you can get this error if you loaded Flask into a folder which has sub-files. For instance, if you loaded flask into the parent folder with the virtual shell instance but you’re running your code in the child file (let’s say parent is called crypto_files and inside that is a python source code file called blockchain.py ), then in order to get flask to run properly you’d have to run the file like this:

    This allows your machine to see Flask running inside crypto_files but also run blockchain.py .

    OR, it’s possibly you could just reload Flask into the sub(child)file. blockchain.py and then you’d run it from within the subfile.

    This complication is mainly due to modern «virtual instances» and shells which are basically like creating a virtual computer-machine inside your ACTUAL hard machine. Flask does this to avoid running everywhere, and since Flask is modular it allows each of your projects to run different modular configurations of Flask to suit each project precisely. The alternative would be awful: you’d have to load the fattest version of Flask with dozens of add-ons for each project, and so all your git and all your projects would have tons of extra code. Flask is built to be very small at the core to avoid this problem (too verbose!).

    error of «ModuleNotFoundError: No module named ‘flask'» when installing #72

    Comments

    banpie commented Oct 25, 2018

    Please follow the guide below

    • You will be asked some question, please read them carefully
    • Put an x into all the boxes [ ] relevant to your issue (like this: [x] )
    • Use the Preview tab to see what your issue will actually look like
    Читайте также:  Гугл переводчик для windows phone

    Make sure you are using the latest version: run git pull to update your version from Lyndor directory

    Before submitting an issue make sure you have:

    What is the purpose of your issue?

    • Bug report (encountered problems with Lyndor) 🐞
    • Feature request (request for a new functionality) ☝️
    • Question ❓ unable to open the setting page
    • Other

    If the purpose of this issue is a bug report, or you are not completely sure then provide the full terminal output as follows:

    Copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple «`):

    The issue was encountered on: 💻

    Login method:

    • Regular login (username + password)
    • Organization login (cookies.txt)
    • cookies.txt + Library login(for exercise file)

    Enter the python version you are using for download. Find your python version by typing in terminal python -V

    If the purpose of this issue is a bug report please provide all kinds of example URLs where you encountered issues (replace following example URLs by yours):

    Description of your issue, suggested a solution and other information

    Explanation of your issue in arbitrary form goes here. Please make sure the description is worded well enough to be understood. Provide as much context and examples as possible.

    The text was updated successfully, but these errors were encountered:

    banpie commented Oct 25, 2018

    I have tried those:

    ankitsejwal commented Oct 25, 2018

    Hi, @banpie it seems you have both Python 2 and 3 installed in your system. When you are running

    These packages are being installed in python2.7 which comes by default in MacOS
    So you can try

    I use this cool tool to manage several python versions on my machine https://github.com/pyenv/pyenv, you can set a default global python version or a local python version for a project as well.

    banpie commented Oct 26, 2018

    Thanks for your reply. I think I was using python 3.6 before, as I have add those code to the bash_profile file:

    and I also have tried you solution, but got those:

    but, when i use python3 settings/settings.py , it did works.

    arjunhpes commented Apr 14, 2020

    Better to use pip3 for Python3+ version

    Python2 Sysntax : pip install flask
    Python3+ Sysntax : pip3 install flask

    ankit3110 commented Aug 6, 2020

    Hi i am facing an issue over here
    ModuleNotFoundError: No module named ‘flask’

    ankit3110 commented Aug 6, 2020

    I tried evrything
    pip3 install Flask
    Requirement already satisfied: Flask in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (1.1.2)
    Requirement already satisfied: click>=5.1 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (7.1.2)
    Requirement already satisfied: Jinja2>=2.10.1 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (2.11.2)
    Requirement already satisfied: itsdangerous>=0.24 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (1.1.0)
    Requirement already satisfied: Werkzeug>=0.15 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (1.0.1)
    Requirement already satisfied: MarkupSafe>=0.23 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Jinja2>=2.10.1->Flask) (1.1.1)

    Читайте также:  Elan wbf fingerprint sensor драйвер windows 10

    ankit3110 commented Aug 6, 2020

    pip3 install Flask
    Requirement already satisfied: Flask in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (1.1.2)
    Requirement already satisfied: click>=5.1 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (7.1.2)
    Requirement already satisfied: Jinja2>=2.10.1 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (2.11.2)
    Requirement already satisfied: itsdangerous>=0.24 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (1.1.0)
    Requirement already satisfied: Werkzeug>=0.15 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Flask) (1.0.1)
    Requirement already satisfied: MarkupSafe>=0.23 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from Jinja2>=2.10.1->Flask) (1.1.1)

    ankit3110 commented Aug 6, 2020

    pip3 install virtualenv
    Requirement already satisfied: virtualenv in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (20.0.30)
    Requirement already satisfied: filelock =3.0.0 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from virtualenv) (3.0.12)
    Requirement already satisfied: appdirs =1.4.3 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from virtualenv) (1.4.4)
    Requirement already satisfied: distlib =0.3.1 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from virtualenv) (0.3.1)
    Requirement already satisfied: six =1.9.0 in c:\users\ankit kumar\appdata\local\programs\python\python39\lib\site-packages (from virtualenv) (1.15.0)

    saksham1709 commented Sep 6, 2020

    i am having the same issues

    ankitsejwal commented Sep 6, 2020

    Hi guy at what point are you guys getting these errors?
    Please write you input.
    ex:

    ankit3110 commented Sep 7, 2020

    @saksham1709 close all the applications and restart the computer. sometime it doesn’t read the flask.

    ImportError: No module named flask_wtf

    I am getting the error, ImportError: No module named flask_wtf . I tried every possible solution. I installed flask-wrf using —

    $ flask/bin/pip install flask-wtf

    Please help me out with this issue.

    I am sharing my code which shows error:

    13 Answers 13

    I also have same issue. But installing Flask-WTF

    I was able to resolve this issue.

    Ensure you run the virtual environment’s python rather than global python. I resolved this in my windows env through executing:

    rather than just

    Also, make sure that you have installed the modules to the virtual environment rather than globally. Check that the modules exist appropriately — again under windows I checked for the file:

    In my case it worked after I installed it using pip3 instead of just pip. I didn’t look into it enough to find out what was different but I’m seriously thinking of linking pip to pip3 in my venv.

    This is certainly a problem with virtual environment. I had the same problem and managed to get rid of errors with sudo pip install Flask-WTF while my virtual environment was active.

    This solution, however, has got me into another package (email_validator) importing errors, though I was sure everything is installed as it should be. Now, instead of running flask run from terminal, I decided to run the whole application as it, by typing python3 application.py in my app directory, where application.py is my flask app.

    In this way of running application I haven’t come into any errors at all. If you want to run your app like me, be sure to set following conditional at the bottom of your application:

    (This will run your application in debug mode.)

    I’m beginner level developer. It would be really nice for someone more experienced to explain logic behind this.

    Edit: Once I ran my application like this, suddenly I can run it with flask run again, without any errors. Interesting.

    Оцените статью