Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'flask_bootstrap'

I'm working on my very very first python program/assignment, I'm new to not just the language but it's also my first time outside of languages like Java, C#, and .Net, so I'm having a difficult time picking it up.

I was given a bunch of example files and am supposed to run them to get a feel for what I need to do, except I get an error: ModuleNotFoundError: No module named 'flask_bootstrap'

I ran my bin/activate successfully and here's a bit of command line:

(p3) C:\Users\ritol\OneDrive\School\Project Files\Project Files\Flask\2f>python weather.py Traceback (most recent call last): File "weather.py", line 2, in from flask_bootstrap import Bootstrap ModuleNotFoundError: No module named 'flask_bootstrap'

(p3) C:\Users\ritol\OneDrive\School\Project Files\Project Files\Flask\2f>bin/activate 'bin' is not recognized as an internal or external command, operable program or batch file.

Here's a list of pip installs I was given to do, and it did them:

Flask==1.1.1
Flask-Bootstrap==3.3.7.1
Flask-Login==0.4.1
flask-marshmallow==0.10.1
Flask-Migrate==2.5.2
Flask-RESTful==0.3.7
Flask-Script==2.0.6
Flask-SQLAlchemy==2.4.0
Flask-Testing==0.7.1
Flask-WTF==0.14.2
itsdangerous==1.1.0
Jinja2==2.10.1

2f/weather.py:

from flask import Flask, render_template
from flask_bootstrap import Bootstrap
app = Flask(__name__)
bootstrap = Bootstrap(app)


@app.route('/')
def index():

etc...

I expect to get it to show something like a previous example did:

 * Serving Flask app "FlaskApp" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 173-453-384
 * Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)

instead I get

Traceback (most recent call last):
  File "weather.py", line 2, in <module>
    from flask_bootstrap import Bootstrap
ModuleNotFoundError: No module named 'flask_bootstrap'
like image 573
Citrus Rain Avatar asked Oct 15 '25 15:10

Citrus Rain


1 Answers

I had the same issue.

deactivate and activate the virtual environment solved it

deactivate
. venv/bin/activate
like image 68
Serve Laurijssen Avatar answered Oct 17 '25 06:10

Serve Laurijssen