Error trying to determine erlang version enoent when running Benchee in Livebook

I was trying to run Benchee in Livebook, was getting Error trying to determine erlang version enoent. Works fine in console. Anyone had this?

Benchee 1.1.0
Livebook 0.9
Elixir 1.14.2
Erlang 25.2
Macos 12.6.3

Logs:

23:26:07.968 [error] GenServer #PID<0.258.0> terminating
** (FunctionClauseError) no function clause matching in String.graphemes/1
    (elixir 1.14.2) lib/string.ex:1902: String.graphemes(:ok)
    (benchee 1.1.0) lib/benchee/utility/erlang_version.ex:100: Benchee.Utility.ErlangVersion.parse_erlang_version/1
    (benchee 1.1.0) lib/benchee/utility/erlang_version.ex:84: Benchee.Utility.ErlangVersion.includes_fixes_from?/2
    (benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:60: Benchee.Benchmark.RepeatedMeasurement.determine_resolution_adjustment/2
    (benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:42: Benchee.Benchmark.RepeatedMeasurement.determine_n_times/5
    (benchee 1.1.0) lib/benchee/benchmark/runner.ex:226: Benchee.Benchmark.Runner.measure_runtimes/4
    (benchee 1.1.0) lib/benchee/benchmark/runner.ex:102: Benchee.Benchmark.Runner.measure_scenario/2
    (elixir 1.14.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
Last message: {:DOWN, #Reference<0.447263386.2991587331.105744>, :process, #PID<0.257.0>, {:function_clause, [{String, :graphemes, [:ok], [file: 'lib/string.ex', line: 1902]}, {Benchee.Utility.ErlangVersion, :parse_erlang_version, 1, [file: 'lib/benchee/utility/erlang_version.ex', line: 100]}, {Benchee.Utility.ErlangVersion, :includes_fixes_from?, 2, [file: 'lib/benchee/utility/erlang_version.ex', line: 84]}, {Benchee.Benchmark.RepeatedMeasurement, :determine_resolution_adjustment, 2, [file: 'lib/benchee/benchmark/repeated_measurement.ex', line: 60]}, {Benchee.Benchmark.RepeatedMeasurement, :determine_n_times, 5, [file: 'lib/benchee/benchmark/repeated_measurement.ex', line: 42]}, {Benchee.Benchmark.Runner, :measure_runtimes, 4, [file: 'lib/benchee/benchmark/runner.ex', line: 226]}, {Benchee.Benchmark.Runner, :measure_scenario, 2, [file: 'lib/benchee/benchmark/runner.ex', line: 102]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 89]}]}}
State: %{buffer: ["\e[31m\n23:26:07.967 [error] Task #PID<0.259.0> started from #PID<0.257.0> terminating\n** (FunctionClauseError) no function clause matching in String.graphemes/1\n    (elixir 1.14.2) lib/string.ex:1902: String.graphemes(:ok)\n    (benchee 1.1.0) lib/benchee/utility/erlang_version.ex:100: Benchee.Utility.ErlangVersion.parse_erlang_version/1\n    (benchee 1.1.0) lib/benchee/utility/erlang_version.ex:84: Benchee.Utility.ErlangVersion.includes_fixes_from?/2\n    (benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:60: Benchee.Benchmark.RepeatedMeasurement.determine_resolution_adjustment/2\n    (benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:42: Benchee.Benchmark.RepeatedMeasurement.determine_n_times/5\n    (benchee 1.1.0) lib/benchee/benchmark/runner.ex:226: Benchee.Benchmark.Runner.measure_runtimes/4\n    (benchee 1.1.0) lib/benchee/benchmark/runner.ex:102: Benchee.Benchmark.Runner.measure_scenario/2\n    (elixir 1.14.2) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2\nFunction: #Function<2.21877062/0 in Benchee.Utility.Parallel.map/2>\n    Args: []\n\e[0m", "Benchmarking a ...\n", "Benchmark suite executing with the following configuration:\nwarmup: 2 s\ntime: 5 s\nmemory time: 0 ns\nreduction time: 0 ns\nparallel: 1\ninputs: none specified\nEstimated total run time: 7 s\n\n", "Operating System: macOS\nCPU Information: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz\nNumber of Available Cores: 8\nAvailable memory: 16 GB\nElixir 1.14.2\nErlang ok\n\n", "Error trying to determine erlang version enoent\n"], ebin_path: "/var/folders/3z/cr46pg1x64dby064g5971brm0000gn/T/livebook_runtime/m3mc7n4tfo5rx6gl56rmvbbmtvl5rau3/ebin", encoding: :unicode, evaluator: #PID<0.257.0>, evaluator_monitor: #Reference<0.447263386.2991587331.105744>, file: "#cell:dy6feawyxgmazuduzsh53dl5lertircg", input_cache: %{}, modules_defined: MapSet.new([]), object_tracker: #PID<0.141.0>, ref: "dy6feawyxgmazuduzsh53dl5lertircg", runtime_broadcast_to: #PID<11893.910.0>, send_to: #PID<11893.909.0>, token_count: 0, tracer_info: %Livebook.Runtime.Evaluator.Tracer{modules_used: MapSet.new([Benchee, Kernel, :erlang]), modules_defined: %{}, aliases_used: MapSet.new([Benchee]), aliases_defined: %{}, requires_used: MapSet.new([]), requires_defined: MapSet.new([]), imports_used?: true, imports_defined?: false, undefined_vars: MapSet.new([])}}
1 Like

Can you see your erlang version when running Benchee.System.system(%Benchee.Suite{}) in livebook?

From Livebook

%Benchee.Suite{
  system: %{
    erlang: :ok,

From console:

%Benchee.Suite{
  system: %{
    erlang: "25.2",

delete

Seems to be an issue in this function then (which already has a comment about a workaround for livebook): benchee/system.ex at main · bencheeorg/benchee · GitHub

What happens when you run :erlang.system_info(:otp_release) ?

1 Like
> :erlang.system_info(:otp_release)
'25'

> System.build_info()
%{
  build: "1.14.2 (compiled with Erlang/OTP 25)",
  date: "2022-11-11T11:39:40Z",
  otp_release: "25",
  revision: "0909940",
  version: "1.14.2"
}

By the way, it’s a compiled Livebook App, i don’t know if it carries its own erlang/elixir or uses one from my system

Ah then I’d check if you’re using the latest version of benchee, you may not have one that implements that workaround.

1 Like

Thanks! Seems that patch hasn’t been released yet

1 Like

I have switched to benchee from the master branch, it works in Livebook. Hope they release it.

Thanks @mayel

1 Like