viniciuschiele / flask-apscheduler

Adds APScheduler support to Flask
Apache License 2.0
1.12k stars 184 forks source link

ModuleNotFoundError: No module named 'flask_apscheduler' #246

Open securitypedant opened 7 months ago

securitypedant commented 7 months ago

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?

DinoLucca commented 6 months ago

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

Dano-drevo commented 5 months ago

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)'