Livebook (Mix.Error) Could not find an SCM for dependency

I deployed Livebook with a docker image. (livebook/livebook:0.8.0)

When I try to install any package, I get an error that Hex is not available.

Mix.install([
  {:tesla, "~> 1.5"}
])

Error

Could not find Hex, which is needed to build dependency :tesla
** (Mix.Error) Could not find an SCM for dependency :tesla from Mix.InstallProject
    (mix 1.14.2) lib/mix.ex:513: Mix.raise/2
    (mix 1.14.2) lib/mix/dep/loader.ex:195: Mix.Dep.Loader.with_scm_and_app/4
    (mix 1.14.2) lib/mix/dep/loader.ex:141: Mix.Dep.Loader.to_dep/3
    (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (mix 1.14.2) lib/mix/dep/loader.ex:358: Mix.Dep.Loader.mix_children/2
    (mix 1.14.2) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/0
    (mix 1.14.2) lib/mix/dep/converger.ex:80: Mix.Dep.Converger.all/4
    (mix 1.14.2) lib/mix/dep/converger.ex:74: Mix.Dep.Converger.converge/4

What could be the problem?

For some reason it is not finding Hex, but it should be part of the image.

Yes, I’m wondering what could have caused it. (maybe the volume mounts I did in the past, overwrote some hex installations?)

I went into the container, ran mix local.hex and then the livebook could install packages again.

1 Like

I ran into the same issue.

I ran this docker-compose,

services:
  livebook:
    image: livebook/livebook:latest-cuda11.8
    volumes:
      - ./notebooks:/home/livebook
    ports:
      - 8080:8080
      - 8081:8081
    pull_policy: always

opened LiveBook in my browser, imported the nx bumblebee example notebook, and tried to run the setup cell, but mix and rebar3 could not be found. I attached a shell to the container and ran mix local.hex and mix local.rebar after which the setup cell ran and all dependencies were installed successfully.

I wonder if it is something user specific? Elixir installs those for the current user and maybe Docker is running on a different user than the one who built it?

Good news is that Elixir will automatically install rebar and hex on Mix.install/2 in the next version, so this should no longer happen.

3 Likes