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

Python 3.4.3 Geoalchemy Error #59

Open
Castronova opened this issue Apr 19, 2016 · 9 comments
Open

Python 3.4.3 Geoalchemy Error #59

Castronova opened this issue Apr 19, 2016 · 9 comments
Assignees
Labels

Comments

@Castronova
Copy link
Contributor

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 to ColumnProperty.Comparator

In geometry.py replace any calls to the has_key method with the corresponding 'in' expression.

@emiliom
Copy link
Member

emiliom commented Apr 19, 2016

Thanks for reporting this issue and researching the solution, @Castronova.

We have our own fork of geoalchemy just for cases like this one, to be able to make critical fixes. I can take care of this.

Cool to see that people are starting to test against Python 3.x. But we mostly had not done any testing on 3.x, so it's not surprising that multiple issue are popping out.

@valentinedwv
Copy link
Member

@emiliom add me as admin odm2/geoalchemy so that I can enable the existing travis build.

@emiliom
Copy link
Member

emiliom commented Apr 19, 2016

@valentinedwv, I've sent you an invitation to an admin team I created. That should do it, but let me know if it doesn't.

@miguelcleon
Copy link
Member

Yes, I ran into this also, I hadn't realized it had to do with Python 3.x vs Python 2.x

@valentinedwv
Copy link
Member

Not quite a simple as we could wish.
python3 branch for ODM2PythonAPI.
Geoalchemy need to get the 'generic' working on 3.x (others busting due to insert issues with the comparator)
maybe strip out oracle?
0.49s$ if [[ "$DB" == "generic" ]]; then python geoalchemy/tests/test_dialect.py; fi
Traceback (most recent call last):
File "geoalchemy/tests/test_dialect.py", line 15, in
from geoalchemy.oracle import OracleSpatialDialect
File "/home/travis/build/ODM2/geoalchemy/geoalchemy/oracle.py", line 96
elif isinstance(geom, (WKBSpatialElement, WKTSpatialElement)) and geom.geometry_type <> Geometry.name:
^
SyntaxError: invalid syntax

@sreeder
Copy link
Contributor

sreeder commented Mar 14, 2017

We have added a new column FeatureGeometryWKT to the schema so that we can bypass using any of the geometry functions required by FeatureGeometry. Should we consider removing geoalchemy as a required dependency for the API since we are not currently supporting the Geometry type?

@emiliom
Copy link
Member

emiliom commented Mar 14, 2017

Should we consider removing geoalchemy as a required dependency for the API since we are not currently supporting the Geometry type?

geoalchemy (and shapely) were already removed as dependencies last year ... mostly. It was removed from the conda packaging requirements.txt. But it appears that it may still be present as a dependency for PyPI packaging, in setup.py under dependency_links

@ocefpaf, can you go over those files, confirm the status, and remove those dependencies if still present?

@ocefpaf
Copy link
Member

ocefpaf commented Mar 14, 2017

@ocefpaf, can you go over those files, confirm the status, and remove those dependencies if still present?

Sure. I'll look into this first thing tomorrow.

@horsburgh
Copy link
Member

+1 for removing geoalchemy for now.

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

No branches or pull requests

7 participants