RNO-G / mattak

RNO-G dataformats
1 stars 1 forks source link

Fails to build when used with pip install #35

Open sanyukta13 opened 7 months ago

sanyukta13 commented 7 months ago

I get this error when I try to install mattak using

pip install git+https://github.com/RNO-G/mattak

...
Building wheels for collected packages: mattak
  Building wheel for mattak (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mattak (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      *** scikit-build-core 0.8.1 using CMake 3.28.3 (wheel)
      *** Configuring CMake...
      2024-02-17 05:20:18,702 - scikit_build_core - WARNING - libdir/ldlibrary: /opt/conda/lib/libpython3.10.a is not a real file!
      2024-02-17 05:20:18,702 - scikit_build_core - WARNING - Can't find a Python library, got libdir=/opt/conda/lib, ldlibrary=libpython3.10.a, multiarch=x86_64-linux-gnu, masd=None
      loading initial cache file /tmp/tmp87wogpla/build/CMakeInit.txt
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- The C compiler identification is unknown
      -- The CXX compiler identification is unknown
      CMake Error at CMakeLists.txt:2 (project):
        No CMAKE_C_COMPILER could be found.

        Tell CMake where to find the compiler by setting either the environment
        variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
        the compiler, or to the compiler name if it is in the PATH.

      CMake Error at CMakeLists.txt:2 (project):
        No CMAKE_CXX_COMPILER could be found.

        Tell CMake where to find the compiler by setting either the environment
        variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
        to the compiler, or to the compiler name if it is in the PATH.

      -- Configuring incomplete, errors occurred!

      *** CMake configuration failed
      [end of output]

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

This piece of install was working perfectly fine before a few hours ago.

cozzyd commented 7 months ago

This is a result of the recent merge of the make-pip-installable branch, which adds compilation of C++ code (though for the uproot backend, this doesn't do anything interesting yet). You seem to not have a C++ compiler on your system, or at least cmake can't find it (but how do you have cmake available without a C++ compiler... unless perhaps scikit-build includes it?).

We could try to support the case of not having a C++ compiler, but I don't know how to do that with the current python build system (maybe @sjoerd-bouma does?), and it will eventually lead to a relatively large loss of functionality.

sjoerd-bouma commented 7 months ago

Ah : / yes, scikit-build-core automatically installs cmake at build time, though I had hoped it would figure out compilation as well... I'm guessing numpy/scipy etc get around this by providing wheels for all platforms and python versions? Which is unfortunately not an option for us.

@sanyukta13 - I think you are on a Mac, in which case try running

xcode-select --install

from the terminal, which I hope should install the required compilers.

@cozzyd - I'm not sure how much value there is in supporting the pure python version of mattak... right now it would be okay, but as you mention at some point the functionality will diverge, in which case I'd probably prefer to raise an installation error by default rather than quietly defaulting to the python only version. We should however probably add this information to the documentation and/or figure out how to raise a more helpful error message?

fschlueter commented 7 months ago

I guess this is still open?

fschlueter commented 1 week ago

@sjoerd-bouma can we close this?