Failure compiling sqlite_ecto2

I am trying to create an ecto project based on sqlite, first with sqlite_ecto, which conflicts with ecto ~> 2.0, and now with sqlite_ecto2,
I get to the stage where I am required to do a mix deps.compile sqlite_ecto2

vonhabsi@ac02:~/DevProjects/learnphoenix/customers$ mix deps.compile sqlite_ecto2
==> sqlite_ecto2
Compiling 9 files (.ex)

== Compilation error on file lib/sqlite_db_connection/query.ex ==
** (ArgumentError) DBConnection.Query is not available
    (elixir) lib/protocol.ex:69: Protocol.assert_protocol!/2
    lib/sqlite_db_connection/query.ex:33: (file)
    (elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.

could not compile dependency :sqlite_ecto2, "mix compile" failed. You can recompile this dep
endency with "mix deps.compile sqlite_ecto2", update it with "mix deps.update sqlite_ecto2" 
or clean it with "mix deps.clean sqlite_ecto2"

What is missing here? Could it be something in the erlang configuration. Am I missing some libraries or some build related tools?

PS. What do you do if you don’t have the permissions to add the tags you want?

It seems like sqlite adapter (ecto-2.0 branch as well) for ecto is not compatible with ecto 2.0 [0][1]

If you need a lightweight database, may I suggest you use mnesia? It has an ecto adapter which is compatible with ecto 2.0 [2]. In case you don’t like it, there are other wrappers around mnesia, kvs [3] and amnesia [4]. And finally, you can use mnesia directly via :mnesia module.


1 Like

The real problem here is the cryptic compiler messages. It is hard to tell whether the code itself is not compatible, or there is some additional libraries or configuration missing.

It has to be a standard SQL database as it will interact with other non Elixir programs. If anything I can switch to Postgres. It isn’t that critical now as I am at the learning stage, but it will be good for Ecto 2.0 to work with sqlite. As from this thread - Why would I choose Elixir as a general purpose programming language? - I am trying to use Elixir as a general purpose programming language independently of the Erlang/BEAM ecosystem, and full blown Erlang database systems and SQL server databases are not always appropriate there.

Oh, I see.

Just in case, there are many ways for programs in different languages to interact, for example, through protocols, like thrift [0], or through messaging systems, like zeromq [1].


1 Like

I’m not sure about but the newest has been working great for me with the latest ecto 2.1.4.

If you add {:sqlite_ecto2, "~> 2.0.0-dev.2"} to your deps in mix.exs then run mix deps.get it will pull in the other dependencies automatically (such as ecto, esqlite, sqlitex). Follow that with mix deps.compile and it should compile fine.

There are some caveats listed in the readme for sqlite_ecto2 to be aware of such as compatible Erlang versions, etc.


Absolutely what @tme_317 said, the old sqlite_ecto library is not for ecto2, but rather for ecto1, use the new linked sqlite_ecto2 library and it works fine (it is still in dev but just working on final bugs last I saw, its basically solid and done now). :slight_smile:


I’ve been using {:sqlite_ecto, "~> 1.1"} just fine, got it to work on windows, linux, and mac. What is your build environment? Sqlite requires C compiler or at least the dynamic library installed. I just started building sqlite_ecto2 and it’s stuck at pc (port compiler) for like half an hour now using up 99% CPU :frowning:

Update: this is very odd, mix deps.compile is totally stuck, I went into esqlite folder and ran rebar compile which worked (compiled so something else is wrong. Will look into this later today.

1 Like

Hi @vonH (and everybody), there are two different sqlite_ecto libraries.

The one you’ve linked to is for Ecto version 1.x and appears to be no longer maintained. (There have been no commits in over a year now.)

I started a new project to updated this to Ecto version 2.x and which is located at This version is in a prerelease state. It’s believed to be correct and working, but hasn’t had enough stress testing for me to call it a proper 2.0 release yet.

If you are still having trouble with compiling sqlite_ecto2, please file an issue on GitHub ( I won’t be able to look at it today, but I should have time over the weekend to follow up. A test repo that demonstrates the problem would be very helpful.


FYI if you look at the Travis CI build settings for sqlite_ecto2 (, you’ll see that I am verifying the build against the following:

  • OTP 18.x and 19.x (except for 19.0.x, which has a known bug affecting Decimal)
  • Elixir 1.3.x and 1.4.x
  • Ecto 2.1.x (I believe but do not actively verify that it’s also compatible with 2.0.x)

Sorry for the confusion. The original question should have referred to your repo (it was a copy and paste error), and I have changed it now.
I couldn’t get the one from to compile after I added to my deps. To be fair I am new to elixir and some of my settings may have been wrong.

I have been able to compile it from github directly and I will test in a project later.


Sounds good. Keep me posted!