xtensor-stack / xtensor-python

Python bindings for xtensor
BSD 3-Clause "New" or "Revised" License
347 stars 58 forks source link

Adding examples (full-working) #218

Closed tdegeus closed 3 years ago

tdegeus commented 4 years ago

I'm starting adding some full-working examples to the docs. At first I will implement the strategies described by @JohanMabille here

I'm still having trouble getting the first example working, in particular the CMakeLists.txt is apparently insufficient as ~/miniconda3/envs/test/include/xtensor-python/pycontainer.hpp:28:10: fatal error: 'numpy/arrayobject.h' file not found

Thereafter it would be good to hear your opinions on what kind of examples to include @wolfv @JohanMabille @SylvainCorlay. If you agree I would probably include building the example in the CI.

wolfv commented 4 years ago

Cool! If you use this CMake file here: https://github.com/xtensor-stack/xtensor-python/blob/master/cmake/FindNumPy.cmake

I think it should help in finding the include directory for the NumPy headers.

tdegeus commented 4 years ago

Thanks @wolfv . By default my cmake does not find the FindNumPy.cmake when I install xtensor-python with conda. I.e. with

find_package(NumPy REQUIRED)

I get

CMake Warning at CMakeLists.txt:9 (find_package):
  By not providing "FindNumPy.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "NumPy", but
  CMake did not find one.

  Could not find a package configuration file provided by "NumPy" with any of
  the following names:

    NumPyConfig.cmake
    numpy-config.cmake

  Add the installation prefix of "NumPy" to CMAKE_PREFIX_PATH or set
  "NumPy_DIR" to a directory containing one of the above files.  If "NumPy"
  provides a separate development package or SDK, be sure it has been
  installed.
tdegeus commented 3 years ago

Integrated in https://github.com/xtensor-stack/xtensor-python/pull/256