Problem Importing wradlib in Google Colab

210 views
Skip to first unread message

Hui Wen

unread,
May 19, 2022, 11:19:05 AM5/19/22
to wradlib-users
Hi everyone.

Usually, in order to be able to use IDW interpolation on Google Colab, I would just run the code below:

!pip install wradlib
from wradlib.ipol import Idw

However, I realised the above no longer work and would throw me an error message when I run it on 19th May 2022.

Does anyone have any idea to this issue?

Looking forward to a solution and Thanks in advance 

Hui Wen

unread,
May 19, 2022, 11:24:34 AM5/19/22
to wradlib-users
The error is as attached below when I try to import Idw from wradlib.ipol

ImportError: cannot import name 'version' from 'wradlib' (/content/wradlib/__init__.py)

Kai Muehlbauer

unread,
May 23, 2022, 3:14:39 AM5/23/22
to wradli...@googlegroups.com
Dear Hui Wen,

personally I've no experience with google colab.

Looking at your code it seems you are installing wradlib via the notebook:

!pip install wradlib

Unfortunately I've no experience with that too. But maybe other users
are doing this and can help here.

I've tried to reproduce this using a local jupyter notebook
installation, but locally it works nice. Maybe this is an issue with how
colab treats remote users, but that's just guesswork.

Aren't there any output messages from "pip"?

Best,
Kai

Am 19.05.22 um 17:24 schrieb Hui Wen:
> --
> You received this message because you are subscribed to the Google
> Groups "wradlib-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wradlib-user...@googlegroups.com
> <mailto:wradlib-user...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/wradlib-users/5cbf8150-f567-4ba6-b424-60d968c89e95n%40googlegroups.com
> <https://groups.google.com/d/msgid/wradlib-users/5cbf8150-f567-4ba6-b424-60d968c89e95n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Jorma Rahu

unread,
May 23, 2022, 4:31:14 AM5/23/22
to wradli...@googlegroups.com
Hey all

Maybe pip is just not enough for your system, why not try "!conda install -c conda-forge wradlib" directly in the notebook. As I understand it, you can send any command to terminal directly from notebook with the exclamation mark (i.e. copying and moving etc.).
And also, after install maybe the notebook needs restarting for all the imports to work.

Hope this helps!

Best regards
Jorma Rahu

To unsubscribe from this group and stop receiving emails from it, send an email to wradlib-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wradlib-users/8cd0c858-b075-ae17-254c-88e8b2e8070d%40uni-bonn.de.

Hui Wen

unread,
May 26, 2022, 10:10:38 AM5/26/22
to wradlib-users
Hey all

Replying to Kai's question:
It seems like gdal was causing the trouble because I saw a line which says "Failed building wheel for gdal". Attached below is the corresponding error message:

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oo5v759v/gdal_65e94771a04a43468fbf0e64a4b37705/setup.py'"'"'; __file__='"'"'/tmp/pip-install-oo5v759v/gdal_65e94771a04a43468fbf0e64a4b37705/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'"'"'))' install --record /tmp/pip-record-6omw3z56/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/gdal Check the logs for full command output.

Replying to Jorma's suggestion:
The "!conda install -c conda-forge wradlib" that you have suggested is not for application in Google Colab right? Actually I have no issues with wradlib on Jupyter notebook but I would prefer to run the simulation on Google Colab as it would be much easier for me. Thus, I was curious if anyone has any idea to solve this issue, since I could previously run my simulations on Colab, but failed to do so after wradlib has been updated to version 1.16.0 recently. 

Thanks again everyone.

Regards
Hui Wen
Reply all
Reply to author
Forward
0 new messages