-
Notifications
You must be signed in to change notification settings - Fork 39
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
ImportError: cannot import name 'TopologicalError' from 'shapely.geos' #212
Comments
Revert Shapely to 1.8.5 and Numpy to 1.23.4 |
Thank you very much for your help! ....\ox\python.exe test_osmnx.py The source code is what I found as example but I put here so that you check that I made no modification: import osmnx as ox Parse buildings with Pyrosm and time itstart_t = time.time() A PBF data for Helsinki Region (~34 MB)will be downloaded automatically to TEMP with Pyrosmpbf_path = get_data("helsinki_region_pbf") osm = OSM(pbf_path) Parse buildings from the same region using OSMnx and time itstart_t = time.time() |
This is now fixed in the new release pyrosm v0.6.2 which uses by default Shapely 2.0. See #214 . Try updating |
Hi,
I tried to run one of your example code and got the following error:
_import os
os.environ['USE_PYGEOS'] = '0'
import geopandas
In a future release, GeoPandas will switch to using Shapely by default. If you are using PyGEOS directly (calling PyGEOS functions on geometries from GeoPandas), this will then stop working and you are encouraged to migrate from PyGEOS to Shapely 2.0 (https://shapely.readthedocs.io/en/latest/migration_pygeos.html).
import geopandas as gpd
Traceback (most recent call last):
File "E:\Dev\Scripts\RoutePlanner\test_osmnx.py", line 1, in
import osmnx as ox
File "C:\Users\needi\miniconda3\envs\ox\lib\site-packages\osmnx_init_.py", line 3, in
from ._api import *
File "C:\Users\needi\miniconda3\envs\ox\lib\site-packages\osmnx_api.py", line 22, in
from .geometries import geometries_from_address
File "C:\Users\needi\miniconda3\envs\ox\lib\site-packages\osmnx\geometries.py", line 21, in
from shapely.geos import TopologicalError
ImportError: cannot import name 'TopologicalError' from 'shapely.geos' (C:\Users\needi\miniconda3\envs\ox\lib\site-packages\shapely\geos.py)
Process finished with exit code 1_
I am running the script that you gave as example (extract below):
**import osmnx as ox
from shapely.geometry import box
from pyrosm import OSM, get_data
import time
Parse buildings with Pyrosm and time it
start_t = time.time()
A PBF data for Helsinki Region (~34 MB)
will be downloaded automatically to TEMP with Pyrosm
pbf_path = get_data("helsinki_region_pbf")**
My environment is:
Environment.yml:
name: ox
channels:
dependencies:
Your help will be appreciated
The text was updated successfully, but these errors were encountered: