Emacs does not find package `emacsql-sqlite3`

Hello, intrepid org-roamers!

I’m trying to up an AWS Debian EC2 instance to keep a (git-managed) copy of my org-roam notes, so that I can use them from my phone (by sshing into the instance from Termux). (I was excited to learn today that running an AWS t3.micro instance full-time only costs about 7.5 dollars per month.)

I’m running into dependency problems. In a nutshell, when I start Emacs I get a Warnings buffer that says:

 ■  Error (use-package): Failed to install emacsql-sqlite3: Package ‘emacsql-sqlite3’ is unavailable
 ■  Error (use-package): Cannot load emacsql-sqlite3
 ■  Warning (initialization): An error occurred while loading ‘/home/admin/.emacs’:

File is missing: Cannot open load file, No such file or directory, emacsql-sqlite3

When I run package-list-packages I can confirm that emacsql-sqlite3 is absent.

I’ve set up Emacs to use these repos, in this priority:

(setq package-archives
      '(("Org"          . "https://orgmode.org/elpa/")
        ("Elpa"         . "https://elpa.gnu.org/packages/")
        ("Melpa Stable" . "https://stable.melpa.org/packages/")
        ("Melpa"        . "https://melpa.org/packages/")))
(setq package-archive-priorities
      '(("Org"          . 20)
        ("Melpa"        . 15)
        ("Melpa Stable" . 10)
        ("Elpa"         . 5)))

The EC2 instance already has emacs, sqlite, gcc and some other stuff installed. In Emacs, I’ve already got these things installed:

  org-roam                       20250111.252   installed
  use-package                    2.4.6          installed
  bind-key                       2.4.1          dependency
  compat                         30.0.2.0       dependency
  dash                           20240510.1327  dependency
  emacsql                        20241201.1551  dependency
  magit-section                  20250109.1854  dependency
  seq                            2.24           dependency

On ChatGPT’s suggestion I even tried explicitly defining the path to sqlite3:

(setq emacsql-sqlite3-executable "/usr/bin/sqlite3")

So I’m stumped. Any ideas?

Thanks for listening,
Jeff

Very quickly to suggest:

  • Remove config that sets your Emacs to use emacsql-sqlite3 — it is not default and I don’t know if this package actually exists or is current now
  • Ensure Emacs version is 29 or higher — you didn’t mention your Emacs version (?)
  • Ensure sqlite is built to (compiled in) your Emacs (there are a couple of posts in this forum, which a search should find, I think)
  • Install emacsql-sqlite-builtin (is it not automatic?)

Hi, I think emacsql-sqlite3 is a separate package to emacsql. Also if we see the documentation to the variable org-roam-database-connector we see the following

For the time being `sqlite3' is also supported.  Do not use this.
This uses the third-party `emacsql-sqlite3' package, which uses
the official `sqlite3' cli tool, which is not intended
to be used like this.  See https://nullprogram.com/blog/2014/02/06/."
  :package-version '(forge . "0.3.0")
  :group 'org-roam
  :type '(choice (const sqlite)
                 (const sqlite-builtin)
                 (const sqlite-module)
                 (const :tag "libsqlite3 (OBSOLETE)" libsqlite3)
                 (const :tag "sqlite3 (BROKEN)" sqlite3)))

Do not install this package since its broken.

As @nobiot suggested compile emacs with sqlite builtin - this requires OS level dependencies to be satisfied. In debian for example the relevant dependency is libsqlite3-dev, I think if you have sqlite3 installed - it should work too, but I am not sure currently.

Remove all references to this package. Let know if the problem was solved successfully.
Best.

It works! Thanks, @nobiot and @akashp!

The org-roam manual (Org-roam User Manual) includes a lot of mentions of emacsql-sqlite, and some even of emacsql-sqlite3. Does that need changing? Also, in section 6.1 (“How to cache”) sqlite-builtin is mentioned last, after emacsql-sqlite3. Perhaps it should be first?

I only had to remove all mentions of sqlite3, and change the connector line to (setq org-roam-database-connector 'sqlite-builtin). The standard Snap installation of Emacs worked for me – I didn’t have to build it from scratch.

I’d agree. I am sure the project will welcome your PR if you get round to it.

This is what I expect – Emacs, version 29 and onward, should be built with sqlite by default. And when this is the case, Org-roam defaults to sqlite-builtin (You should not need to set it explicitly).

Also I think emacsql-sqlite is obsolete too.

I tried to use it a few days ago and it wouldn’t compile the required files like it used to, I had to downgrade the enacsql package for it to work.

So in all, most of the information regarding sqlite connectors have become out dated.

This should all be resolved and up-to-date on main now!

2 Likes