flask-apscheduler icon indicating copy to clipboard operation
flask-apscheduler copied to clipboard

ModuleNotFoundError: No module named 'flask_apscheduler'

Open securitypedant opened this issue 11 months ago • 2 comments

I have a super simple Flask install, and i've run...

pip install Flask-APScheduler

and my code is simple...

from flask import Flask
from flask_apscheduler import APScheduler

from lib.ux import home

app = Flask(__name__)
# Details on the Secret Key: https://flask.palletsprojects.com/en/1.1.x/config/#SECRET_KEY
# NOTE: The secret key is used to cryptographically-sign the cookies used for storing the session data.
app.secret_key = 'BAD_SECRET_KEY_CHANGE_ME'

# Setup scheduler
scheduler = APScheduler()

# Routes
app.add_url_rule('/', view_func=home)

if __name__ == "__main__":
    app.run()

and when running flask, it throws the error...

ModuleNotFoundError: No module named 'flask_apscheduler'

pip freeze shows...

altgraph @ file:///AppleInternal/Library/BuildRoots/9dd5efe2-7fad-11ee-b588-aa530c46a9ea/Library/Caches/com.apple.xbs/Sources/python3/altgraph-0.17.2-py2.py3-none-any.whl
APScheduler==3.10.4
blinker==1.7.0
click==8.1.7
Flask==3.0.2
Flask-APScheduler==1.13.1
future @ file:///AppleInternal/Library/BuildRoots/9dd5efe2-7fad-11ee-b588-aa530c46a9ea/Library/Caches/com.apple.xbs/Sources/python3/future-0.18.2-py3-none-any.whl
importlib_metadata==7.1.0
itsdangerous==2.1.2
Jinja2==3.1.3
macholib @ file:///AppleInternal/Library/BuildRoots/9dd5efe2-7fad-11ee-b588-aa530c46a9ea/Library/Caches/com.apple.xbs/Sources/python3/macholib-1.15.2-py2.py3-none-any.whl
MarkupSafe==2.1.5
pygame==2.5.2
python-dateutil==2.9.0.post0
pytz==2024.1
six @ file:///AppleInternal/Library/BuildRoots/9dd5efe2-7fad-11ee-b588-aa530c46a9ea/Library/Caches/com.apple.xbs/Sources/python3/six-1.15.0-py2.py3-none-any.whl
tzlocal==5.2
Werkzeug==3.0.1
zipp==3.18.1

Any clues as to why this is failing?

securitypedant avatar Mar 28 '24 04:03 securitypedant

Hi, have you been able to solve this issue ? I have the same problem with both import apscheduler and import flask_apscheduler

DinoLucca avatar May 14 '24 15:05 DinoLucca

Guys, I've just installed the package on my Ubuntu 22.04 for Python 3.8.19 and there is no issue with importing it. What Python version do you use (minimal version is 3.8)?

When you ran python3 -m pip show Flask-APScheduler, where does it say the package is installed? Is the location among the Pythonpath for your Python binary? You can list all the paths by running python3 -c 'import sys;print(sys.path)'

Dano-drevo avatar May 24 '24 14:05 Dano-drevo