Leela zero install on Ubuntu
-
dsatkas
- Dies in gote
- Posts: 62
- Joined: Sun Oct 09, 2016 4:27 am
- Rank: EGF 5k
- GD Posts: 0
- KGS: 2k
- IGS: 2k
- OGS: 3k
- Has thanked: 56 times
- Been thanked: 7 times
Leela zero install on Ubuntu
Can someone explain how i can install Leela on my Ubuntu? I am basically a moron with Linux and the stuff i've seen on Github seem confusing. Any ideas would be appreciated
-
Revilo
- Dies in gote
- Posts: 37
- Joined: Sun Jul 24, 2016 11:03 pm
- Rank: IGS 9k EGF 6k
- GD Posts: 0
- KGS: Revilo
- IGS: Revilo
- Location: Frankfurt, Germany
- Has thanked: 2 times
- Been thanked: 19 times
- Contact:
Re: Leela zero install on Ubuntu
Well, this is quite a pain in the neck. What eventually worked on my machine was the procedure Example of compiling and running - Ubuntu described here: https://github.com/gcp/leela-zero
In an ideal world, you would excecute these commands in the shell and be done with it. In practice, you are very likely going to run into some issues, like missing dependencies. Also very likely, you will have to create symbolic links in e.g. usr/etc and the like.
So let's walk through the commands one-by-one. I hope the following will help you through this maze.
The tool clinfo is for GPU diagnostics. It is not needed to run LZ as such. However, you can use it to check if you've got the GPU drivers up and running. Execute the command in the shell and pray that your graphic card is listed as one of the available devices in the command output. If it is not, it's time for specific troubleshooting. Most likely, you will have to install a vendor-provided driver for your GPU. There's also a way to compile LZ without GPU support (see later).
With these commands, you will check out the LZ source code from GitHub. The folder leela-zero will be created by the git tool. In contrast to the command given on the LZ GitHub page, the command here will check out the next branch via the option -b next. This is basically a future release candidate. However, it is both faster and also required to use LZ in Lizzie.
Before you execute these commands, create a directory for self-compiled tools in your home directory and navigate into this directory before checking out. This is not necessary as such but will help you find your stuff more easily, like for example when you need to enter the path to LZ in a Go GUI.
You may find that git isn't installed. In this case the error message should point you to the required actions, very likely something like sudo apt install git. Note, that sudo is used to execute a command with super user rights. You will be prompted to enter the root password.
Once you have succeeded in checking out the source code and navigated into the source directory (second command), you're ready for the real fun.
This part of the procedure installs the dependencies. Just hope that you don't run into weird errors, because then it's time for Google, i.e. search Google for the error messages and try to find forum posts describing the remedy. The remedy will usually be something like installing another depencency, editing a configuration file or creating a symbolic link.
Given that the dependencies have been installed properly, this command will build the binary. If you run into errors, some of the remedies mentioned above (symbolic links, configuration file entries...) might help here as well. Before starting over, it's a good idea to do so from scratch by executing the command make clean first.
When the binary has been built successfully, the rest is piece of cake. Navigate to the folder containing the binary and download the current best network weights using wget. That way, the network weights and the binary will be stored in the same folder.
The binary will be called leelaz. It must be executed with the shown command line argument for the weights file. When you configure a Go GUI to use LZ, you might have to prepend the absolute path to the folder where then binary and weight file are located.
EDIT #1:
If you want to build LZ without GPU support, you will have to insert the following line into the file config.h in the directory src.
EDIT #2:
Changed GitHub part to checking out the next branch.
Code: Select all
# Test for OpenCL support & compatibility
sudo apt install clinfo && clinfo
# Clone github repo
git clone https://github.com/gcp/leela-zero
cd leela-zero/src
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev
make
cd ..
wget http://zero.sjeng.org/best-network
src/leelaz --weights best-network
So let's walk through the commands one-by-one. I hope the following will help you through this maze.
Code: Select all
sudo apt install clinfo && clinfoCode: Select all
git clone -b next https://github.com/gcp/leela-zero
cd leela-zero/src
Before you execute these commands, create a directory for self-compiled tools in your home directory and navigate into this directory before checking out. This is not necessary as such but will help you find your stuff more easily, like for example when you need to enter the path to LZ in a Go GUI.
You may find that git isn't installed. In this case the error message should point you to the required actions, very likely something like sudo apt install git. Note, that sudo is used to execute a command with super user rights. You will be prompted to enter the root password.
Once you have succeeded in checking out the source code and navigated into the source directory (second command), you're ready for the real fun.
Code: Select all
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-devCode: Select all
makeCode: Select all
cd ..
wget http://zero.sjeng.org/best-network
Code: Select all
leelaz --weights best-networkEDIT #1:
If you want to build LZ without GPU support, you will have to insert the following line into the file config.h in the directory src.
Code: Select all
#define USE_CPU_ONLYChanged GitHub part to checking out the next branch.
Last edited by Revilo on Sat Sep 08, 2018 1:53 am, edited 1 time in total.
- ez4u
- Oza
- Posts: 2414
- Joined: Wed Feb 23, 2011 10:15 pm
- Rank: Jp 6 dan
- GD Posts: 0
- KGS: ez4u
- Location: Tokyo, Japan
- Has thanked: 2351 times
- Been thanked: 1332 times
Re: Leela zero install on Ubuntu
One point! Whether you want only Leela Zero or LZ plus Lizzie, you should download and compile the "next" branch of LZ. So see the instructions for Lizzie. On my Mint (Ubuntu varient) machine, the old main branch code runs at least 50% slower than "next".
Dave Sigaty
"Short-lived are both the praiser and the praised, and rememberer and the remembered..."
- Marcus Aurelius; Meditations, VIII 21
"Short-lived are both the praiser and the praised, and rememberer and the remembered..."
- Marcus Aurelius; Meditations, VIII 21
-
Revilo
- Dies in gote
- Posts: 37
- Joined: Sun Jul 24, 2016 11:03 pm
- Rank: IGS 9k EGF 6k
- GD Posts: 0
- KGS: Revilo
- IGS: Revilo
- Location: Frankfurt, Germany
- Has thanked: 2 times
- Been thanked: 19 times
- Contact:
Re: Leela zero install on Ubuntu
Good point. I've updated my post.
Maybe this thread could also be moved to or linked to the Computer Go subforum?
Maybe this thread could also be moved to or linked to the Computer Go subforum?
- mycophobia
- Beginner
- Posts: 6
- Joined: Tue Oct 23, 2018 7:23 pm
- GD Posts: 0
- Universal go server handle: Fox: mycophobia
- Has thanked: 12 times
- Been thanked: 5 times
Re: Leela zero install on Ubuntu
For anyone getting weird errors about missing Eigen/Dense in Ubuntu Bionic as I was today, you can symlink /usr/include/eigen3/Eigen to /usr/include/Eigen, like so:
and then hopefully it'll build! :D
Code: Select all
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen-
GeneOntology
- Beginner
- Posts: 1
- Joined: Wed Apr 22, 2020 4:01 am
- GD Posts: 0
Re: Leela zero install on Ubuntu
Hi everyone,
Mycophobia, I'm not sure you will still be here but hope so (18 mounth after your post ^^)
I have this exact same error message
"fatal error: Eigen/Dense: No file or folder of this type
compilation terminated."
and i tried your solution but maybe didn't quite get it right
you mean pasting
While still in the leela-zero/src folder?
right now if i paste this wile in the leela-zero/src folder, I get a message saying
"impossible to create the symbolic link '/usr/include/Eigen': the file exists"
which should be good, if it already exists, but when I paste again the command
I still get the fatal error about "Eigen/Dense: no file or folder of this type"
Have i done something wrong?
Thanks to anyone who can help me
Mycophobia, I'm not sure you will still be here but hope so (18 mounth after your post ^^)
I have this exact same error message
"fatal error: Eigen/Dense: No file or folder of this type
compilation terminated."
and i tried your solution but maybe didn't quite get it right
you mean pasting
Code: Select all
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigenright now if i paste this wile in the leela-zero/src folder, I get a message saying
"impossible to create the symbolic link '/usr/include/Eigen': the file exists"
which should be good, if it already exists, but when I paste again the command
Code: Select all
makeHave i done something wrong?
Thanks to anyone who can help me
-
TheLemon
- Beginner
- Posts: 10
- Joined: Tue Feb 25, 2020 3:50 am
- Rank: Low dan
- GD Posts: 0
- Has thanked: 1 time
- Been thanked: 1 time
Re: Leela zero install on Ubuntu
With the / in /usr the path is absolute so you can invoke it from any folder.GeneOntology wrote: you mean pastingWhile still in the leela-zero/src folder?Code: Select all
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen
"impossible to create the symbolic link '/usr/include/Eigen': the file exists"
What are the contents of /usr/include/Eigen compared to /usr/include/eigen3/Eigen? If both are folders with differing contents I would try various variations like:
Code: Select all
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen/
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen/
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen/DenseThis thread: https://askubuntu.com/questions/543516/ ... ists-error
Suggests --force option, ie try ln -sf
Triangular Go: http://triangulargo.club/