jazzband/django-floppyforms

Unable to import floppyforms.gis, geometry widgets not available

foobarbaz2 opened this issue ยท 9 comments

/home/foo/anaconda2/envs/flightsayer/lib/python2.7/site-packages/floppyforms/init.py:16: UserWarning: Unable to import floppyforms.gis, geometry widgets not available
"Unable to import floppyforms.gis, geometry widgets not available")

Ok, I get that this happens on "from . import gis", but I don't understand what's going on.

(Everything worked fine until this morning, after I upgraded some stuff on my computer, and now I'm seeing this message and AHHHHH)

@foobarbaz2 How did you fix it?

@foobarbaz2 How did you fix it? +1

@foobarbaz2 How did you fix it? +1

@foobarbaz2 How did you fix it? +1

Ran into the same issue. To figure out what wrong I edited floppyforms/init.py and removed the try/except on "from . import gis" so I could see what error I was actually getting.

so this:
16 try: 17 from . import gis 18 except Exception: 19 import warnings 20 warnings.warn( 21 "Unable to import floppyforms.gis, geometry widgets not available") 22 23 __version__ = '1.7.0'

became this:

16 from . import gis

This showed me the the "gdal" library wasn't installed. I tried install gdal with "pip install gdal", but I just ran into more issues about gdal not being installed. I eventually realized that the issue was that I needed to install gdal on my system, independent of python, and that Python makes use of it.

I'm on macos, so that meant I needed to run:

brew install gdal --HEAD

Source: https://gis.stackexchange.com/questions/155403/installing-gdal-on-macosx

I suspect others might be running into the same issue. My suggestion would be to install the gdal library on your system or remove the try/except around "from . import gis" so you can see what error you're actually getting.

Running brew install gdal --HEAD produces compilation errors, but I managed to install it from https://github.com/OSGeo/homebrew-osgeo4mac

Running into the same error.

Both gdal2 and gdal2-python are visible in the PATH:

export PATH="/usr/local/opt/gdal2/bin:$PATH"
export PATH="/usr/local/opt/gdal2-python/bin:$PATH"
ogr2ogr --version
GDAL 2.2.2, released 2017/09/15

How can this warning be silenced/eliminated without having to brew-install an external package?

See here for how to silence the warning without having to install anything.

On Debian/Ubuntu
Running: sudo apt-get install binutils libproj-dev gdal-bin

source: https://docs.djangoproject.com/en/3.0/ref/contrib/gis/install/geolibs/