I'm on a mac running python3 on jupyter notebook. Pushing myself to learn more python via a project on road maps.
I'm reading in a shapefile like so
import networkx as nx
g = nx.read_shp('Road files/geo_export_4d537b7d-a470-4eb9-b147-1d0ea89e6b60.shp')
And it's working dandy.
But then I read about OSMnx and think "that's pretty cool! I could dynamically pull shapefiles, rather than hunt them out online".
So I tried to install (pip install osmnx
) but kept getting failures. So I tried the other method mentioned (conda install -c conda-forge osmnx
).
Now, I can no longer run my initial networkx read_shp because of this error:
ImportError: read_shp requires OGR: http://www.gdal.org/
. I've gone to the site and installed GDAL, but the error persists.
I also cannot import osmnx. It errors on
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
due to
ImportError: dlopen(/Users/sb/anaconda/lib/python3.5/site-packages/fiona/ogrext.cpython-35m-darwin.so, 2): Library not loaded: @rpath/libjpeg.8.dylib
Referenced from: /Users/sb/anaconda/lib/libgdal.20.dylib
Reason: image not found
1\ What the heck did I just do to my environment?
2\ How do I restore networkx functionality? Presumably through a proper GDAL (re?)installation.
3\ How do I prep for osmnx?
Sorry for the vague open-endedness here, I've pushed my code a bit too far beyond my abilities.
Update
I ran conda config --add channels conda-forge
and re-running conda install gdal
and conda install libgdal
.
Unfortunately I still error out, but it's a different error claiming that networkx needs gdal (which should be installed?)
/Users/sb/anaconda/lib/python3.6/site-packages/networkx/readwrite/nx_shp.py in read_shp(path, simplify)
ImportError: read_shp requires OGR: http://www.gdal.org/
fwiw, /Users/sb/anaconda/lib/
has both a python3.6
and python3.5
folder.