Ask coding questions

← Back to all posts
Not able to import flask
AbdurrafeyAmir (2)

whenever i try to run from flask import Flask it gives me this error

[SolverProblemError]
Because replit (3.0.0) depends on flask (>=1.1.2,<2.0.0)
 and no versions of replit match >3.0.0,<4.0.0, replit (>=3.0.0,<4.0.0) requires flask (>=1.1.2,<2.0.0).
So, because repl-python3-bot6969 depends on both replit (^3.0.0) and Flask (^2.0.0), version solving failed.
exit status 1


Repl.it: Package operation failed.

i dont know why this happens. I even tried manually installing flask from the package manager.

Answered by xfinnbar (82) [earned 5 cycles]
View Answer
Comments
hotnewtop
xfinnbar (82)

The replit package includes it's own Flask fork, which is conflicting with Flask. Instead of using from flask import Flask use from replit.web import App and use app = App(__name__) instead of app = Flask(__name__). This flask fork adds a few new features like login with replit for your site. See its docs here https://replit-py.readthedocs.io/en/latest/index.html

AbdurrafeyAmir (2)

ok guys it was just a glitch I made a new team and now it is working flawlessly

JWZ6 (654)

is this in python? if it is it may be a glitch but im not very sure

AbdurrafeyAmir (2)

@JWZ6 yes its python and if it is a glitch do u know how to fix it?