Setup the environment¶
To facilitate the installation of software and various libraries, we use the Homebrew package manager.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
A BrewFile is provided on GitHub and contains all the necessary librairies and cask. We have made custom brew recipes for GEANT4, BDSIM and ZGOUBI1. Everything can be installed using the following command:
brew bundle
Once the libraries are installed, you should modify your .zshrc to load directly the sources by adding these lines:
# Geant4
pushd /usr/local/bin >/dev/null; . ./geant4.sh; popd >/dev/null
# Root
pushd /usr/local/bin >/dev/null; . ./thisroot.sh; popd >/dev/null
# BDSIM
pushd /usr/local/bin >/dev/null; . ./bdsim.sh; popd >/dev/null
Python libraries¶
The Python librairies are managed using pyenv with the pyenv-virtualenv plugin:
brew install pyenv
brew install pyenv-virtualenv
A good practice is to never used the "System Python" to install packages. This is why pyenv is used to manage multiple versions of Python with the pyenv-virtualenv plugin. We create a sh file that can installed the python librairies automaticaly. We assume that the Python libraries has been downloaded in the folder $HOME/reps/ULB-Metronu/python_libs. If your computer have a Intel chip, you can use a conda environment with the mkl librairies to speed up computation with numpy. More details are available here. We provide herebelo a script that install all the librairies and add it to the Jupyter kernel.
#!/bin/sh
# Set up pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Install miniconda3
pyenv install miniconda3-latest
python_libs_path=$HOME/reps/ULB-Metronu/python_libs
python_libs=("georges-core" "georges" "zgoubidoo")
for lib in "${python_libs[@]}"
do
cd ${python_libs_path}/${lib}/${lib}-src
pyenv shell miniconda3-latest
conda env create -f environment.yml
ln -s $HOME/.pyenv/versions/miniconda3-latest/envs/${lib} $HOME/.pyenv/versions/${lib}
pyenv shell ${lib}
pip install -I --force-reinstall llvmlite
poetry install --without dev,docs
python -m ipykernel install --user --name ${lib} --display-name '"'${lib}'"'
done
#!/bin/sh
# Set up pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Install miniconda3
pyenv install 3.10.10
python_libs_path=$HOME/reps/ULB-Metronu/python_libs
python_libs=("georges-core" "georges" "zgoubidoo")
for lib in "${python_libs[@]}"
do
cd ${python_libs_path}/${lib}/${lib}-src
pyenv virtualenv 3.10.10 ${lib}
pyenv shell ${lib}
pip install poetry
poetry install --without dev,docs
python -m ipykernel install --user --name ${lib} --display-name '"'${lib}'"'
done
If you encounter any troubles to setup your environment, do not hesitate to contact us.
-
Zgoubi is currently a private repository. If you would like an access, please send an email to C.Hernalsteens or R.Tesse. ↩