Skip to content
Snippets Groups Projects
Commit bb119c28 authored by François  LAURENT's avatar François LAURENT
Browse files

WSL support

parent 2d7aa76f
No related branches found
No related tags found
1 merge request!18Set of commits to be tagged v0.18.3
Pipeline #131765 passed
......@@ -94,17 +94,21 @@ Alternatively, tags can be similarly *un*assigned at individual time steps or ov
### Using the *scripts/install.sh* script
On macOS and Linux, a [script](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/blob/dev/scripts/install.sh?ref_type=heads) is provided to automate the installation process from source. This script installs LarvaTagger.jl and Julia if missing. It also adds the *larvatagger* command to the user's path variable.
On macOS, Linux and WSL, a [script](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/blob/dev/scripts/install.sh?ref_type=heads) is provided to automate the installation process from source. This script installs LarvaTagger.jl and Julia if missing. It also adds the *larvatagger* command to the user's path variable.
The *scripts/install.sh* script can be run with:
```
/bin/bash -c "$(curl -sSL "https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/dev/scripts/install.sh?ref_type=heads&inline=false")"
```
To install the full LarvaTagger suite (Linux only!), run instead:
To install the full LarvaTagger suite (Linux and WSL only!), run instead:
```
curl -sSL "https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/dev/scripts/install.sh?ref_type=heads&inline=false" | /bin/bash -s -- --with-default-backend
```
In the latter case, the script may install several extra dependencies, but not all of them. In particular, to install Python 3.8, two approaches are supported. If `pyenv` is available, the script will install Python 3.8 using `pyenv`. Otherwise, `python3.8` and `python3.8-venv` will have to be manually installed.
In the latter case, the script may install several extra dependencies, but not all of them.
In particular, Python is required; either 3.8 with `--with-default-backend`, or 3.11 with `--with-backend --experimental`.
If `pyenv` is available, the script will use this tool to install Python.
Otherwise, `python3.8` and `python3.8-venv` may have to be manually installed.
On WSL, the script will attempt to install `pyenv` and Python (tested with Ubuntu 20.04).
This script can also uninstall LarvaTagger (if installed with the same script) with: `curl -sSL "https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/dev/scripts/install.sh?ref_type=heads&inline=false" | /bin/bash -s -- --uninstall` which can be useful for example prior to reinstalling after failure.
......
......@@ -36,35 +36,35 @@ for arg in "$@"; do
fi
done
if ! command -v curl 1>/dev/null 2>&1; then
if command -v brew 1>/dev/null 2>&1; then
if ! command -v curl >/dev/null; then
if command -v brew >/dev/null; then
# macOS users are not given the choice as they usually do not care about freedom
brew install curl
fi
fi
if ! command -v curl 1>/dev/null 2>&1; then
if ! command -v curl >/dev/null; then
echo "Command curl required; aborting"
else
check_brew() {
if [ "`uname`" = "Darwin" ]; then
# macOS
if ! command -v brew 1>/dev/null 2>&1; then
if ! command -v brew >/dev/null; then
echo "Installing Homebrew; admin rights will be requested"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi
}
if ! command -v realpath 1>/dev/null 2>&1; then
if ! command -v realpath >/dev/null; then
# macOS
check_brew
if command -v brew 1>/dev/null 2>&1; then
if command -v brew >/dev/null; then
brew install coreutils
fi
fi
if ! command -v julia 1>/dev/null 2>&1; then
if ! command -v julia >/dev/null; then
if [ -z "$JULIA_INSTALL_ARGS" ]; then
JULIA_INSTALL_ARGS=-y
fi
......@@ -80,21 +80,37 @@ if [ -n "$WITH_BACKEND" ]; then
if [ "`uname`" = "Darwin" ]; then
echo "WARNING: the default tagging backend is not supported by macOS"
fi
if ! command -v python$PYTHON_VERSION 1>/dev/null 2>&1; then
if command -v pyenv 1>/dev/null 2>&1; then
if ! command -v python$PYTHON_VERSION >/dev/null; then
if command -v pyenv >/dev/null; then
[ `pyenv versions | grep $PYTHON_VERSION` ] || pyenv install $PYTHON_VERSION
elif [[ "`uname -r`" =~ "-microsoft-standard-WSL2" ]]; then
echo
echo "INFO: installing pyenv and its dependencies"
echo
if ! [ -d ~/.pyenv ]; then
sudo apt-get update
sudo apt-get install --no-install-recommends curl build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev xz-utils libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev #tk-dev
curl https://pyenv.run | bash
fi
export PATH=~/.pyenv/bin:$PATH
eval "$(~/.pyenv/bin/pyenv init -)"
cat <<"EOF" >>~/.bashrc
command -v pyenv >/dev/null || export PATH=~/.pyenv/bin:$PATH
eval "$(~/.pyenv/bin/pyenv init -)"
EOF
pyenv install $PYTHON_VERSION
else
check_brew
if command -v brew 1>/dev/null 2>&1; then
if command -v brew >/dev/null; then
brew install python@$PYTHON_VERSION
else
echo "WARNING: command python$PYTHON_VERSION not found"
echo "if under Ubuntu, consider running: sudo apt install python$PYTHON_VERSION python${PYTHON_VERSION}-venv"
fi
fi
fi
if ! command -v poetry 1>/dev/null 2>&1; then
if command -v pipx 1>/dev/null 2>&1; then
if ! command -v poetry >/dev/null; then
if command -v pipx >/dev/null; then
pipx install poetry
else
curl -fsSL https://install.python-poetry.org | python3 -
......@@ -140,6 +156,8 @@ EOF
else
activate() {
# pyenv activation is necessary on WSL
command -v pyenv >/dev/null && pyenv local $PYTHON_VERSION
poetry env use $PYTHON_VERSION
}
......@@ -179,7 +197,8 @@ else
fi
# setting JULIA_PROJECT may not be necessary at this point
export JULIA_PROJECT=$(realpath TaggingBackends)
(cd MaggotUBA && activate && (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') && poetry install -v && poetry remove taggingbackends && poetry add ../TaggingBackends)
(cd MaggotUBA && activate && (cat requirements.txt | xargs -I % sh -c 'poetry add "%"' || true) && poetry install -v)
[ -d TaggingBackends ] && (cd MaggotUBA && activate && poetry remove taggingbackends && poetry add ../TaggingBackends)
[ -d MaggotUBA-core ] && (cd MaggotUBA && activate && poetry remove maggotuba-core && poetry add ../MaggotUBA-core)
(cd MaggotUBA && scripts/make_models.jl default)
......@@ -194,7 +213,7 @@ fi
chmod a+x "$BIN_DIR/larvatagger"
if ! command -v larvatagger 1>/dev/null 2>&1; then
if ! command -v larvatagger >/dev/null; then
# ~/.local/bin not in $PATH?
if [ "$SHELL" = "/bin/zsh" ]; then
rcfile=~/.zshrc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment