elixir-ecto / ecto

A toolkit for data mapping and language integrated query.
https://hexdocs.pm/ecto
Apache License 2.0
6.16k stars 1.43k forks source link

Livebook cannot install Ecto 3.9.x #4038

Closed mcrumm closed 1 year ago

mcrumm commented 1 year ago

Elixir version

1.14.0

Database and Version

n/a

Ecto Versions

3.9.x

Database Adapter and Versions (postgrex, myxql, etc)

n/a

Current behavior

Mix.install/1 fails in a new notebook setup when Ecto v3.9.x is a dependency.

To reproduce, create a new notebook and add ecto, either manually or thru package search:

Mix.install([
  {:ecto, "~> 3.9.0"}
])
==> ecto
Compiling 56 files (.ex)

== Compilation error in file lib/ecto/changeset.ex ==
** (UndefinedFunctionError) function Ecto.Query.Builder.escape_select_aliases/1 is undefined or private
    Ecto.Query.Builder.escape_select_aliases(%{})
    lib/ecto/query/builder/dynamic.ex:16: Ecto.Query.Builder.Dynamic.build/3
    expanding macro: Ecto.Query.dynamic/2
    lib/ecto/changeset.ex:1974: Ecto.Changeset.maybe_exclude_itself/3
    (elixir 1.14.0) expanding macro: Kernel.|>/2
    lib/ecto/changeset.ex:1976: Ecto.Changeset.maybe_exclude_itself/3
    (elixir 1.14.0) expanding macro: Kernel.|>/2
    lib/ecto/changeset.ex:1961: Ecto.Changeset.maybe_exclude_itself/3
could not compile dependency :ecto, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ecto", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"

Press Setup and the following output appears:

** (exit) shutdown: 1
    (mix 1.14.0) lib/mix/tasks/compile.all.ex:78: Mix.Tasks.Compile.All.compile/4
    (mix 1.14.0) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.14.0) lib/mix/tasks/compile.all.ex:33: Mix.Tasks.Compile.All.run/1
    (mix 1.14.0) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.0) lib/mix/tasks/compile.ex:134: Mix.Tasks.Compile.run/1
    (mix 1.14.0) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.0) lib/mix/tasks/deps.compile.ex:174: anonymous fn/2 in Mix.Tasks.Deps.Compile.do_mix/2
    #cell:setup:1: (file)

If this is actually a Livebook problem I will be happy to move this issue over there :)

Expected behavior

Mix.install/1 can install Ecto v3.9.x in a Livebook without error.

greg-rychlewski commented 1 year ago

Does livebook install an older version of Ecto by default? That looks like an out of date Ecto.Query.Builder module wasn't updated when 3.9.x was installed.

josevalim commented 1 year ago

This is a bug in Livebook. We have fixed this in Livebook latest which you can download from the README. :)

mcrumm commented 1 year ago

Fantastic, thanks @josevalim! Next time I'll try that first :)