Hnswlib failure in Livebook

To play around with hnswlib, I created a very simple livebook. However, the livebook fails to load hswlib.
What did I do wrong?

Here is the contents of the livebook, and the output of it:

  {:hnswlib, "~> 0.1.2"},
Resolving Hex dependencies...
Resolution completed in 0.025s
  cc_precompiler 0.1.8
  complex 0.5.0
  elixir_make 0.7.7
  hnswlib 0.1.2
  nx 0.6.2
  telemetry 1.2.1
* Getting hnswlib (Hex package)
* Getting cc_precompiler (Hex package)
* Getting elixir_make (Hex package)
* Getting nx (Hex package)
* Getting complex (Hex package)
* Getting telemetry (Hex package)
===> Analyzing applications...
===> Compiling telemetry
==> complex
Compiling 2 files (.ex)
Generated complex app
==> nx
Compiling 32 files (.ex)
Generated nx app
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> cc_precompiler
Compiling 3 files (.ex)
Generated cc_precompiler app
==> hnswlib
Downloading precompiled NIF to /home/livebook/.cache/hnswlib-nif-2.17-x86_64-linux-gnu-0.1.2.tar.gz
Compiling 4 files (.ex)
Generated hnswlib app
space = :l2
dim = 2
max_elements = 200
{:ok, index} =, dim, max_elements)

** (ErlangError) Erlang error: :not_loaded
    (hnswlib 0.1.2) lib/hnswlib_nif.ex:24: HNSWLib.Nif.index_new/7
    (hnswlib 0.1.2) lib/hnswlib_index.ex:60:
    #cell:amn6iw5hct6ln65iovfz36i6t3qatv72:4: (file)

Hey @androidpdn : ) I think this has to do with the version of glibc that the precompiled binary expects. The last :hnswlib release has been built on latest ubuntu, and therefore it requires a very recent glibc. This has been addressed on :hnswlib main, but not released yet. That said, We’ve just released Livebook v0.11.4 with a newer base image and I think it should work there!

Hi @jonatanklosko , thank you for your help. This explains why hnswlib fails both on Hugging Face livebook and a livebook docker image I downloaded from, while works on a Ubuntu system I installed last weekend.

Finally, got some time to try it. I confirm that the newest livebook docker image from works for hnswlib.
Thanks again @jonatanklosko