Unable to install wradlib in linux

HI,
I am unable to install wradlib in linux. It fails with below error.

I am using Python 3.6.8
and pip install wradlib

Any help would be appreciated.

Collecting GDAL
Using cached GDAL-3.5.2.tar.gz (756 kB)
Preparing metadata (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /var/data/tef-radolan-files-download/py_environment/bin/python3 -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-qtr1fvpn/gdal_
3ae86bab99974b4e9b552b72362e69c0/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-qtr1fvpn/gdal_3ae86bab99974b4e9b552b72362e69c0/setup.py’“'”‘;f = getattr(tokenize, ‘"’"‘open’
"’“‘, open)(file) if os.path.exists(file) else io.StringIO(’”‘“‘from setuptools import setup; setup()’”’“‘);code = f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.
close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ egg_info --egg-base /tmp/pip-pip-egg-info-w6aerc2d
cwd: /tmp/pip-install-qtr1fvpn/gdal_3ae86bab99974b4e9b552b72362e69c0/
Complete output (118 lines):
running egg_info
creating /tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info
writing /tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info/top_level.txt
writing manifest file ‘/tmp/pip-pip-egg-info-w6aerc2d/GDAL.egg-info/SOURCES.txt’
Traceback (most recent call last):
File “/tmp/pip-install-qtr1fvpn/gdal_3ae86bab99974b4e9b552b72362e69c0/setup.py”, line 105, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File “/usr/lib64/python3.6/subprocess.py”, line 729, in init
restore_signals, start_new_session)
File “/usr/lib64/python3.6/subprocess.py”, line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘…/…/apps/gdal-config’: ‘…/…/apps/gdal-config’

Hi Muru,

Installing with pip can get hard, as not all dependencies have wheels for all systems available. And even that doesn’t prevent you from getting into dependency hell (eg. library version mismatch).

Please see the wradlib docs for more information.

I would recommend to use conda to create Python environments to get out of the way of these dependency issues.

Hi Kai,
Thank you. Yes, You are right. With pip making it hard to install. I will use conda.

I’ve managed to install wradlib in a virtual environment using Pycharm Community IDE.

The real issue was installing GDAL.

My procedure was this:

  1. This was done using a python 3.9 interpreter, it was installed this way from deadsnakes PPA:
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.9
$ python3.9 --version
$ sudo apt-get install python3.9-distutils
$ sudo apt-get install python3.9-dev

Then I setup and activate my virtual environment using Python 3.9 as my interpreter. Assuming this is done, the next step was done on Pycharm’s terminal window:

  1. GDAL installation from ubuntugis PPA:
$ #!/usr/bin/env bash
$ sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
$ sudo apt-get update
$ sudo apt-get install gdal-bin
$ sudo apt-get install libgdal-dev
$ export CPLUS_INCLUDE_PATH=/usr/include/gdal
$ export C_INCLUDE_PATH=/usr/include/gdal
  1. After the last command, check which version of GDAL you have.
$ gdal-config --version
A.B.C

Where A.B.C are three numbers.

  1. Use pip to install your corresponding GDAL version:
$ pip install GDAL==A.B.C

This should work, however:

  • If pip claims to be trying a different version like:
Using cached GDAL-D.E.F.tar.gz

Where D.E.F differs from A.B.C at any point.
Purge pip’s cache:

$ pip cache purge
  • Retry step 4.

This worked for me in two different computers using the same Ubuntu version (20.04).

Trivia: I did install the recommended packages manually and checked the version, all before using wradlib.
I do import the recommended packages before loading wradlib:

"""the # is the minimum recommended version (see wradlib docs)"""
> import os
> import numpy  #1.21.0
> import scipy  #1.7.0
> import matplotlib  #3.3.0
> import xarray  #0.20.2
> from osgeo import gdal  #3.1.0
> import wradlib
1 Like