Closed damilare-osunleke closed 1 year ago
issue resolved
I'm having the same issue right now as well.
ImportError Traceback (most recent call last) Cell In[10], line 3 1 origin = [0.3515625, 50.064191736659104] 2 destination = [117.42187500000001, 39.36827914916014] ----> 3 route = sr.searoute(origin, destination)
File c:\Users\389023\AppData\Local\Programs\Python\Python310\lib\site-packages\searoute\searoute.py:223, in searoute(origin, destination, units, speed_knot, append_orig_dest, restrictions, include_ports, port_params) 220 port_dest = closestPortDest[1] 222 # In the graph, get the nodes closest to the points --> 223 origin_node = ox.distance.nearest_nodes(H, origin[0], origin[1]) 224 destination_node = ox.distance.nearest_nodes(H, destination[0], destination[1]) 226 # Get the shortest route by distance
File c:\Users\389023\AppData\Local\Programs\Python\Python310\lib\site-packages\osmnx\distance.py:227, in nearest_nodes(G, X, Y, return_dist) 224 else: 225 # if unprojected, use ball tree for haversine nearest-neighbor search 226 if BallTree is None: # pragma: no cover --> 227 raise ImportError("scikit-learn must be installed to search an unprojected graph") 228 # haversine requires lat, lng coords in radians 229 nodes_rad = np.deg2rad(nodes[["y", "x"]])
ImportError: scikit-learn must be installed to search an unprojected graph
In my case, I closed and reopened my code editor (VScode) and restarted the session and it was fine.
Maybe you could try the same thing.
@damilare-osunleke That fixed it, thanks
Closing, feel free to open a new issues if this occurs
Running the sample code (shown below) in the readme returns an error: "ImportError: scikit-learn must be installed to search an unprojected graph"
import searoute as sr origin = [0.3515625, 50.064191736659104] destination = [117.42187500000001, 39.36827914916014] route = sr.searoute(origin, destination)
Note:I have scikit-learn installed