Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing wflow on Ubuntu 18.04 LTS #36

Closed
tuggegese opened this issue Sep 30, 2020 · 2 comments
Closed

Installing wflow on Ubuntu 18.04 LTS #36

tuggegese opened this issue Sep 30, 2020 · 2 comments

Comments

@tuggegese
Copy link

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

@visr
Copy link
Contributor

visr commented Oct 1, 2020

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

@tuggegese
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants