Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error launching the examples using Python 3.12 #2413

Closed
eharvey71 opened this issue Feb 21, 2024 · 7 comments
Closed

Error launching the examples using Python 3.12 #2413

eharvey71 opened this issue Feb 21, 2024 · 7 comments
Labels
dependencies Pull requests that update a dependency file fixed-in-next-release

Comments

@eharvey71
Copy link

I followed the instructions for cloning the repo and running the examples in my local environment. I'm using the latest stable python (3.12). I'm getting this error when attempting to launch run_server.py in examples:

ImportError: cannot import name '_request_ctx_stack' from 'flask' (/Users/project/dev/flask-admin/venv/lib/python3.12/site-packages/flask/__init__.py)

What do I need to do differently? I'm sensing that I need to be on Python 2, based on some of what I'm reading but the requirements aren't clear. I saw somewhere that Python 3.6 or higher is being worked on? Please be clear in your docs about minimum requirements, if this is the problem.

@akgnah
Copy link

akgnah commented Feb 24, 2024

Example sqla relies on an older project Flask-BabelEx, which relies on a feature _request_ctx_stack that was removed in Flask v2.3.

If you want to see the effect of examplesqla, you can change the Flask version in examples/sqla/requirements.txt first, and then run pip install -r examples/sqla/requirements.txt

$ cat examples/sqla/requirements.txt 
Flask<2.3.0
Flask-Admin
Flask-BabelEx
Flask-SQLAlchemy
tablib
enum34; python_version < '3.0'
sqlalchemy_utils
arrow
colour
email_validator

# note: for local development, replace 'Flask-Admin' above with a reference to
# your local copy of the repo e.g. '-e .' if you're installing this from the
# repo's root directory
$

@wathika-eng
Copy link

Same error @samuelhwilliams

image

Fixed with downgrading to flask==2.2.5 and pip install pytz

@samuelhwilliams
Copy link
Contributor

I'm working on a v2.0.0 release currently that brings Python 3.12 support and moves (back) to using Flask-Babel, which should address these issues.

For reference the issue here is more about Flask-BabelEx than about Flask-Admin strictly, but I appreciate that the current examples in Flask-Admin use BabelEx, so can be confusing.

This should be resolved with the next release.

@adjoli
Copy link

adjoli commented Aug 29, 2024

When trying to install the dependencies, the following error occurs:

ERROR: Directory '../..[sqlalchemy-with-utils,export,translation]' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

apparently pip install is not recognizing the requirements.txt syntax. I personally didn't know this way of representing dependencies, referring to the contents of the pyproject.toml file, instead of a plain list on requirements.txt

@samuelhwilliams
Copy link
Contributor

Yeah I may need to update these - they expect you to be inside the example directory, but I think most of the example readmes tell you to install from the root flask_admin directory. Will try and get this updated. In the mean time - try installing from inside the specific example's dir?

@adjoli
Copy link

adjoli commented Aug 29, 2024

It worked! thanks.

@samuelhwilliams
Copy link
Contributor

I updated all of the examples - hopefully this is clearer now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file fixed-in-next-release
Development

No branches or pull requests

5 participants