1.3. Building the environnement#
1.3.1. Installation with conda and using the “install” script#
Note
Be sure to have conda install on your computer. If not, refer to Conda website to install it.
Note
the conda environment contains all the elements needed to compile fortran tools:
- gcc>=8.3.0
- gfortran>=8.3.0
- netcdf-fortran=4.6.0
Execute the installation script
python install.py
Answer the question on the screen:
Do you want to install conda environment? [y,[n]]: y Do you want to compile fortran tools? y,[n]: y
Note
install.py
automatically uses mamba package if it exists within conda. You can install it
with the command:
conda install -n base --override-channels -c conda-forge mamba
If no error is raised environment installation and compilation were successful. Now you can load your conda environment:
conda activate croco_pyenv
That’s it, you are ready to use the preprocessing tools! Remind to activate this envrironment each time you want to use the preprocessing tools.
1.3.2. Installation with another python package manager (e.g. micromamba)#
Use the environment_tools.yml
file provided in env
micromamba create -f env/environment_tools.yml -c conda-forge
Activate the environment:
micromamba activate croco_pyenv
1.3.3. Fortran tools compilation (if not using the install.py)#
Only if you have not used the install.py
script (first section), or if you have answer no
to the question:
Do you want to compile fortran tools? y,[n]
when using install.py
, you can compile the fortran tools following this procedure.
Activate your python environment:
conda activate croco_pyenv
Or:
micromamba activate croco_pyenv
Note
the croco_pyenv environment contains all the elements needed to compile fortran tools:
- gcc>=8.3.0
- gfortran>=8.3.0
- netcdf-fortran=4.6.0
Launch the Fortran routines compilation:
cd Modules/tools_fort_routines
make clean
make
If successfull you should now have this file in Modules
:
toolsf.cpython-39-x86_64-linux-gnu.so
1.3.4. Common errors#
You might face some errors while trying to compile fortran tools. Here is a list of what have been already encountered by some users and the associated solution.
ifort can raise wn error while compiling. In
Modules/tools_fort_routines/Makedefs
try to add--fcompiler=intelem
inFFLAGS
.ImportError means you have missing librairies. In your terminal do
nf-config --flibs
and check that you have-lnetcdff -lnetcdf
.