Install xla on livebook in windows

I want to be able to use exla in a livebook. I want to use the livebook on linux (no problem) and windows.
The question I have is how do I install xla?
From hex/github I know, that I have to install some build tools, compiler, depencies on some older versions…
The package info also states that XLA_BUILD=true has to be set? But where do I set it? How do I make sure, that xla is only compiled on windows and not on linux? I assume have to use xla instead of exla?
I tried:

Mix.install(
  [
    {:nx, "~>0.6.1"},
    {:bumblebee, github: :"elixir-nx/bumblebee"},
    {:explorer,
     git: "https://github.com/elixir-explorer/explorer.git",
     ref: "aef274989ab490b0a392ccd19ec24b286a8cda1c",
     override: true},
    {:kino_vega_lite, "~> 0.1.7"},
    {:httpoison, "~> 1.8"},
    {:xla, "~> 0.5.1", XLA_BUILD: true},
    #{:exla, "~> 0.6.1"},
    {:adbc, "~> 0.1"}
  ],
  config: [
    nx: [default_backend: EXLA.Backend]

  ]
)

With *exla commented out or left in.

When I commented out exla I get the error that nmake is missing. I am pretty sure I installed everything. I installed bazel 6.1.2, I already got python 3.7. I installed mysys2 visual studio build tools 2019 and microsoft viusal C++ 2015-2022 Redistributable X86.

P.S.: Can XLA 0.5.1 do all the things as exla 0.6.1? I assume not.

1 Like

You either need to run that batch file from the build tools that sets up your environment (I can’t remember it’s name… vcvarsall.bat or something like that) before compiling or open the Development Console, which is a shortcut you should have been given when you installed the build tools. There are a few of them.

If you’ve installed a recent version of the build tools on an up to date Windows with Microsoft Terminal they will appear as options in there automatically.

I presume they want you to set XLA_BUILD as an environment variable.

Hey @sehHeiden, EXLA does not support Windows at the moment. You will have a better luck using WSL, though I think then you need to install and use Livebook via CLI from within the WSL.

Thanks @jonatanklosko. I thought you would be able to do so when compiling xla yourself.
Therefore cloned xla and tried to compile it.

But there is no build in the makefile and mix compile and “.\builds\build.sh” is also not the right thing on windows^^

exla relies on xla, but you do need both. The Makefile.win in xla is outdated, so compiling explicitly would fail, but note that exla doesn’t have Makefile.win altogether, because we dropped Windows support quite some time ago as there were issues and it was mostly holding us back. We may revisit native Windows in the future, but for now WSL is the way to go : )

1 Like

Installed everything in wsl2 thanks.

The xla README currently describes the possibility to build from source under Windows. Although I followed the instructions closely and installed the necessary tools, I found out here that it is not currently supported on Windows.

The error message in xla

You can compile XLA locally by setting an environment variable: XLA_BUILD=true

also suggests that building from source is a possibility.

It would be helpful to update the README and error message to provide more clarity and guidance for Windows users, including the better alternative to use WSL.

Hey @steffen.haensch : ) We currently don’t support Windows on EXLA, so the XLA instructions for Windows are not relevant and got outdated. So good call, I updated the README to avoid the confusion (Remove Windows instructions by jonatanklosko · Pull Request #70 · elixir-nx/xla · GitHub).

@jonatanklosko Thank you for considering my comment. Also thanks for the work you put in for the Elixir community.

1 Like