r-barnes / richdem

High-performance Terrain and Hydrology Analysis
GNU General Public License v3.0
271 stars 69 forks source link

python 3.11 #65

Open KMIJPH opened 1 year ago

KMIJPH commented 1 year ago

Installation on python 3.11 fails for me. I couldn't really do much with the log. On python 3.10 it installs fine.

Log:

Installing collected packages: richdem
  Running setup.py install for richdem ... error
  error: subprocess-exited-with-error

  × Running setup.py install for richdem did not run successfully.
  │ exit code: 1
  ╰─> [171 lines of output]
      Using RichDEM hash=Unknown, time=Unknown
      /usr/lib/python3.11/site-packages/setuptools/dist.py:772: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running install
      /usr/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/richdem
      copying richdem/__init__.py -> build/lib.linux-x86_64-cpython-311/richdem
      copying richdem/cli.py -> build/lib.linux-x86_64-cpython-311/richdem
      running build_ext
      COMPILER unix
      COMPILER ARGUMENTS ['-std=c++11', '-g', '-fvisibility=hidden', '-O3', '-Wno-unknown-pragmas']
      building '_richdem' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/lib
      creating build/temp.linux-x86_64-cpython-311/lib/richdem
      creating build/temp.linux-x86_64-cpython-311/lib/richdem/common
      creating build/temp.linux-x86_64-cpython-311/src
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/include/python3.11 -c lib/richdem/common/random.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/common/random.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/include/python3.11 -c lib/richdem/richdem.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/richdem.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/include/python3.11 -c src/pywrapper.cpp -o build/temp.linux-x86_64-cpython-311/src/pywrapper.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas
      In file included from lib/pybind11/cast.h:16,
                       from lib/pybind11/attr.h:13,
                       from lib/pybind11/pybind11.h:43,
                       from src/pywrapper.cpp:1:
      lib/pybind11/detail/internals.h:82:33: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations]
         82 |     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
            |              ~~~~~~~~~~~~~~~~~~~^~
      In file included from /usr/include/python3.11/Python.h:89,
                       from lib/pybind11/detail/common.h:111,
                       from lib/pybind11/pytypes.h:12,
                       from lib/pybind11/cast.h:13:
      /usr/include/python3.11/pythread.h:96:36: note: declared here
         96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void);
            |                                    ^~~~~~~~~~~~~~~~~~~
      lib/pybind11/detail/internals.h:82:33: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations]
         82 |     decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
            |              ~~~~~~~~~~~~~~~~~~~^~
      /usr/include/python3.11/pythread.h:96:36: note: declared here
         96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void);
            |                                    ^~~~~~~~~~~~~~~~~~~
      lib/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’:
      lib/pybind11/detail/internals.h:165:27: warning: ‘void PyEval_InitThreads()’ is deprecated [-Wdeprecated-declarations]
        165 |         PyEval_InitThreads();
            |         ~~~~~~~~~~~~~~~~~~^~
      In file included from /usr/include/python3.11/Python.h:95:
      /usr/include/python3.11/ceval.h:132:37: note: declared here
        132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
            |                                     ^~~~~~~~~~~~~~~~~~
      lib/pybind11/detail/internals.h:167:52: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations]
        167 |         internals_ptr->tstate = PyThread_create_key();
            |                                 ~~~~~~~~~~~~~~~~~~~^~
      /usr/include/python3.11/pythread.h:96:36: note: declared here
         96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void);
            |                                    ^~~~~~~~~~~~~~~~~~~
      lib/pybind11/detail/internals.h:168:31: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations]
        168 |         PyThread_set_key_value(internals_ptr->tstate, tstate);
            |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:98:36: note: declared here
         98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
            |                                    ^~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
      lib/pybind11/cast.h:441:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        441 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                    ^~
      In file included from /usr/include/python3.11/Python.h:42:
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      lib/pybind11/cast.h:441:75: error: expected primary-expression before ‘>’ token
        441 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                           ^
      lib/pybind11/cast.h:441:77: error: expected primary-expression before ‘)’ token
        441 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
            |                                                                             ^
      lib/pybind11/cast.h:443:29: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        443 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                             ^~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      lib/pybind11/cast.h:443:64: error: expected primary-expression before ‘>’ token
        443 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                ^
      lib/pybind11/cast.h:443:66: error: expected primary-expression before ‘)’ token
        443 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
            |                                                                  ^
      lib/pybind11/cast.h:444:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        444 |             frame = frame->f_back;
            |                          ^~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      lib/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’:
      lib/pybind11/pybind11.h:1741:58: warning: ‘void* PyThread_get_key_value(int)’ is deprecated [-Wdeprecated-declarations]
       1741 |         tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate);
            |                                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:100:39: note: declared here
        100 | Py_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key);
            |                                       ^~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/pybind11.h:1753:35: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations]
       1753 |             PyThread_set_key_value(internals.tstate, tstate);
            |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:98:36: note: declared here
         98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
            |                                    ^~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’:
      lib/pybind11/pybind11.h:1792:38: warning: ‘void PyThread_delete_key_value(int)’ is deprecated [-Wdeprecated-declarations]
       1792 |             PyThread_delete_key_value(detail::get_internals().tstate);
            |             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:101:37: note: declared here
        101 | Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key);
            |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’:
      lib/pybind11/pybind11.h:1820:39: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations]
       1820 |                 PyThread_set_key_value(key, nullptr);
            |                 ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:98:36: note: declared here
         98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
            |                                    ^~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’:
      lib/pybind11/pybind11.h:1833:35: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations]
       1833 |             PyThread_set_key_value(key, tstate);
            |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
      /usr/include/python3.11/pythread.h:98:36: note: declared here
         98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key,
            |                                    ^~~~~~~~~~~~~~~~~~~~~~
      lib/pybind11/pybind11.h: In function ‘pybind11::function pybind11::get_type_overload(const void*, const detail::type_info*, const char*)’:
      lib/pybind11/pybind11.h:1890:49: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
       1890 |     PyFrameObject *frame = PyThreadState_Get()->frame;
            |                                                 ^~~~~
            |                                                 cframe
      lib/pybind11/pybind11.h:1891:41: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       1891 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
            |                                         ^~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      lib/pybind11/pybind11.h:1892:14: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       1892 |         frame->f_code->co_argcount > 0) {
            |              ^~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      lib/pybind11/pybind11.h:1895:18: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       1895 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                  ^~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /usr/include/python3.11/Python.h:38:
      lib/pybind11/pybind11.h:1895:52: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
       1895 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                                                    ^~
      /usr/include/python3.11/pyport.h:24:38: note: in definition of macro ‘_Py_CAST’
         24 | #define _Py_CAST(type, expr) ((type)(expr))
            |                                      ^~~~
      /usr/include/python3.11/cpython/tupleobject.h:30:38: note: in expansion of macro ‘_PyTuple_CAST’
         30 | #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index])
            |                                      ^~~~~~~~~~~~~
      lib/pybind11/pybind11.h:1895:30: note: in expansion of macro ‘PyTuple_GET_ITEM’
       1895 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
            |                              ^~~~~~~~~~~~~~~~
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> richdem

note: This is an issue with the package mentioned above, not pip.
Robinlovelace commented 1 year ago

I'm also hitting issues installing the package with pip.

Reproducible example in a Docker container:

docker run -it ghcr.io/geocompx/docker:python /bin/bash
# in the container:
pip install richdem

Resulting in:

Collecting richdem
  Downloading richdem-0.3.4.tar.gz (329 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 329.4/329.4 kB 3.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy<2,>=1.7 in /usr/local/lib/python3.11/site-packages (from richdem) (1.24.0)
Building wheels for collected packages: richdem
  Building wheel for richdem (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Using RichDEM hash=Unknown, time=Unknown
      /usr/local/lib/python3.11/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/richdem
      copying richdem/__init__.py -> build/lib.linux-x86_64-cpython-311/richdem
      copying richdem/cli.py -> build/lib.linux-x86_64-cpython-311/richdem
      running build_ext
      COMPILER unix
      COMPILER ARGUMENTS ['-std=c++11', '-g', '-fvisibility=hidden', '-O3', '-Wno-unknown-pragmas']
      building '_richdem' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/lib
      creating build/temp.linux-x86_64-cpython-311/lib/richdem
      creating build/temp.linux-x86_64-cpython-311/lib/richdem/common
      creating build/temp.linux-x86_64-cpython-311/src
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/local/include/python3.11 -c lib/richdem/common/random.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/common/random.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for richdem
  Running setup.py clean for richdem
Failed to build richdem
ERROR: Could not build wheels for richdem, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.1.2 -> 23.2.1
[notice] To update, run: pip install --upgrade pip
KMIJPH commented 1 year ago

I'm also hitting issues installing the package with pip. error: command 'gcc' failed: No such file or directory

This however is related to gcc not being found.

Robinlovelace commented 1 year ago

Thanks @KMIJPH I tried installing it again after installing gcc and still got an error message, although a different one.

``` pip install richdem Collecting richdem Using cached richdem-0.3.4.tar.gz (329 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy<2,>=1.7 in /usr/local/lib/python3.11/site-packages (from richdem) (1.24.0) Building wheels for collected packages: richdem Building wheel for richdem (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [321 lines of output] Using RichDEM hash=Unknown, time=Unknown /usr/local/lib/python3.11/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-311 creating build/lib.linux-x86_64-cpython-311/richdem copying richdem/__init__.py -> build/lib.linux-x86_64-cpython-311/richdem copying richdem/cli.py -> build/lib.linux-x86_64-cpython-311/richdem running build_ext COMPILER unix COMPILER ARGUMENTS ['-std=c++11', '-g', '-fvisibility=hidden', '-O3', '-Wno-unknown-pragmas'] building '_richdem' extension creating build/temp.linux-x86_64-cpython-311 creating build/temp.linux-x86_64-cpython-311/lib creating build/temp.linux-x86_64-cpython-311/lib/richdem creating build/temp.linux-x86_64-cpython-311/lib/richdem/common creating build/temp.linux-x86_64-cpython-311/src gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/local/include/python3.11 -c lib/richdem/common/random.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/common/random.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/local/include/python3.11 -c lib/richdem/richdem.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/richdem.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DDOCTEST_CONFIG_DISABLE -DRICHDEM_COMPILE_TIME=\"\\\"Unknown\\\"\" -DRICHDEM_GIT_HASH=\"\\\"Unknown\\\"\" -DRICHDEM_LOGGING -D_USE_MATH_DEFINES -Ilib/ -I/usr/local/include/python3.11 -c src/pywrapper.cpp -o build/temp.linux-x86_64-cpython-311/src/pywrapper.o -std=c++11 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas In file included from lib/pybind11/cast.h:16, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations] 82 | decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:96:36: note: declared here 96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void); | ^~~~~~~~~~~~~~~~~~~ In file included from lib/pybind11/cast.h:16, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/detail/internals.h:82:34: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations] 82 | decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:96:36: note: declared here 96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void); | ^~~~~~~~~~~~~~~~~~~ In file included from lib/pybind11/cast.h:16, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/detail/internals.h: In function ‘pybind11::detail::internals& pybind11::detail::get_internals()’: lib/pybind11/detail/internals.h:165:28: warning: ‘void PyEval_InitThreads()’ is deprecated [-Wdeprecated-declarations] 165 | PyEval_InitThreads(); | ^ In file included from /usr/local/include/python3.11/Python.h:95, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/ceval.h:132:37: note: declared here 132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void); | ^~~~~~~~~~~~~~~~~~ In file included from lib/pybind11/cast.h:16, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/detail/internals.h:167:53: warning: ‘int PyThread_create_key()’ is deprecated [-Wdeprecated-declarations] 167 | internals_ptr->tstate = PyThread_create_key(); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:96:36: note: declared here 96 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_create_key(void); | ^~~~~~~~~~~~~~~~~~~ In file included from lib/pybind11/cast.h:16, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/detail/internals.h:168:61: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations] 168 | PyThread_set_key_value(internals_ptr->tstate, tstate); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:98:36: note: declared here 98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’: lib/pybind11/cast.h:441:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 441 | " " + handle(frame->f_code->co_filename).cast() + | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/cast.h:441:75: error: expected primary-expression before ‘>’ token 441 | " " + handle(frame->f_code->co_filename).cast() + | ^ lib/pybind11/cast.h:441:77: error: expected primary-expression before ‘)’ token 441 | " " + handle(frame->f_code->co_filename).cast() + | ^ lib/pybind11/cast.h:443:29: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 443 | handle(frame->f_code->co_name).cast() + "\n"; | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/cast.h:443:64: error: expected primary-expression before ‘>’ token 443 | handle(frame->f_code->co_name).cast() + "\n"; | ^ lib/pybind11/cast.h:443:66: error: expected primary-expression before ‘)’ token 443 | handle(frame->f_code->co_name).cast() + "\n"; | ^ lib/pybind11/cast.h:444:26: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 444 | frame = frame->f_back; | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_acquire::gil_scoped_acquire()’: lib/pybind11/pybind11.h:1741:75: warning: ‘void* PyThread_get_key_value(int)’ is deprecated [-Wdeprecated-declarations] 1741 | tstate = (PyThreadState *) PyThread_get_key_value(internals.tstate); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:100:39: note: declared here 100 | Py_DEPRECATED(3.7) PyAPI_FUNC(void *) PyThread_get_key_value(int key); | ^~~~~~~~~~~~~~~~~~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h:1753:60: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations] 1753 | PyThread_set_key_value(internals.tstate, tstate); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:98:36: note: declared here 98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h: In member function ‘void pybind11::gil_scoped_acquire::dec_ref()’: lib/pybind11/pybind11.h:1792:69: warning: ‘void PyThread_delete_key_value(int)’ is deprecated [-Wdeprecated-declarations] 1792 | PyThread_delete_key_value(detail::get_internals().tstate); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:101:37: note: declared here 101 | Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyThread_delete_key_value(int key); | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h: In constructor ‘pybind11::gil_scoped_release::gil_scoped_release(bool)’: lib/pybind11/pybind11.h:1820:52: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations] 1820 | PyThread_set_key_value(key, nullptr); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:98:36: note: declared here 98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h: In destructor ‘pybind11::gil_scoped_release::~gil_scoped_release()’: lib/pybind11/pybind11.h:1833:47: warning: ‘int PyThread_set_key_value(int, void*)’ is deprecated [-Wdeprecated-declarations] 1833 | PyThread_set_key_value(key, tstate); | ^ In file included from /usr/local/include/python3.11/Python.h:89, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pythread.h:98:36: note: declared here 98 | Py_DEPRECATED(3.7) PyAPI_FUNC(int) PyThread_set_key_value(int key, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h: In function ‘pybind11::function pybind11::get_type_overload(const void*, const pybind11::detail::type_info*, const char*)’: lib/pybind11/pybind11.h:1890:49: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’? 1890 | PyFrameObject *frame = PyThreadState_Get()->frame; | ^~~~~ | cframe lib/pybind11/pybind11.h:1891:41: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 1891 | if (frame && (std::string) str(frame->f_code->co_name) == name && | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h:1892:14: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 1892 | frame->f_code->co_argcount > 0) { | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from src/pywrapper.cpp:1: lib/pybind11/pybind11.h:1895:18: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 1895 | frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0)); | ^~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ In file included from /usr/local/include/python3.11/Python.h:38, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: lib/pybind11/pybind11.h:1895:52: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 1895 | frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0)); | ^~ /usr/local/include/python3.11/pyport.h:24:38: note: in definition of macro ‘_Py_CAST’ 24 | #define _Py_CAST(type, expr) ((type)(expr)) | ^~~~ /usr/local/include/python3.11/cpython/tupleobject.h:30:38: note: in expansion of macro ‘_PyTuple_CAST’ 30 | #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index]) | ^~~~~~~~~~~~~ lib/pybind11/pybind11.h:1895:30: note: in expansion of macro ‘PyTuple_GET_ITEM’ 1895 | frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0)); | ^~~~~~~~~~~~~~~~ In file included from /usr/local/include/python3.11/Python.h:42, from lib/pybind11/detail/common.h:111, from lib/pybind11/pytypes.h:12, from lib/pybind11/cast.h:13, from lib/pybind11/attr.h:13, from lib/pybind11/pybind11.h:43, from src/pywrapper.cpp:1: /usr/local/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’} 22 | typedef struct _frame PyFrameObject; | ^~~~~~ error: command '/usr/bin/gcc' 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 richdem Running setup.py clean for richdem Failed to build richdem ERROR: Could not build wheels for richdem, which is required to install pyproject.toml-based projects ```
snowman2 commented 1 year ago

I investigated and the latest version on pypi is 0.3.4 from 2018 with a vendored older version of pybind11.

There are more recent releases: https://github.com/r-barnes/richdem/releases

If you install from source with a more recent release, it works.

Robinlovelace commented 1 year ago

Any way to get a version on pypi with a more recent version?

Robinlovelace commented 1 year ago

And how to install the more recent versions in the releases as an alternative to

pip install richdem

Many thanks.

snowman2 commented 1 year ago

And how to install the more recent versions in the releases

The readme has the instructions

Robinlovelace commented 1 year ago

And how to install the more recent versions in the releases

The readme has the instructions

You mean this?

https://github.com/r-barnes/richdem/blob/c5a183ada30fbd1b8587121e0d313b4cda9390c0/README.md?plain=1#L69-L84

I was hoping for instructions that didn't rely on git and that pointed to the releases that we can use to install the package as part of our CI workflows: https://github.com/geocompx/geocompy/blob/main/requirements.txt

See https://github.com/geocompx/geocompy/issues/191 for context, any guidance very much appreciated. Cc @michaeldorman

snowman2 commented 1 year ago

To build richdem, I downloaded the assets from the releases here:

https://github.com/r-barnes/richdem/releases

Then compiled richdem and then installed the python wrapper.

Robinlovelace commented 1 year ago

With apologies for newby question @snowman2, do you know commands from bash that will get that working? :pray:

snowman2 commented 1 year ago

In addition to the instructions, this is a helpful reference.

If compiling the code is problematic, I suggest using conda with the conda-forge channel to install richdem.

conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n env richdem
conda activate env