22# This script does not work when crosscompiling.
33# Note: to make the initial changes as limited as possible the phrase
44# "MINICONDA" is retained for now, but the actual download and
5- # installation comes from Miniforge3. Only tests on Linux x86_64 so
6- # far, not (for example) on OSX.
5+ # installation comes from Miniforge3.
76
87# Send the version variables up one scope level from the caller of this macro
98macro (proxy_python_version )
@@ -28,12 +27,14 @@ function(download_and_use_miniconda)
2827 if (TARGET_WINDOWS)
2928 set (MINICONDA_PYTHON ${MINICONDA_INSTALL_DIR} /python.exe)
3029 set (CONDA ${MINICONDA_INSTALL_DIR} /Scripts/conda.exe)
30+ set (MAMBA ${MINICONDA_INSTALL_DIR} /Scripts/mamba.exe)
3131 set (PIP ${MINICONDA_INSTALL_DIR} /Scripts/pip.exe)
3232 else ()
3333 set (MINICONDA_PYTHON ${MINICONDA_INSTALL_DIR} /bin/python)
3434
3535 # execute using interpreter in case the miniconda install folder is in a long path and the script shebang doesn't work
36- set (CONDA ${MINICONDA_PYTHON} ${MINICONDA_INSTALL_DIR} /bin/conda)
36+ set (CONDA ${MINICONDA_PYTHON} ${MINICONDA_INSTALL_DIR} /bin/conda)
37+ set (MAMBA ${MINICONDA_INSTALL_DIR} /bin/mamba)
3738 set (PIP ${MINICONDA_PYTHON} ${MINICONDA_INSTALL_DIR} /bin/pip)
3839 endif ()
3940
@@ -158,26 +159,19 @@ function(download_and_use_miniconda)
158159 # if the miniconda version has been specified (-DMINICONDA_VERSION=...)
159160 # then do not update conda
160161 if (MINICONDA_AUTO)
161-
162- # not needed for miniforge:
163- # execute_process(COMMAND ${CONDA} install -y --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive)
164- # execute_process(COMMAND ${CONDA} update --all -y)
165162 execute_process (COMMAND ${CONDA} update conda -y )
166163 endif ()
164+ execute_process (COMMAND ${CONDA} install -y python=3.12 )
167165 execute_process (COMMAND ${MINICONDA_PYTHON} -m pip install pip --upgrade )
168166
167+ execute_process (COMMAND ${MINICONDA_PYTHON} -m pip install --no-cache-dir --no-binary=mpi4py mpi4py )
168+
169169 # Prefer non-mkl packages.
170170 # This is because if Amber is using MKL, when Python programs run they will try to talk to two
171171 # different MKL libraries at the same time: the MKL Miniconda python was linked with, and the MKL
172172 # Amber was linked with.
173173 # So, to fix this, we make sure Miniconda is not using MKL.
174- execute_process (COMMAND ${CONDA} install -y nomkl )
175-
176- execute_process (COMMAND ${CONDA} install -y -c conda-forge f90nml mrcfile pdb2pqr )
177- execute_process (COMMAND ${CONDA} install -y pandas )
178-
179- execute_process (COMMAND ${CONDA} install -y -q conda-build numpy=1.26.4 scipy cython=0.29 ipython notebook pytest
180- RESULT_VARIABLE PACKAGE_INSTALL_RETVAL )
174+ execute_process (COMMAND ${MAMBA} install -y -c conda-forge nomkl f90nml mrcfile pdb2pqr pandas numba gemmi rdkit conda-build numpy=1.26.4 scipy cython=0.29 ipython notebook pytest mock RESULT_VARIABLE PACKAGE_INSTALL_RETVAL )
181175 if (NOT ${PACKAGE_INSTALL_RETVAL} EQUAL 0)
182176 message (FATAL_ERROR "Installation of packages failed! Please fix what's wrong, or disable Miniconda." )
183177 endif ()
@@ -188,7 +182,7 @@ function(download_and_use_miniconda)
188182 execute_process (COMMAND ${MINICONDA_PYTHON} -m pip --cache-dir=${MINICONDA_INSTALL_DIR}/pkgs install matplotlib RESULT_VARIABLE MATPLOTLIB_RETVAL )
189183 if (NOT ${MATPLOTLIB_RETVAL} EQUAL 0)
190184 # try again with conda
191- execute_process (COMMAND ${CONDA } install -y -q matplotlib RESULT_VARIABLE MATPLOTLIB_RETVAL )
185+ execute_process (COMMAND ${MAMBA } install -y -q matplotlib RESULT_VARIABLE MATPLOTLIB_RETVAL )
192186 if (NOT ${MATPLOTLIB_RETVAL} EQUAL 0)
193187 message (FATAL_ERROR "Failed to install matplotlib! Please fix what's wrong, or disable Miniconda." )
194188 endif ()
@@ -198,7 +192,7 @@ function(download_and_use_miniconda)
198192 # the loser is always your own sanity!
199193 if (TARGET_WINDOWS AND MINGW)
200194 # Install a MinGW import library for python (discussed at https://github.com/Theano/Theano/issues/2087)
201- execute_process (COMMAND ${CONDA } install -y -q -c anaconda libpython )
195+ execute_process (COMMAND ${MAMBA } install -y -q -c anaconda libpython )
202196
203197 # die, preprocessor define that breaks the <cmath> header!
204198 # see https://github.com/python/cpython/pull/880
0 commit comments