Installing wflow on Ubuntu 18.04 LTS
tuggegese opened this issue · comments
Hello,
I am not sure if this is the right place to post this (in the Issues section). However, since it took me some time to install wflow on Ubuntu 18.04 LTS, I figured I'll share this, maybe it helps somebody. For my specific application, I want the Python distribution to be as lean as possible. Therefore, I was not going for the Anaconda environment solution.
Compile PCRaster from source:
sudo apt install cmake gcc g++ git qtbase5-dev libncurses5-dev libqwt-qt5-dev libxerces-c-dev libboost-all-dev libgdal-dev python3-numpy python3-docopt
wget http://pcraster.geo.uu.nl/pcraster/4.2.1/pcraster-4.2.1.tar.bz2
tar xf pcraster-4.2.1.tar.bz2 && cd pcraster-4.2.1
mkdir build && cd build
cmake -DFERN_BUILD_ALGORITHM:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=$HOME/pcraster -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 ..
cmake --build .
make install
export PATH=$PATH:$HOME/pcraster/bin
export PYTHONPATH=$PYTHONPATH:$HOME/pcraster/python
Since the automatic installation of the required Python packages did not work for me, I installed them manually using pip
sudo apt install python3-pip
pip3 install numpy
pip3 install scipy
pip3 install GDAL==$(gdal-config --version | awk -F'[.]' '{print $1"."$2}') --global-option=build_ext --global-option="-I/usr/include/gdal"
pip3 install netcdf4
pip3 install pyproj
sudo apt-get install libllvm-9-ocaml-dev libllvm9 llvm-9 llvm-9-dev llvm-9-doc llvm-9-examples llvm-9-runtime
export LLVM_CONFIG='/usr/bin/llvm-config-9'
pip3 install numba
pip3 install python-dateutil
Afterwards I was cloning the git repository to my $Home directory
cd $HOME
git clone https://github.com/openstreams/wflow.git
I had to excluded the required packages in the setup.py
file, which is located in $HOME/wflow/setup.py
install_requires=[
# "numpy",
# "scipy",
# "gdal",
# "netCDF4",
# "xarray",
# "cftime",
# "numba",
# "pyproj",
# "python-dateutil",
],
At last wflow can be installed by using pip
cd wflow
pip3 install -e .
Cheers, Sebastian
Thanks for taking the time to write this down, I'm sure it will help some people!
Shall I link to this issue from https://github.com/openstreams/wflow#install-using-pip and close this issue?
For my specific application, I want the Python distribution to be as lean as possible. Therefore, I was not going for the Anaconda environment solution.
I understand. I guess Miniconda was also not an option for this case? The PCRaster Conda build makes installation quite a bit easier. Nevertheless, it's good to document the pip install as well
Hello Martijn,
Miniconda would have been an option as well. However, since I have to run many Python based software packages for my application, I prefer to have all the packages in the systems Python environment and keep it as slim as possible ;)
Yes, of course you can link the post.
Cheers, Sebastian