Elmira Berjisian
Elmira Berjisian

Reputation: 33

Install OSMNX errors

I tried to install osmnx by pip but confronted this error:

from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: The specified module could not be found.

this is while I installed fiona by this command:

python -m pip install Fiona-1.8.6-cp37-cp37m-win_amd64.whl

and also GDAL by:

python -m pip install GDAL-3.0.0-cp37-cp37m-win_amd64.whl

both are successfully installed. I cannot see where the problem is. Also according to osmnx documentation I tried to use conda by typing these commands

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority python=3 osmnx

in Anaconda prompt. It seems that it worked successfully. It asked to activate ox environment by typing

conda activate ox

I did this and ran my script:

import osmnx as ox
   G=ox.core.graph_from_bbox(49.531883 , 48.849792 , -122.485153, -123.478149, 
   network_type='bike', simplify=False, retain_all=False, 
   truncate_by_edge=False, name='unnamed', timeout=180, memory=None, 
   max_query_area_size=2500000000, clean_periphery=False, 
   infrastructure='way["highway"]', custom_filter=None)
   N=ox.simplify.simplify_graph(G, strict=False)
   ox.save_load.save_graph_shapefile(N, filename='metrobike', 
   folder="database management\\OSM\\metrobike", encoding='utf-8')

but the error I got is:

No module named osmnx

I have no idea what is the problem. Apparently I could not install osmnx properly, any help would be much appreciated.

Upvotes: 1

Views: 3258

Answers (1)

gboeing
gboeing

Reputation: 6442

Step by step instructions that should work... install ana/miniconda then open a terminal window and run:

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
conda activate ox
conda list osmnx

Verify you see it installed. Then run python to launch the interpreter using the ox conda environment. In the interpreter, run:

import osmnx as ox
G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')

And it should work. For more, see the installation instructions or try the official docker image.

Upvotes: 3

Related Questions