在执行以下操作时,我遇到了与 miniforge、Apple Silicon (M1) 相同的场景:
# Exclude external factors in my environment
$> mv ~/.zshrc ~/.not_zshrc
<close/open terminal>
$> curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
$> sh Miniforge3-MacOSX-arm64.sh -b -p ~/miniforge3
$> export PATH=~/miniforge3/bin:$PATH
$> conda init zsh
<close/open terminal>
$> conda create -n test clang_osx-64
$> conda activate test
所涉及的激活脚本是这样构建的:
if [ "@CONDA_BUILD_CROSS_COMPILATION@" = "1" ]; then
_CMAKE_ARGS="${_CMAKE_ARGS} -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=@UNAME_MACHINE@ -DCMAKE_SYSTEM_VERSION=@UNAME_KERNEL_RELEASE@"
_MESON_ARGS="${_MESON_ARGS} --cross-file $BUILD_PREFIX/meson_cross_file.txt"
echo "[host_machine]" > $BUILD_PREFIX/meson_cross_file.txt
echo "system = 'darwin'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "cpu = '@UNAME_MACHINE@'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "cpu_family = '@MESON_CPU_FAMILY@'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "endian = 'little'" >> $BUILD_PREFIX/meson_cross_file.txt
fi
我相信这是由于 Conda-Forge 的原料持续集成无法访问 Apple Silicon,因为它们构建了我们都使用的可爱的二进制文件(他们使用 Intel/AMD 架构来构建 Arm64;即交叉编译)。然后设置并传播给那些实际使用所述硬件的人。
不幸的是,这会创建一个始终真实的激活:
if [ "1" = "1" ]; then
_CMAKE_ARGS="${_CMAKE_ARGS} -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_SYSTEM_VERSION=13.4.0"
_MESON_ARGS="${_MESON_ARGS} --cross-file $BUILD_PREFIX/meson_cross_file.txt"
echo "[host_machine]" > $BUILD_PREFIX/meson_cross_file.txt
echo "system = 'darwin'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "cpu = 'x86_64'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "cpu_family = 'x86_64'" >> $BUILD_PREFIX/meson_cross_file.txt
echo "endian = 'little'" >> $BUILD_PREFIX/meson_cross_file.txt
fi
虽然不是修复,但您可以在激活事件之前将 BUILD_PREFIX 设置为某个可写区域:
BUILD_PREFIX="/some/writable/dir"
conda activate test
但是,我宁愿忽略这条消息。BUILD_PREFIX 实际上只在conda build
操作期间使用(据我所知)。