Installing CKAN on Debian issue



I’m trying to install CKAN from source on a Debian 9.5 server with official doc. I ran an issue on this command line:
virtualenv --no-site-packages /usr/lib/ckan/default

OSError: Command /usr/lib/ckan/default/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2.

I didn’t find anything related to this kind of errors …

Any help welcome :slight_smile:


Hi, Sylvain.

Does the user you’re running this command as have write access to the /usr/lib/ckan/default directory?

Did you remember to to change the owner of that directory by running the previous command described in the CKAN documentation on installing from source?

sudo chown `whoami` /usr/lib/ckan/default

(replacing “whoami” by your username)


Hi Herrmann,
I follow CKAN documentation , but it fails…



It’s difficult to help without more information. Are there any more error messages besides that?

The “OSError” made me suspect of a permissions / ownership issue, that’s why I asked if you did remember to take the step to change the owner of the directory by running chown.


May I also suggest you install CKAN using Docker. It’s really simple and easy and you can get CKAN up and running in a few minutes (basically just the download and build time).


Thanks for this idea.

But does it run easily with database(s) located on a remote windows server, and Solr on an another one?

Actually we choose the Ubuntu way. We are facing an issue when tryng to connect from CKAn server to remote Postgres server (network firewall issue I suppose, investigating…)



I believe so. You just have to edit the docker-compose.yml file and change the parameters CKAN_SQLALCHEMY_URL and CKAN_SOLR_URL to point to your remote servers. And disable the local db and solr containers since you won’t need them.


Unfortunately, Docker is not yet in current use here…

After struggling with corporate network issues, I can now connect to remote Postgresql server with psql.

But when I run sudo ckan db init, I got :

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) ERREUR: la colonne user.password n’existe pas

LINE 1: SELECT "user".password AS user_password, "user".id AS user_i…


[SQL: ‘SELECT “user”.password AS user_password, “user”.id AS user_id, “user”.name AS user_name, “user”.fullname AS user_fullname, “user”.email AS user_email, “user”.apikey AS user_apikey, “user”.created AS user_created, “user”.reset_key AS user_reset_key, “user”.about AS user_about, “user”.activity_streams_email_notifications AS user_activity_streams_email_notifications, “user”.sysadmin AS user_sysadmin, “user”.state AS user_state \nFROM “user” \nWHERE “user”.name = %(name_1)s OR “user”.id = %(id_1)s ORDER BY “user”.name \n LIMIT %(param_1)s’] [parameters: {‘name_1’: ‘default’, ‘param_1’: 1, ‘id_1’: ‘default’}]

Searching , I found similar issue:

But it talk about install from source…

Any idea?


More info:
I check db, and 22 tables have been created…


Sorry for so many post:
Table “user” exists but without password column.
I suppose db isn’t really init. What I have to do? Delete all tables an run db init once?


The username and password of your choice must be present in the configuration.

If you are installing from source, follow steps 3 and 4 of setting up the database in CKAN documentation. The password you put into the .ini file (sqlalchemy.url line) must match the one you chose when creating the user in Postgres.

If you are using Docker instead, configure the variable POSTGRES_PASSWORD in the .env file.



It seems that command

sudo ckan db init
Creates migration tables instead of main ckan tables. I don’t understand why…
It’s a fresh install from package. Is there a way to force main tables creation?



Bonjour, Sylvain.

I think you mentioned that you were using an existing database. Perhaps the script detected the existing tables on that database and tried to migrate because of that? Or did you try to create a new database in Postgres?

If the ckan_default database has a faulty schema, you should try creating a new one with the db init command instead of fixing that one. You can check which database CKAN is configured to by looking at the sqlalchemy url line inside the development.ini file. The init command will always read the db configuration from there.

Also note that the command for initializing the database is not sudo ckan db init, as you mentioned. According to section 7. Create database tables in the documentation:

Now that you have a configuration file that has the correct settings for your database, you can create the database tables:

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

You should see Initialising DB: SUCCESS .

By the way, which version of CKAN are you trying to install?



By the way, something else you might want to try is Easy CKAN. It’s a tool for streamlining the install and setup process. It’s not really necessary, but it might be worth a shot since you’re having trouble following the official CKAN documentation.