Skip to content
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

Install error on macOS Monterrey #147

Closed
tjukanovt opened this issue Feb 17, 2022 · 11 comments · Fixed by #149
Closed

Install error on macOS Monterrey #147

tjukanovt opened this issue Feb 17, 2022 · 11 comments · Fixed by #149

Comments

@tjukanovt
Copy link

I am trying to install tilesets-cli on my M1 Mac (Monterrey 12.2) but I am facing some issues with rasterio/GDAL. I am using Python version 3.9.10.

I created a new virtual environment and ran pip install mapbox-tilesets

Got the following output:

Collecting rasterio
  Using cached rasterio-1.2.10.tar.gz (2.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      WARNING:root:Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
      ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

Related Windows issue: #115

@royer
Copy link

royer commented Feb 17, 2022

Me too.

@tjukanovt
Copy link
Author

tjukanovt commented Feb 22, 2022

I needed GDAL CLI tools for other purposes so installed GDAL via homebrew. After this tried out mapbox-tilesets via pip again and it installed successfully.

@royer
Copy link

royer commented Feb 22, 2022

I needed GDAL CLI tools for other purposes so installed GDAL via homebrew. After this tried out mapbox-tilesets via pip again and it installed successfully.

yes. and GDAL CLI only work with Python 3.9.2.

@wsoeltz
Copy link

wsoeltz commented Feb 26, 2022

I am having the issue as well. Mac OS Monterey, Python 3.10.2. I have installed GDAL and am still getting errors at rasterio.

Building wheels for collected packages: rasterio
  Building wheel for rasterio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for rasterio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [101 lines of output]
      INFO:root:GDAL API version obtained from gdal-config: 3.4.1
      running bdist_wheel
      running build
      running build_py
      running egg_info
      writing rasterio.egg-info/PKG-INFO
      writing dependency_links to rasterio.egg-info/dependency_links.txt
      writing entry points to rasterio.egg-info/entry_points.txt
      writing requirements to rasterio.egg-info/requires.txt
      writing top-level names to rasterio.egg-info/top_level.txt
      reading manifest file 'rasterio.egg-info/SOURCES.txt'
      adding license file 'LICENSE.txt'
      adding license file 'AUTHORS.txt'
      running build_ext
      building 'rasterio._base' extension
      rasterio/_base.c:4675:26: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
          __pyx_v_c_drivername = __pyx_f_8rasterio_5_base_get_driver_name(__pyx_v_driver);
                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:4750:26: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
          __pyx_v_c_extensions = GDALGetMetadataItem(__pyx_v_driver, ((char const *)"DMD_EXTENSIONS"), NULL);
                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:13232:17: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        __pyx_v_value = GDALGetMetadataItem(__pyx_v_obj, __pyx_v_key_c, ((char const *)"TIFF"));
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:17648:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
              __pyx_t_2 = (__Pyx_PyUnicode_IS_TRUE(__pyx_t_9) != 0);
                           ^
      rasterio/_base.c:477:108: note: expanded from macro '__Pyx_PyUnicode_IS_TRUE'
        #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
                                                                                                                 ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      rasterio/_base.c:17648:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
              __pyx_t_2 = (__Pyx_PyUnicode_IS_TRUE(__pyx_t_9) != 0);
                           ^
      rasterio/_base.c:477:108: note: expanded from macro '__Pyx_PyUnicode_IS_TRUE'
        #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
                                                                                                                 ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      rasterio/_base.c:17648:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
              __pyx_t_2 = (__Pyx_PyUnicode_IS_TRUE(__pyx_t_9) != 0);
                           ^
      rasterio/_base.c:477:108: note: expanded from macro '__Pyx_PyUnicode_IS_TRUE'
        #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
                                                                                                                 ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      rasterio/_base.c:18095:23: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                __pyx_v_val = CPLParseNameValue((__pyx_v_metadata[__pyx_v_i]), (&__pyx_v_key));
                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:18839:17: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        __pyx_v_value = GDALGetMetadataItem(__pyx_v_obj, __pyx_v_name, __pyx_v_domain);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:48560:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                        ^
      rasterio/_base.c:48560:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:48565:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                        ^
      rasterio/_base.c:48565:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      rasterio/_base.c:48649:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                  ret = _PyGen_Send((PyGenObject*)yf, NULL);
                        ^
      rasterio/_base.c:48649:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
                  ret = _PyGen_Send((PyGenObject*)yf, NULL);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      11 warnings and 3 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rasterio
Failed to build rasterio
ERROR: Could not build wheels for rasterio, which is required to install pyproject.toml-based projects

@royer
Copy link

royer commented Feb 26, 2022

I am having the issue as well. Mac OS Monterey, Python 3.10.2. I have installed GDAL and am still getting errors at rasterio.

if your GDAL installed by homebrew, it depended Python 3.9.2 . so use Python 3.9.2 repalce 3.10.2 , or use virtualenv with python 3.9.2

@connor11528
Copy link

connor11528 commented Mar 7, 2022

I got this error with using virtualenv. Do I need to install GDAL CLI tools into my virtual environment? @tjukanovt maybe you could provide insight into how to install the CLI tools? If it's a requirement for this project I'm down to push a PR to update the readme :)

$ python3 -m virtualenv mapmaking
$ source mapmaking/bin/activate
(mapmaking) $ python --version
Python 3.8.9
(mapmaking) $ pip install mapbox-tilesets
...
Collecting rasterio
  Using cached rasterio-1.2.10.tar.gz (2.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      WARNING:root:Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
      ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
      [end of output]

@johnk1
Copy link
Contributor

johnk1 commented Mar 7, 2022

@connor11528 a correction for this is in review now. In the interim, you should be able to install GDAL manually before pip install mapbox-tilesets. You can easily do this through brew.sh (brew install gdal)

@connor11528
Copy link

@johnk1 okay can do. And do I need to install gdal in my virtual environment or is it sufficient to install it globally with homebrew on the parent machine?

@johnk1
Copy link
Contributor

johnk1 commented Mar 8, 2022

Yes, you would just install it so the arm64 GDAL binaries are available globally. Check that the brew command you're running is the arm64 version, not the x86 version, in case you've installed that. The arm64 is typically installed under /opt/homebrew.

@johnk1
Copy link
Contributor

johnk1 commented Mar 14, 2022

Take a look at the 1.7.3 release. It has a new installation process which specifically isolates out rasterio/GDAL. These are only needed if you'll use the estimate-area command.

@connor11528
Copy link

Okay cool will do. Thanks @johnk1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants