Giter VIP home page Giter VIP logo

Comments (12)

gboeing avatar gboeing commented on May 22, 2024

What version of Python and architecture are you using?

Is OSMnx installed in a virtual environment by itself?

How did you install OSMnx (pip, conda, manually, etc.)?

What are your environment's packages (or at least the versions and sources of all of OSMnx's dependencies)?

One thing I see is that you are using geopandas 0.1.1, but OSMnx requires >=0.2.1. You can see the list of dependencies and required minimum versions on PyPI at that link. If you install via pip or conda it should upgrade all necessary dependencies for you. You can install OSMnx with conda into a virtual environment:

conda create --yes -c conda-forge -n OSMNX python=3.6 osmnx
source activate OSMNX

Then from this virtual env, launch python or a jupyter notebook and import osmnx.

from osmnx.

andischan avatar andischan commented on May 22, 2024

I use python 3.6.0

When changing to Linux 5 years ago, I've learned never to install anything into /usr without using a package manager. So I don't manually install binaries nor do I use pip or conda.

Here is my PKGBUILD for osmnx: https://aur.archlinux.org/packages/python-osmnx/

The error persists even after updating to geopandas 0.2.1

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

I don't have Arch Linux so I'm not sure I can recreate this problem. Unfortunately I also can't speak to that AUR package as I was not involved in creating or maintaining it or any of its dependency packages in the AUR repo. If you don't want to use a Python package manager, you'd probably have to contact the maintainer of the AUR package for more information.

Given this type of problem, I'd strongly suggest you create a clean virtual environment (with virtualenv, or some equivalent tool) and install OSMnx directly into it via the installation method of your choice. If you don't use conda or pip to manage the dependencies, then pay close attention to fully installing an appropriate version of each dependency and all of their dependencies (including non-Python packages like libspatialindex).

You didn't provide a complete list of the Python packages (and their sources) in your environment in your previous comment, but if you do, I can try to assist further. That is, not the package details from AUR, but rather the list of packages actually installed in your Python environment. You could use conda list (preferably) or pip list or any other equivalent package listing method that you prefer.

from osmnx.

andischan avatar andischan commented on May 22, 2024

I (personally) have uploaded the package into AUR. For this I've transferred the requires.txt

requests>=2.11
numpy>=1.11
pandas>=0.19
geopandas>=0.2.1
networkx>=1.11
matplotlib>=1.5
Shapely>=1.5
descartes>=1.0
geopy>=1.11
Rtree>=0.8.3

into the PKGBUILD:

depends=('python-requests>=2.11' 'python-numpy>=1.11' 'python-pandas>=0.19' 'python-geopandas>=0.2.1' 'python-networkx>=1.11' 'python-matplotlib>=1.5' 'python-shapely>=1.5' 'python-descartes>=1.0' 'python-geopy>=1.11' 'python-rtree>=0.8.3')

This is equivalent, and ANY package manager could check, whether the dependencies are met.

from osmnx.

andischan avatar andischan commented on May 22, 2024

But if you would like to see my package list, here it is:

appdirs (1.4.0)
atomicwrites (1.1.5)
Beaker (1.8.1)
beautifulsoup4 (4.5.3)
bsddb3 (6.2.4)
CacheControl (0.11.6)
cffi (1.9.1)
chardet (2.3.0)
click (6.7)
click-log (0.1.8)
click-threading (0.4.3)
cligj (0.4.0)
colormath (2.1.1)
cryptography (1.7.1)
cycler (0.10.0)
decorator (4.0.11)
descartes (1.1.0)
dlib (19.2.0)
file-magic (0.3.0)
Fiona (1.7.1.post1)
geopandas (0.2.1)
geopy (1.11.0)
gramps (4.2.5)
idna (2.2)
lockfile (0.12.2)
louis (3.0.0)
Mako (1.0.6)
MarkupSafe (0.23)
matplotlib (2.0.0)
mwparserfromhell (0.4.4)
networkx (1.11)
numpy (1.12.0)
oauthlib (2.0.1)
olefile (0.43)
osmnx (0.2.2)
packaging (16.8)
pandas (0.19.2)
Pillow (4.0.0)
pip (9.0.1)
ply (3.9)
protobuf (3.1.0)
py (1.4.32)
pyasn1 (0.1.9)
pycolorname (0.1.0)
pycparser (2.17)
pycrypto (2.6.1)
pygobject (3.22.0)
PyICU (1.9.5)
pyOpenSSL (16.2.0)
pyparsing (2.1.10)
pyproj (1.9.5.1)
pytest (3.0.6)
python-dateutil (2.6.0)
python-sane (2.8.3)
pytz (2016.10)
pywikibot (3.0.dev0)
Recoll (1.0)
requests (2.13.0)
requests-oauthlib (0.7.0)
requests-toolbelt (0.7.0)
Rtree (0.8.3)
scikit-image (0.12.3)
scipy (0.18.1)
selenium (3.0.2)
setuptools (34.0.2)
setuptools-scm (1.15.1.dev17+ngb0d17f1)
Shapely (1.5.17)
six (1.10.0)
team (1.0)
urllib3 (1.20)
vdirsyncer (0.14.1)
youtube-dl (2017.1.24)

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

Ok, thanks for the list. So, let's first make sure all the prerequisites are working properly. From a Python interpreter, run:

import requests, numpy as np, pandas as pd, geopandas as gpd, networkx as nx, matplotlib.pyplot as plt, matplotlib.cm as cm
from shapely.geometry import Point, LineString, Polygon, MultiPolygon
from descartes import PolygonPatch
from geopy.distance import great_circle, vincenty
from rtree.index import Index as RTreeIndex
from osgeo import gdal, ogr, osr
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
gdf = gpd.GeoDataFrame()

Does all that execute successfully?

from osmnx.

andischan avatar andischan commented on May 22, 2024

I was missing python-gdal (osgeo), but now gdf = gpd.GeoDataFrame() executes successfully.

But I still get the above error no attribute 'gdf_from_place'.

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

Can you provide

  1. the full code you're running, from the top (not just the line that's failing)
  2. the entire error traceback

from osmnx.

andischan avatar andischan commented on May 22, 2024

Full source code:

import osmnx as ox
city = ox.gdf_from_place('Berkeley, CA')
ox.plot_shape(ox.project_gdf(city))

Traceback (most recent call last):
File "osmnx.py", line 4, in
import osmnx as ox
File "~/py/osmnx.py", line 5, in
city = ox.gdf_from_place('Berkeley, CA')
AttributeError: module 'osmnx' has no attribute 'gdf_from_place'

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

There is something wrong with your installation. The traceback indicates that you have a module called "osmnx.py" in your environment. You said you are using OSMnx 0.2.2, but as you can see in the tarball, there is no osmnx.py file in the package.

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

@andischan did you get this working?

from osmnx.

gboeing avatar gboeing commented on May 22, 2024

@andischan just checking back once more. I'll close this out in a couple days if it's no longer an active issue.

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.