0

Lets start with I am a noob to Python.

I am trying to install osmnx on a Mac using Terminal - but getting the following error. Any idea on a resolution to this?

I have independently installed rtree successfully, so not sure what else to try?

pip3 install mysql-connector-python
Requirement already satisfied: mysql-connector-python in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (8.0.21)
Requirement already satisfied: protobuf>=3.0.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mysql-connector-python) (3.12.4)
Requirement already satisfied: six>=1.9 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from protobuf>=3.0.0->mysql-connector-python) (1.15.0)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from protobuf>=3.0.0->mysql-connector-python) (49.6.0)
familys-imac:~ markhowman$ pip3 install osmnx
Collecting osmnx
  Using cached osmnx-0.15.1-py2.py3-none-any.whl (84 kB)
Collecting matplotlib>=3.2
  Using cached matplotlib-3.3.1-cp38-cp38-macosx_10_9_x86_64.whl (8.5 MB)
Requirement already satisfied: networkx>=2.4 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from osmnx) (2.4)
Collecting descartes>=1.1
  Using cached descartes-1.1.0-py3-none-any.whl (5.8 kB)
Collecting requests>=2.23
  Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Requirement already satisfied: numpy>=1.18 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from osmnx) (1.19.1)
Requirement already satisfied: pyproj>=2.6 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from osmnx) (2.6.1.post1)
Requirement already satisfied: pandas>=1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from osmnx) (1.1.0)
Requirement already satisfied: Shapely>=1.7 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from osmnx) (1.7.0)
Collecting Rtree>=0.9
  Using cached Rtree-0.9.4.tar.gz (62 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/setup.py'"'"'; __file__='"'"'/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-pip-egg-info-k40std78
         cwd: /private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/
    Complete output (15 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/setup.py", line 3, in <module>
        import rtree
      File "/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/rtree/__init__.py", line 1, in <module>
        from .index import Rtree
      File "/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/rtree/index.py", line 6, in <module>
        from . import core
      File "/private/var/folders/ck/8_3lww7j31xdm3m91c417x_c0000gn/T/pip-install-oy9i8ju5/rtree/rtree/core.py", line 143, in <module>
        rt.Error_GetLastErrorNum.restype = ctypes.c_int
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
        func = self.__getitem__(name)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
        func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

1 Answers1

0

Make sure you install OSMnx according to its installation instructions.

OSMnx is pure Python and thus its installation alone is trivial, but, it depends on geopandas which itself has tricky dependencies (like rtree) to install. If you follow OSMnx's documented installation instructions, it should all be smooth and seamless.

See also this related answer.

gboeing
  • 5,691
  • 2
  • 15
  • 41