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

Merge branch 'dev'

parents ca7b4120 3194c73f
No related branches found
No related tags found
No related merge requests found
Pipeline #124981 passed
......@@ -184,7 +184,7 @@ In particular, Python-side *taggingbackends* may call Julia-side *TaggingBackend
The communication between the two language stacks requires Julia package *TaggingBackends* to be manually installed.
Depending on where *TaggingBackends* is installed, a pointer to that location may be needed.
The simplest approach consists in doing so in the main Julia environment.
First, the simplest approach consists in doing so in the main Julia environment.
In this case, you will have to explicitly install *PlanarLarvae* as well, *e.g.*:
```
julia -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/planarlarvae.jl"); Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
......@@ -192,37 +192,33 @@ julia -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/planarlarvae.jl"
This is enough for Python-side *taggingbackends* to find its Julia counterpart.
Another approach we recommend, so that your main Julia environment is not populated by packages you do not need in every circumstances, consists in installing *TaggingBackends* in an existing Julia environment, *e.g.* the one that accommodates the *LarvaTagger* package.
Another approach we recommend, that does not populate your main Julia environment with packages you do not need in every circumstances, consists in installing *TaggingBackends* in an existing Julia environment, *e.g.* the one that accommodates the *LarvaTagger* package.
As a major inconvenience of this approach, the `JULIA_PROJECT` environment variable will have to be set whenever `tagging-backend train` is called.
As a major inconvenience of this approach, the `JULIA_PROJECT` environment variable will have to be set whenever the `tagging-backend` command is called.
The `JULIA_PROJECT` variable should be the absolute path to the directory associated with the environment that accommodates the *TaggingBackends* package.
If for example you have a local copy of the LarvaTagger.jl project, you can install *TaggingBackends* in the associated environment:
```
cd /path/to/LarvaTagger/
cd path/to/LarvaTagger/
julia --project=. -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
export JULIA_PROJECT=$(pwd)
```
The `export` expression will work in Unix-like OSes only. On Windows, the `JULIA_PROJECT` environment variable can be set in the same configuration panel as the user's `Path` variable.
The `export` expression will work on Unix-like OSes only. On Windows, the `JULIA_PROJECT` environment variable can be set in the same configuration panel as the user's `Path` variable, which also simplifies the below steps.
Note also that, with the above `export` expression, the `JULIA_PROJECT` environment variable is set for the running command interpreter, and will have to be set again if the interpreter is closed and started again.
To install a backend, taking MaggotUBA-adapter as an example:
In the following instructions, this environment variable is systematically set right before each command, so that the TaggingBackends Julia package can be found.
To install a backend, taking MaggotUBA-adapter as an example, from the same LarvaTagger directory as mentioned above:
```
git clone --depth 1 --single-branch -b 20230311 https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA
cd MaggotUBA
JULIA_PROJECT=$(pwd) poetry install
JULIA_PROJECT=$(realpath ..) poetry install
```
You can check for message "*PyCall is already installed*" in the output of:
```
JULIA_PROJECT=$(pwd) poetry run python -c 'import julia; julia.install()'
```
Note that, if PyCall is not found, the above command will install it.
However, TaggingBackends still needs to be installed for Python-side *taggingbackends* to successfully call Julia-side *TaggingBackends*.
`$(realpath ..)` returns the canonicalized absolute path of the parent directory (the LarvaTagger directory) where the TaggingBackends package can be found.
So again, the `JULIA_PROJECT` environment variable must be set accordingly every time the `train` command is called, which can also be done assigning the adequate absolute path to the variable on the same line as the command, immediately before the command.
For example, from the backend directory tree, on Unix-like OSes:
Similarly, the `JULIA_PROJECT` environment variable must be set accordingly every time the `tagging-backend` command is called, if not globally set. For example, the `train` switch is called as follows:
```
JULIA_PROJECT=<path> poetry run tagging-backend train
```
......@@ -232,10 +228,10 @@ JULIA_PROJECT=<path> scripts/larvatagger.jl train
```
with `<path>` the absolute path to the Julia project/environment with TaggingBackends installed.
There is a known issue with `JULIA_PROJECT` not being properly propagated on calling `larvatagger.jl`, in the case Julia was installed using juliaup.
Prefer [jill](https://pypi.org/project/jill/) instead of juliaup.
Note also that, on Linux, or macOS with coreutils installed, a relative path can be conveniently turned into an absolute path using the `realpath` command:
As exemplified above, on Linux, or macOS with coreutils installed, a relative path can be conveniently turned into an absolute path using the `realpath` command:
```
JULIA_PROJECT=$(realpath <path>)
```
There is a known issue with `JULIA_PROJECT` not being properly propagated on calling `larvatagger.jl`, in the case Julia was installed using juliaup.
Prefer [jill](https://pypi.org/project/jill/) instead of juliaup.
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