Install watershed-workflow on a fresh Ubuntu 20.04 LTS
Published:
Notes:
- Last updated: Sept. 2023
- IMPORTANT! It’s assumed that ATS has been installed following zhilihydro.github.io/posts/2022/04/blog-post-1/.
- This tutorial mostly follows environmental-modeling-workflows.github.io/watershed-workflow/build/html/install.html and github.com/pinshuai/pinshuai.github.io/blob/master/_posts/2020-06-21-Install-Watershed-Workflow.md, but install SEACAS following github.com/sandialabs/seacas/blob/master/README.md.
- It has been tested in WSL and VirtualBox on a Win 10 machine. Ubuntu 22 also tested. See ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox for how to run Ubuntu on a virtual machine using VirtualBox.
Set up Python environment
note: Again, it’s assumed
miniconda
has been installed. If not, see the ‘how to install ATS instruction’ here: zhilihydro.github.io/posts/2022/04/blog-post-1/
- Install libmamba to make conda faster.
conda update -n base conda
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
- Create a new environment called
watershed_workflow
.
conda create -n watershed_workflow -c conda-forge -c defaults python=3 numpy matplotlib scipy pandas geopandas ipython ipykernel jupyterlab nb_conda_kernels meshpy fiona rasterio shapely=1.8.4 cartopy pyepsg descartes pyproj requests sortedcontainers attrs pytest netcdf4 h5py tqdm libarchive
conda activate watershed_workflow
- Check if successfully set up:
python -c 'import numpy, matplotlib, scipy, rasterio, fiona, shapely, cartopy, meshpy.triangle; print("SUCCESS")'
Download SEACAS
cd
git clone https://github.com/sandialabs/seacas.git
Install Exodus (a part of SEACAS)
(See sandialabs.github.io/seacas-docs/sphinx/html/ for SEACAS and Exodus details)
cd seacas && export ACCESS=`pwd`
MPI=YES ./install-tpl.sh
mkdir build
cd build
../cmake-exodus
make && make install
note: Replace
../cmake-exodus
with../cmake-config
if try to install full SEACAS
- Test if Exodus successfully installed:
export PYTHONPATH=${ACCESS}/lib; python -c 'import exodus; print("SUCCESS")'
Download and install watershed-workflow
cd
git clone https://github.com/environmental-modeling-workflows/watershed-workflow.git
cd watershed-workflow
python -m pip install -e .
- Edit
.bashrc
to export PYTHONPATH:
cd
vi .bashrc
Append the following line to .bashrc
:
export PYTHONPATH="$HOME/watershed-workflow/bin:$HOME/seacas/lib"
Now restart terminal, or:
source .bashrc
- (optional) Test if watershed-workflow successfully installed:
cd watershed-workflow
pytest watershed_workflow/test