diff --git a/.github/workflows/test_conda_install.yml b/.github/workflows/test_conda_install.yml new file mode 100644 index 0000000000..4e24ef78ea --- /dev/null +++ b/.github/workflows/test_conda_install.yml @@ -0,0 +1,58 @@ +name: Conda installation +on: + workflow_dispatch: + schedule: + - cron: '48 4 * * *' + pull_request: + branches: + - main + +jobs: + conda: + name: Conda installation + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-latest] + python-version: ['3.11', '3.12', '3.13'] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python-version }} + auto-update-conda: true + activate-environment: amici + - name: Install requirements + shell: bash -l {0} + run: | + conda install -c conda-forge compilers cmake + - name: Install AMICI + shell: bash -l {0} + run: | + pip3 install -v ./python/sdist + - name: Show environment + shell: bash -l {0} + run: | + python -c "import os; import pprint; pprint.pprint(dict(os.environ))" + which cmake + which ninja + ls -l /Users/runner/miniconda3/envs/amici/bin || true + - name: Install test dependencies + shell: bash -l {0} + run: | + # Install test extras (pytest, scipy, etc.) + pip3 install pytest pytest-cov scipy h5py antimony + - name: Test import + shell: bash -l {0} + run: | + python -c "from amici import _amici; print(_amici)" + python -m amici + - name: Run SBML import test + shell: bash -l {0} + # FIXME + continue-on-error: true + run: | + cd python/tests + pytest test_sbml_import.py::test_steadystate_simulation -sv diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac0432f8e..04de78ea9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.22) # src/CMakeLists.template.cmake cmake_policy(VERSION 3.22...3.31) +# We aren't using C++20 modules, so disable scanning for them to avoid +# clang-scan-deps-notfound errors. +# See also https://discourse.cmake.org/t/cmake-3-28-cmake-cxx-compiler-clang-scan-deps-notfound-not-found/9244/3 +set(CMAKE_CXX_SCAN_FOR_MODULES OFF) + project(amici) # misc options @@ -27,6 +32,7 @@ message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/doc/python_installation.rst b/doc/python_installation.rst index 46a08d95a1..0a7d876f6c 100644 --- a/doc/python_installation.rst +++ b/doc/python_installation.rst @@ -249,12 +249,6 @@ Installation under conda There is no amici conda recipe available yet. However, you can install AMICI using pip in a conda environment. -.. note:: - - It is possible, but we currently don't recommend using conda for installing - AMICI, as it commonly leads to conflicts with system installations of - libraries and compilers. - Create a minimal conda environment via: .. code-block:: bash @@ -286,25 +280,13 @@ Now, you are ready to use AMICI in the virtual environment. **conda on Mac** - If the above installation does not work for you, try installing AMICI via: + If the above installation does not work for you, try installing AMICI + using clang compilers provided by conda: .. code-block:: bash - CFLAGS="-stdlib=libc++" CC=clang CXX=clang pip3 install --verbose amici - - This will use the ``clang`` compiler. - - You will have to pass the same options when compiling any model later - on. This can be done by inserting the following code before model import: - - .. code-block:: python - - import os - os.environ['CC'] = 'clang' - os.environ['CXX'] = 'clang' - os.environ['CFLAGS'] = '-stdlib=libc++' - - (For further discussion see https://github.com/AMICI-dev/AMICI/issues/357) + conda install -c conda-forge compilers + pip install amici --no-cache Known issues: diff --git a/python/sdist/amici/exporters/sundials/templates/CMakeLists.template.cmake b/python/sdist/amici/exporters/sundials/templates/CMakeLists.template.cmake index f01626c164..6527056975 100644 --- a/python/sdist/amici/exporters/sundials/templates/CMakeLists.template.cmake +++ b/python/sdist/amici/exporters/sundials/templates/CMakeLists.template.cmake @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(TPL_MODELNAME) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index ecb4139e9b..1d9644c064 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -20,6 +20,10 @@ find_package( Python3 COMPONENTS Interpreter Development NumPy REQUIRED) +message( + STATUS + "Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}; Python3_LIBRARIES: ${Python3_LIBRARIES}" +) message( STATUS "Found numpy ${Python3_NumPy_VERSION} include dir ${Python3_NumPy_INCLUDE_DIRS}" @@ -112,7 +116,7 @@ set_target_properties( # NOTE: No public definitions of any dependency are forwarded to swig, they are # only used for compiling the swig-generated source file. Any definition that # are relevant for swig-code generation, need to be forwarded manually. -target_link_libraries(_amici amici Python3::Python) +target_link_libraries(_amici amici Python3::Module) if(WIN32) add_custom_command( TARGET _amici