How to fix dependency conflicts in a umbrella apps?

Hi everybody, I have an umbrella app that I am trying to execute but when I run mix deps.get I get the following message:

➜ mix deps.get
Resolving Hex dependencies...

Failed to use "telemetry" (version 0.2.0) because
  ecto_sql (version 3.0.3) requires ~> 0.2.0
  phoenix (version 1.5.8) requires ~> 0.4


Failed to use "telemetry" (version 0.3.0) because
  ecto_sql (versions 3.0.4 and 3.0.5) requires ~> 0.3.0
  phoenix (version 1.5.8) requires ~> 0.4

** (Mix) Hex dependency resolution failed, change the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock). If you are unable to resolve the conflicts you can try overriding with {:dependency, "~> 1.0", override: true}

The umbrella has two apps, one is just a standard elixir app and the other is a phoenix web interface.

One way to fix it would be to update ecto_sql to the newest version but I am wondering if it is possible to keep both versions of telemetry isolated from each app?

Hi @itisfilipe :wave: Welcome to the community!

Simply saying umbrella just helps to organize, set boundaries and build “partial” releases that contain only some of the apps in it. But those apps still share the same “mix.lock” file/ same dependency list

If you find yourself in a position where you want to use different configurations in each application for the same dependency or use different dependency versions, then it is likely your codebase has grown beyond what umbrellas can provide.

_from https://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-projects.html#dont-drink-the-kool-aid_

3 Likes

This is much harder with BEAM packages than in most ecosystems that allow parallel installation of multiple versions (like NPM) because packages can create uniquely-named processes at runtime. For instance, telemetry includes a runtime application that starts a supervisor and creates an ETS table. What would having two copies of this library do?

1 Like

Thank you @RudManusachi, I am happy to be part of this community!

Also, thank you for pointing me to that part of the documentation I have missed. I first thought that an umbrella would provide isolation like a container but now I understand that is more like a different architecture to keep the contexts separated.

Thank you @al2o3cr for the explanation of how this would work after compiled, it does make sense that having two of the same can’t work due to how the BEAM nature.