Toblerity / Fiona

Fiona reads and writes geographic data files
https://fiona.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.15k stars 202 forks source link

Install woes: mach-o, but wrong architecture #28

Closed nvkelso closed 11 years ago

nvkelso commented 11 years ago

I swear I've installed Fiona fine before, but on this Mac OS 10.6 with Python 2.7 box it's giving me the following error. Suggestion?

Aside: Shapely installs and imports just fine (from src).

import fiona Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/site-packages/fiona/init.py", line 69, in from fiona.collection import Collection, supported_drivers File "/usr/local/lib/python2.7/site-packages/fiona/collection.py", line 6, in from fiona.ogrext import Iterator, Session, WritingSession ImportError: dlopen(/usr/local/lib/python2.7/site-packages/fiona/ogrext.so, 2): no suitable image found. Did find: /usr/local/lib/python2.7/site-packages/fiona/ogrext.so: mach-o, but wrong architecture

nvkelso commented 11 years ago

Or this is odd. I change my python path to 2.6 instead of 2.7 and I get the following error instead:

$ ./dissolve-shapes.py Traceback (most recent call last): File "./dissolve-shapes.py", line 8, in from fiona import collection File "/usr/local/lib/python2.7/site-packages/fiona/init.py", line 69, in from fiona.collection import Collection, supported_drivers File "/usr/local/lib/python2.7/site-packages/fiona/collection.py", line 6, in from fiona.ogrext import Iterator, Session, WritingSession ImportError: dlopen(/usr/local/lib/python2.7/site-packages/fiona/ogrext.so, 2): Symbol not found: _PyCapsule_New Referenced from: /usr/local/lib/python2.7/site-packages/fiona/ogrext.so Expected in: flat namespace in /usr/local/lib/python2.7/site-packages/fiona/ogrext.so

nvkelso commented 11 years ago

The install chatter:

$ pip install fiona Downloading/unpacking fiona Downloading Fiona-0.9.1.tar.gz (171kB): 171kB downloaded Running setup.py egg_info for package fiona

Installing collected packages: fiona Running setup.py install for fiona building 'fiona.ogrinit' extension /usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -Os -pipe -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/gdal/1.9.2/include -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/fiona/ogrinit.c -o build/temp.macosx-10.6-x86_64-2.7/src/fiona/ogrinit.o /usr/bin/gcc-4.2 -bundle -undefined dynamic_lookup -L/usr/local/opt/sqlite/lib -L/usr/local/opt/readline/lib -L/usr/local/lib build/temp.macosx-10.6-x86_64-2.7/src/fiona/ogrinit.o -L/usr/local/Cellar/gdal/1.9.2/lib -lgdal -o build/lib.macosx-10.6-x86_64-2.7/fiona/ogrinit.so building 'fiona.ogrext' extension /usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -Os -pipe -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/gdal/1.9.2/include -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/fiona/ogrext.c -o build/temp.macosx-10.6-x86_64-2.7/src/fiona/ogrext.o In file included from src/fiona/ogrext.c:252: /usr/local/Cellar/gdal/1.9.2/include/ogr_srs_api.h:677: warning: function declaration isn’t a prototype src/fiona/ogrext.c: In function ‘__pyx_f_5fiona_6ogrext_14FeatureBuilder_build’: src/fiona/ogrext.c:7282: warning: assignment discards qualifiers from pointer target type src/fiona/ogrext.c:7499: warning: assignment discards qualifiers from pointer target type src/fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_10get_driver’: src/fiona/ogrext.c:9992: warning: assignment discards qualifiers from pointer target type src/fiona/ogrext.c: In function ‘pyx_pf_5fiona_6ogrext_7Session_16get_extent’: src/fiona/ogrext.c:11256: warning: passing argument 2 of ‘OGR_L_GetExtent’ from incompatible pointer type src/fiona/ogrext.c: At top level: src/fiona/ogrext.c:6904: warning: ‘__pyx_f_5fiona_6ogrext_geometry’ defined but not used /usr/bin/gcc-4.2 -bundle -undefined dynamic_lookup -L/usr/local/opt/sqlite/lib -L/usr/local/opt/readline/lib -L/usr/local/lib build/temp.macosx-10.6-x86_64-2.7/src/fiona/ogrext.o -L/usr/local/Cellar/gdal/1.9.2/lib -lgdal -o build/lib.macosx-10.6-x86_64-2.7/fiona/ogrext.so

Successfully installed fiona Cleaning up...

nvkelso commented 11 years ago

This also fails on my 10.7 box:

import fiona Traceback (most recent call last): File "", line 1, in File "build/bdist.macosx-10.7-intel/egg/fiona/init.py", line 69, in

File "build/bdist.macosx-10.7-intel/egg/fiona/collection.py", line 6, in File "build/bdist.macosx-10.7-intel/egg/fiona/ogrext.py", line 7, in File "build/bdist.macosx-10.7-intel/egg/fiona/ogrext.py", line 6, in bootstrap ImportError: dlopen(/Users/nvkelso/.python-eggs/Fiona-0.9.1-py2.7-macosx-10.7-intel.egg-tmp/fiona/ogrext.so, 2): Symbol not found: _OGRGetDriverByName Referenced from: /Users/nvkelso/.python-eggs/Fiona-0.9.1-py2.7-macosx-10.7-intel.egg-tmp/fiona/ogrext.so Expected in: flat namespace in /Users/nvkelso/.python-eggs/Fiona-0.9.1-py2.7-macosx-10.7-intel.egg-tmp/fiona/ogrext.so

nvkelso commented 11 years ago

Does this only work on Ubuntu?

sgillies commented 11 years ago

I write and test Fiona on OS X, but my GDAL lib and Python are not framework builds and so my development environment is more like Ubuntu. In my experience "Symbol not found" means that the GDAL lib isn't on my library path. Is that the case?

sgillies commented 11 years ago

Still a problem, @nvkelso?

nvkelso commented 11 years ago

Seems to work for me now. I cleaned up a bunch of stuff in my .bash_profile paths that might have been the issue, then brew uninstalled and install gdal, then pip installed shapely, pip install fiona and it's all strangely copacetic.