AMICI-dev / AMICI

Advanced Multilanguage Interface to CVODES and IDAS
https://amici.readthedocs.io/
Other
108 stars 30 forks source link

Fix to conda installation. #2402

Closed BartoszBartmanski closed 3 months ago

BartoszBartmanski commented 5 months ago

Adding cmake flag to specify path to ar executable fixed errors in installation in a conda env.

Specifically in a conda env made with:

conda create -c conda-forge -n amici blas cmake gcc make pip python==3.11 swig suitesparse binutils gxx hdf5
conda activate amici
export BLAS_LIBS=-lopenblas
pip install amici
dweindl commented 5 months ago

Thanks for the contribution, @BartoszBartmanski. I am surprised cmake doesn't manage to do that automatically. Could you please briefly describe what went wrong before this change? Which ar was found? None?

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 76.48%. Comparing base (4d40911) to head (eff9789). Report is 95 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/graphs/tree.svg?width=650&height=150&src=pr&token=1bt9lbspzk&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev)](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) ```diff @@ Coverage Diff @@ ## master #2402 +/- ## ========================================== - Coverage 77.73% 76.48% -1.26% ========================================== Files 324 319 -5 Lines 20864 20703 -161 Branches 1458 1458 ========================================== - Hits 16219 15834 -385 - Misses 4642 4865 +223 - Partials 3 4 +1 ``` | [Flag](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | Coverage Δ | | |---|---|---| | [cpp](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `76.28% <ø> (+2.77%)` | :arrow_up: | | [cpp_python](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `34.23% <ø> (ø)` | | | [petab](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `?` | | | [python](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `72.43% <ø> (+0.15%)` | :arrow_up: | | [sbmlsuite](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev) | `?` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev#carryforward-flags-in-the-pull-request-comment) to find out more. [see 22 files with indirect coverage changes](https://app.codecov.io/gh/AMICI-dev/AMICI/pull/2402/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AMICI-dev)
BartoszBartmanski commented 5 months ago

Hi @dweindl! I get the following error message:

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

  × Building wheel for amici (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [152 lines of output]
      WARNING setuptools_scm._integration.setuptools pyproject.toml does not contain a tool.setuptools_scm section
      running AmiciInstall
      running bdist_wheel
      running build
      running build_py
      running AmiciBuildPy
      running build_ext
      ------------------------------ SuiteSparse_config ------------------------------
      -- Building SuiteSparse_config version: v7.6.0 (Jan 20, 2024)
      -- The C compiler identification is GNU 13.2.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /opt/miniconda3/envs/ode_sim/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Source:           /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/ThirdParty/SuiteSparse/SuiteSparse_config
      -- Build:            /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config
      -- Install lib:      lib
      -- Install include:  include/suitesparse
      -- Install bin:      bin
      -- Install pkg-file: lib
      -- Install rpath:    $ORIGIN
      -- Build   rpath:
      -- Build type:       Release
      -- Fortran:          not enabled
      -- CUDA:             not enabled
      -- C to Fortran calling protocol:
      --     SUITESPARSE_HAS_FORTRAN  : OFF
      --     FortranCInterface_GLOBAL_MACRO  : (name,NAME) name##_
      --     FortranCInterface_GLOBAL__MACRO : (name,NAME) name##_
      -- Found OpenMP_C: -fopenmp (found version "4.5")
      -- Found OpenMP: TRUE (found version "4.5") found components: C
      -- SuiteSparse_config has OpenMP: ON
      -- Looking for clock_gettime
      -- Looking for clock_gettime - found
      -- Using clock_gettime without librt
      -- Found ANY 64-bit BLAS
      -- Looking for fmax
      -- Looking for fmax - not found
      -- OpenMP C libraries:      /opt/miniconda3/envs/ode_sim/x86_64-conda-linux-gnu/lib/libgomp.so;/opt/miniconda3/envs/ode_sim/x86_64-conda-linux-gnu/sysroot/usr/lib/libpthread.so
      -- OpenMP C include:
      -- OpenMP C flags:          -fopenmp
      -- ------------------------------------------------------------------------
      -- SuiteSparse CMAKE report for: SuiteSparseConfig
      -- ------------------------------------------------------------------------
      -- inside common SuiteSparse root:  OFF
      -- install in SuiteSparse/lib and SuiteSparse/include: OFF
      -- build type:           Release
      -- BUILD_SHARED_LIBS:    OFF
      -- BUILD_STATIC_LIBS:    ON
      -- C compiler:           /opt/miniconda3/envs/ode_sim/bin/cc
      -- C flags:
      -- C++ compiler:
      -- C++ flags:
      -- C Flags release:      -O3 -DNDEBUG
      -- C++ Flags release:
      -- Fortran compiler:     none
      -- compile definitions:  BLAS_ANY;BLAS64
      -- BLAS integer:         int64_t
      -- ------------------------------------------------------------------------
      -- Configuring done (0.7s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config
      Change Dir: '/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config'

      Run Build Command(s): /tmp/pip-build-env-rahsqoq7/overlay/bin/ninja -v -j 1
      [1/2] /opt/miniconda3/envs/ode_sim/bin/cc -DBLAS64 -DBLAS_ANY -I/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config -I/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/ThirdParty/SuiteSparse/SuiteSparse_config -O3 -DNDEBUG -std=gnu11 -fPIC -fopenmp -MD -MT CMakeFiles/SuiteSparseConfig_static.dir/SuiteSparse_config.c.o -MF CMakeFiles/SuiteSparseConfig_static.dir/SuiteSparse_config.c.o.d -o CMakeFiles/SuiteSparseConfig_static.dir/SuiteSparse_config.c.o -c /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c
      [2/2] : && /tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/cmake/data/bin/cmake -E rm -f libsuitesparseconfig.a && CMAKE_AR-NOTFOUND qc libsuitesparseconfig.a  CMakeFiles/SuiteSparseConfig_static.dir/SuiteSparse_config.c.o && :
      FAILED: libsuitesparseconfig.a
      : && /tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/cmake/data/bin/cmake -E rm -f libsuitesparseconfig.a && CMAKE_AR-NOTFOUND qc libsuitesparseconfig.a  CMakeFiles/SuiteSparseConfig_static.dir/SuiteSparse_config.c.o && :
      /bin/sh: 1: CMAKE_AR-NOTFOUND: not found
      ninja: build stopped: subcommand failed.

      running AmiciBuildCMakeExtension

      ==> Configuring:
      $ cmake -S /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/ThirdParty/SuiteSparse/SuiteSparse_config -B /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/lib.linux-x86_64-cpython-311/amici -DCMAKE_MAKE_PROGRAM=/tmp/pip-build-env-rahsqoq7/overlay/bin/ninja -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_MODULE_PATH=/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBLAS_LIBRARIES=dummy -DSUITESPARSE_USE_64BIT_BLAS=ON -DSUITESPARSE_USE_CUDA=OFF -DSUITESPARSE_USE_FORTRAN=OFF

      ==> Building:
      $ cmake --build /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config --config Release

      ==> Installing:
      $ cmake --install /tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config

      Traceback (most recent call last):
        File "/opt/miniconda3/envs/ode_sim/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/miniconda3/envs/ode_sim/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/miniconda3/envs/ode_sim/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 195, in <module>
        File "<string>", line 179, in main
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/custom_commands.py", line 124, in run
          self.run_command("build_ext")
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/custom_commands.py", line 160, in run
          result = super().run()
                   ^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/cmake_build_extension/build_extension.py", line 113, in run
          self.build_extension(ext)
        File "/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/amici/custom_commands.py", line 188, in build_extension
          super().build_extension(ext)
        File "/tmp/pip-build-env-rahsqoq7/overlay/lib/python3.11/site-packages/cmake_build_extension/build_extension.py", line 230, in build_extension
          subprocess.check_call(build_command)
        File "/opt/miniconda3/envs/ode_sim/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '/tmp/pip-install-mjhecfdx/amici_5c0a6a88de2c44729af2c8b954fd275b/build/temp.linux-x86_64-cpython-311_SuiteSparse_config', '--config', 'Release']' returned non-zero exit status 1.
      [end of output]

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

However, since submitting the pull request I've found that installing binutils package within the same conda environment solves the issue as well

dweindl commented 3 months ago

I've found that installing binutils package within the same conda environment solves the issue as well

Thanks for the update and sorry for the late response.

In that case, I'd rather add a comment to the installation documentation to avoid breaking things on other setups. Thanks for reporting/investigating.