Error on running Run.py (No module named 'flask')

Have rerun ‘requirements.txt’ for the python requirements…

I am getting the following upon running ‘run.py’

Traceback (most recent call last):
File “run.py”, line 1, in
from mflix.factory import create_app
File “C:\mflix-python\mflix\factory.py”, line 3, in
from flask import Flask, render_template
ModuleNotFoundError: No module named ‘flask’

Is the virtual environment active?

I reinstall ‘Flask’ and updated the Path variables and this solved my problem…

2 Likes

Can you brief the exact steps followed. I am facing same issue, what environment path did you set?

Thanks in advance

Hi Everyone,

Please make sure you run the below command from the mflix-python directory before running the run.py file:

  mflix-python > pip install -r requirements.txt

Kanika

I ran the avobe mention command but now it showing below error.Could you let me know what I am missing.i.e where the problem is.

Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: ‘c:\programdata\anaconda3\lib\site-packages\flask-1.0.2.dist-info\entry_points.txt’
Consider using the --user option or check the permissions.

Hi @Barun_80164,

Please ensure your user has permission to make changes, if not, then you might consider having virtual environment for the course.

Kanika

Thanks .thats working…
Its running on consle but not in browser while hit http://127.0.0.1:5000/

Please send the screenshot of the Browser page. Also, try after clearing out the cache or from a different browser.

Kanika

image

i am getting this error now when i run python run.py command

Hi @laxmi_51996,

You need to update your .ini file as mentioned in the README. If you have already done, please share the file contents.

Kanika

Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]
SECRET_KEY = L@ks1317MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-7gtsw.mongodb.net/test
[TEST]
SECRET_KEY = L@ks8795MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-7gtsw.mongodb.net/test

Please correct the indentation in your file. It should look like below:

# Ticket: Connection

# Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

# Do not surround the URI with quotes

[PROD]
SECRET_KEY = L@ks1317
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-7gtsw.mongodb.net/test

[TEST]
SECRET_KEY = L@ks8795
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-7gtsw.mongodb.net/test

Kanika

I have cleared the cache also tried different browser still not working.Please see the screen shoot below.


image