Skip to main content

Error when running ckan.ini init

from flask_debugtoolbar import DebugToolbarExtension
ModuleNotFoundError: No module named 'flask_debugtoolbar'

Activate your CKAN virtual environment, for example:

. /usr/lib/ckan/default/bin/activate

Then check your location is

cd /usr/lib/ckan/default/src


Install flask_debugtoolbar

Need to install flask_debugtoolbar, and do so by executing the command

pip install flask_debugtoolbar --upgrade


Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: flask_debugtoolbar in /home/_ub_admin/.local/lib/python3.8/site-packages (0.11.0)
Collecting flask_debugtoolbar
  Downloading Flask_DebugToolbar-0.13.1-py3-none-any.whl (324 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 324.6/324.6 kB 13.4 MB/s eta 0:00:00
Requirement already satisfied: Flask>=0.8 in /home/_ub_admin/.local/lib/python3.8/site-packages (from flask_debugtoolbar) (1.1.1)
Requirement already satisfied: werkzeug in /home/_ub_admin/.local/lib/python3.8/site-packages (from flask_debugtoolbar) (1.0.0)
Requirement already satisfied: itsdangerous in /home/_ub_admin/.local/lib/python3.8/site-packages (from flask_debugtoolbar) (1.1.0)
Requirement already satisfied: Blinker in /usr/lib/python3/dist-packages (from flask_debugtoolbar) (1.4)
Requirement already satisfied: click>=5.1 in /home/_ub_admin/.local/lib/python3.8/site-packages (from Flask>=0.8->flask_debugtoolbar) (7.1.2)
Requirement already satisfied: Jinja2>=2.10.1 in /usr/lib/python3/dist-packages (from Flask>=0.8->flask_debugtoolbar) (2.10.1)
Installing collected packages: flask_debugtoolbar
  Attempting uninstall: flask_debugtoolbar
    Found existing installation: Flask-DebugToolbar 0.11.0
    Uninstalling Flask-DebugToolbar-0.11.0:
      Successfully uninstalled Flask-DebugToolbar-0.11.0
Successfully installed flask_debugtoolbar-0.13.1


Restart Nginx

sudo service nginx restart

Given your configuration file has the settings for your database, recreate the database tables:

cd /usr/lib/ckan/default/src/ckan
ckan -c /etc/ckan/default/ckan.ini db init

You should now be able to start CKAN in the development web server and have it start up without any problems:

ckan -c /etc/ckan/default/ckan.ini run


Related articles

Andrew Fletcher12 Feb 2023
How to install PHP 8.1 on Ubuntu 20.04
Update Ubuntu 20.04 To begin update the server using the command sudo apt update && sudo apt upgrade -y For more details about this process see How To Update All Packages Linux.   PHP version Check the current PHP version using php -v The response I had...
Andrew Fletcher31 Aug 2022
How do you clear caches on Ubuntu?
At first, I attempted echo 1 > /proc/sys/vm/drop_caches Response -bash: /proc/sys/vm/drop_caches: Permission denied Adding sudo in front of the command was met with the same result.  What about if I execute the shell as root sudo sh -c 'echo 1 >...