r-barnes / richdem

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

Error creating python wrapper #81

Open mdp0023 opened 5 months ago

mdp0023 commented 5 months ago

I was trying to run FSM using the python wrapper and came across two issues.

  1. Found an issue with dashes versus underscores in setup.cfg due to depreciation from setuptools (suggested fix in pull request #80)

  2. Issue with "generate_perlin_terrain" I executed the following in the terminal:

    git clone --recursive https://github.com/r-barnes/richdem.git ghrichdem
    cd ghrichdem/wrappers/pyrichdem
    pip install .

    and received an error message associated with geonerate_perlin_terrain. I was able to create the wrappers by commenting out line 137 of the ../ghichdem/wrappers/pyrichdem/src/pyrapper.cpp file, which is this line:

m.def("generate_perlin_terrain", &richdem::generate_perlin_terrain, "Generate random terrain using perlin noise", py::arg("array"), py::arg("seed"));

I'm not sure what is causing the error, or its overall impact on the wrappers. The complete error message is below:

Details

```shell × Building wheel for richdem (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [40 lines of output] Using RichDEM hash=eb7bac6, time=2024-05-22 09:51:05 -0700 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/cli.py -> build/lib.linux-x86_64-cpython-311/richdem copying richdem/__init__.py -> build/lib.linux-x86_64-cpython-311/richdem running build_ext COMPILER unix COMPILER ARGUMENTS: ['-std=c++17', '-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/src creating build/temp.linux-x86_64-cpython-311/lib/richdem/src/terrain_generation creating build/temp.linux-x86_64-cpython-311/src /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c lib/richdem/src/gdal.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/src/gdal.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c lib/richdem/src/random.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/src/random.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c lib/richdem/src/richdem.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/src/richdem.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c lib/richdem/src/terrain_generation/PerlinNoise.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/src/terrain_generation/PerlinNoise.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c lib/richdem/src/terrain_generation/terrain_generation.cpp -o build/temp.linux-x86_64-cpython-311/lib/richdem/src/terrain_generation/terrain_generation.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include -fPIC -DDOCTEST_CONFIG_DISABLE "-DRICHDEM_COMPILE_TIME=\"\\\"2024-05-22 09:51:05 -0700\\\"\"" -DRICHDEM_GIT_HASH=\"\\\"eb7bac6\\\"\" -D_USE_MATH_DEFINES -Ilib/richdem/include -I/tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include -I/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/include/python3.11 -c src/pywrapper.cpp -o build/temp.linux-x86_64-cpython-311/src/pywrapper.o -std=c++17 -g -fvisibility=hidden -O3 -Wno-unknown-pragmas src/pywrapper.cpp: In function 'void pybind11_init__richdem(pybind11::module_&)': src/pywrapper.cpp:137:8: error: no matching function for call to 'pybind11::module_::def(const char [24], , const char [43], pybind11::arg, pybind11::arg)' 137 | m.def("generate_perlin_terrain", &richdem::generate_perlin_terrain, "Generate random terrain using perlin noise", py::arg("array"), py::arg("seed")); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include/pybind11/numpy.h:12, from src/pywrapper.hpp:9, from src/pywrapper.cpp:1: /tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:1219:14: note: candidate: 'template pybind11::module_& pybind11::module_::def(const char*, Func&&, const Extra& ...)' 1219 | module_ &def(const char *name_, Func &&f, const Extra &...extra) { | ^~~ /tmp/pip-build-env-tzo0r9gt/overlay/lib/python3.11/site-packages/pybind11/include/pybind11/pybind11.h:1219:14: note: template argument deduction/substitution failed: src/pywrapper.cpp:137:8: note: couldn't deduce template parameter 'Func' 137 | m.def("generate_perlin_terrain", &richdem::generate_perlin_terrain, "Generate random terrain using perlin noise", py::arg("array"), py::arg("seed")); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: command '/home/mdp0023/miniconda3/envs/pygeoflood-test-env-py3-11/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1 [end of output] ```