GithubHelp home page GithubHelp logo

Comments (7)

gboeing avatar gboeing commented on August 21, 2024 1

What version of requests do you have installed?

from osmnx.

raphadasilva avatar raphadasilva commented on August 21, 2024

I've just checked : 2.4.3 for Python 3 (I just tested the previous code with this Python version) and requests 2.12.1 for Python 2 !

from osmnx.

gboeing avatar gboeing commented on August 21, 2024

Make sure you have the most recent version of requests in both environments, with: pip install requests --upgrade

from osmnx.

raphadasilva avatar raphadasilva commented on August 21, 2024

Yes, I've got the most recent version on Python 3.4 available with pip --upgrade ! It's always 2.4.3, no changes.

For Python 2.7 upgrade didn't work, but I didn't use it for these particular case.

from osmnx.

gboeing avatar gboeing commented on August 21, 2024

Ok. Try upgrading OSMnx to its latest beta version: 0.1b2:

pip install osmnx --upgrade --pre

I added a new piece of code that should let it work with old versions of requests, include v2.4.x.

from osmnx.

raphadasilva avatar raphadasilva commented on August 21, 2024

That's nice, thank you very much !

I used also sudo pip3 install --ignore-installed requests command, because I found an "owed by OS" message very strange.

By curiosity, which requests version do you have ? I'm quite sure that 2.4.3 is the most recent on my system !

Now I've got OSMnx 0.1b2 version (just checked it), so I ran the same command but... new error :-/...

---------------------------------------------------------------------------
NetworkXPointlessConcept                  Traceback (most recent call last)
<ipython-input-2-0d3afc68e96a> in <module>()
----> 1 ox.plot_graph(ox.graph_from_place('Modena, Italy'))

/usr/local/lib/python3.4/dist-packages/osmnx/osmnx.py in graph_from_place(query, network_type, simplify, retain_all, truncate_by_edge, name, which_result, buffer_dist, timeout, memory, max_query_area_size, clean_periphery)
   1815     # create graph using this polygon(s) geometry
   1816     G = graph_from_polygon(polygon, network_type=network_type, simplify=simplify, retain_all=retain_all, 
-> 1817                            truncate_by_edge=truncate_by_edge, name=name, timeout=timeout, memory=memory, max_query_area_size=max_query_area_size, clean_periphery=clean_periphery)
   1818 
   1819     log('graph_from_place() returning graph with {:,} nodes and {:,} edges'.format(len(G.nodes()), len(G.edges())))

/usr/local/lib/python3.4/dist-packages/osmnx/osmnx.py in graph_from_polygon(polygon, network_type, simplify, retain_all, truncate_by_edge, name, timeout, memory, max_query_area_size, clean_periphery)
   1749         # truncate graph by polygon to return the graph within the polygon that caller wants
   1750         # don't simplify again - this allows us to retain intersections along the street that may now only connect 2 street segments in the network, but in reality also connect to an intersection just outside the polygon
-> 1751         G = truncate_graph_polygon(G_buffered, polygon, retain_all=retain_all, truncate_by_edge=truncate_by_edge)
   1752 
   1753         # count how many street segments in buffered graph emanate from each intersection in un-buffered graph, to retain true counts for each intersection, even if some of its neighbors are outside the polygon

/usr/local/lib/python3.4/dist-packages/osmnx/osmnx.py in truncate_graph_polygon(G, polygon, retain_all, truncate_by_edge)
   1320     if not retain_all:
   1321         G = remove_isolated_nodes(G)
-> 1322         G = get_largest_component(G)
   1323 
   1324     return G

/usr/local/lib/python3.4/dist-packages/osmnx/osmnx.py in get_largest_component(G, strongly)
   1098     else:
   1099         # if the graph is not connected and caller did not request retain_all, retain only the largest weakly connected component
-> 1100         if not nx.is_weakly_connected(G):
   1101             G = max(nx.weakly_connected_component_subgraphs(G), key=len)
   1102             log('Graph was not connected, retained only the largest weakly connected component ({:,} of {:,} total nodes) in {:.2f} seconds'.format(len(G.nodes()), original_len, time.time()-start_time))

/usr/local/lib/python3.4/dist-packages/networkx-1.11-py3.4.egg/networkx/algorithms/components/weakly_connected.py in is_weakly_connected(G)

/usr/local/lib/python3.4/dist-packages/networkx-1.11-py3.4.egg/networkx/utils/decorators.py in _not_implemented_for(f, *args, **kwargs)
     66                                             ' '.join(graph_types))
     67         else:
---> 68             return f(*args,**kwargs)
     69     return _not_implemented_for
     70 

/usr/local/lib/python3.4/dist-packages/networkx-1.11-py3.4.egg/networkx/algorithms/components/weakly_connected.py in is_weakly_connected(G)
    176     if len(G) == 0:
    177         raise nx.NetworkXPointlessConcept(
--> 178             """Connectivity is undefined for the null graph.""")
    179 
    180     return len(list(weakly_connected_components(G))[0]) == len(G)

NetworkXPointlessConcept: Connectivity is undefined for the null graph.

Do you prefer that I open a new issue with that and close this one ?

Thank you again for your time and advices !

from osmnx.

gboeing avatar gboeing commented on August 21, 2024

I'm using requests 2.12.1 in both my Python (3.5 and 2.7) environments.

Regarding the NetworkXPointlessConcept, there's an open issue for that right now: #8. Would you comment on that issue with your details as I'm working on it there?

from osmnx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.