Open
Description
Attempting to install odm2api on a CentOS 7 machine that is running Python 3.4.3 using the source code from the python 3.x compatibility pull request. While the odm2api installs fine, it is dependent on geoalchemy which raises the following ImportError:
>>> import odm2api
utils imported
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/site-packages/odm2api/__init__.py", line 1, in <module>
from odm2api.ODMconnection import SessionFactory, dbconnection
File "/usr/lib/python3.4/site-packages/odm2api/ODMconnection.py", line 6, in <module>
from .ODM2.models import Variables as Variable2, setSchema
File "/usr/lib/python3.4/site-packages/odm2api/ODM2/models.py", line 7, in <module>
from geoalchemy import GeometryDDL, GeometryColumn
File "/usr/lib64/python3.4/site-packages/geoalchemy/__init__.py", line 2, in <module>
from geoalchemy.base import *
File "/usr/lib64/python3.4/site-packages/geoalchemy/base.py", line 7, in <module>
from utils import from_wkt
ImportError: cannot import name 'from_wkt'
This is documented as geoalchemy issue #41 and a pull request was created to fix this in November 2015, but hasn't been touched since January 2016.
Here is the suggested fix from #41
In base.py change
from utils import ... from functions import ...
to
from geoalchemy.utils import ... from geoalchemy.functions import ...
In base.py change any mention of
ColumnProperty.ColumnComparator
toColumnProperty.Comparator
In geometry.py replace any calls to the
has_key
method with the corresponding 'in' expression.