ckan / ckan

CKAN is an open-source DMS (data management system) for powering data hubs and data portals. CKAN makes it easy to publish, share and use data. It powers catalog.data.gov, open.canada.ca/data, data.humdata.org among many other sites.

Home Page:https://ckan.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DataPusher: ImportError: cannot import name '_request_ctx_stack' from 'flask'

eemirtekin opened this issue · comments

CKAN version

2.10.3

Describe the bug

I have installed ckan 2.10.3 version on Ubuntu 20.04 LTS. It works successfully, but DataPusher doesn't work correctly. I get error bellow.


uWSGI http bound on 127.0.0.1:8800 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:36543 (port auto-assigned) fd 3
Python version: 3.8.10 (default, Nov 22 2023, 10:22:35)  [GCC 9.4.0]
PEP 405 virtualenv detected: /usr/lib/ckan/datapusher
Set PythonHome to /usr/lib/ckan/datapusher
Python main interpreter initialized at 0x561a2b9d7e40
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 422064 bytes (412 KB) for 4 cores
*** Operational MODE: preforking+threaded ***
spawned uWSGI master process (pid: 13721)
spawned uWSGI worker 1 (pid: 13724, cores: 2)
spawned uWSGI worker 2 (pid: 13725, cores: 2)
spawned uWSGI http 1 (pid: 13726)
Traceback (most recent call last):
  File "/etc/ckan/datapusher/datapusher.wsgi", line 2, in <module>
    import ckanserviceprovider.web as web
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/ckanserviceprovider/web.py", line 13, in <module>
    import flask_login as flogin
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask_login/__init__.py", line 12, in <module>
    from .login_manager import LoginManager
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask_login/login_manager.py", line 5, in <module>
    from flask import _request_ctx_stack
ImportError: cannot import name '_request_ctx_stack' from 'flask' (/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask/__init__.py)
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
Traceback (most recent call last):
  File "/etc/ckan/datapusher/datapusher.wsgi", line 2, in <module>
    import ckanserviceprovider.web as web
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/ckanserviceprovider/web.py", line 13, in <module>
    import flask_login as flogin
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask_login/__init__.py", line 12, in <module>
    from .login_manager import LoginManager
  File "/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask_login/login_manager.py", line 5, in <module>
    from flask import _request_ctx_stack
ImportError: cannot import name '_request_ctx_stack' from 'flask' (/usr/lib/ckan/datapusher/lib/python3.8/site-packages/flask/__init__.py)
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***

Steps to reproduce

Steps to reproduce the behavior:

https://docs.ckan.org/en/2.10/maintaining/installing/install-from-source.html

Hi, I have the same problem on CKAN version 2.9.10, Ubuntu 20.04 LTS, package installation. I get identical error message after the last update when I try to push data to the datastore.
Seems like '_request_ctx_stack' is deprecated since flask version 2.4.
Do I have to change the requirements.txt and set Flask 2.3.3 as the maximum version? Or what is the solution?
Thanks for an answer!

This fixed in datapusher 0.0.21