无法使用 fermitools 激活 Conda 环境
Posted
技术标签:
【中文标题】无法使用 fermitools 激活 Conda 环境【英文标题】:Cannot activate Conda environment with fermitools 【发布时间】:2022-01-22 21:07:37 【问题描述】:我正在尝试使用命令激活安装了 fermitools (2.0.8) 的 Conda 环境(请参阅 docs)
conda activate fermi
之后它会向我显示下面的消息。 如何解决以下错误?
系统详情
Mac OS 终端 Mac OS Monterey 12.1错误信息
input_line_1:1:2: **error**: module 'Darwin' uses additional module map
'/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach_machine.modulemap'
used when the module was built
#include <new>
^
input_line_1:1:2: note: imported by module 'std' in '/opt/anaconda3/envs/fermi/lib/std.pcm'
Warning in cling::IncrementalParser::CheckABICompatibility(): Failed to extract C++ standard library version.
Warning in cling::IncrementalParser::CheckABICompatibility(): Possible C++ standard library mismatch, compiled with _LIBCPP_ABI_VERSION '1' Extraction of runtime standard library version was: '' input_line_2:1:2: **error**: module 'Darwin' uses additional module map
'/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach_machine.modulemap' used when the module was built
#include "cling/Interpreter/RuntimeUniverse.h"
^
input_line_2:1:2: note: imported by module 'std' in '/opt/anaconda3/envs/fermi/lib/std.pcm'
input_line_2:1:2: note: imported by module 'Cling_Runtime' in
'/opt/anaconda3/envs/fermi/lib/Cling_Runtime.pcm'
Failed to load module std
Failed to load module std
Failed to load module Cling_Runtime
In file included from input_line_7:36:
In file included from /opt/anaconda3/envs/fermi/bin/../include/c++/v1/cassert:20:
In file included from /opt/anaconda3/envs/fermi/etc//cling/lib/clang/5.0.0/include/assert.h:8: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:69:26:
**error**: expected function body after function declarator void abort(void) __dead2 __cold;
^
IncrementalExecutor::executeFunction: symbol '_ZN5cling7runtime6gClingE' unresolved while linking function '_GLOBAL__sub_I_cling_module_12'! You are probably missing the definition of cling::runtime::gCling Maybe you need to load the corresponding shared library?
*** Break *** segmentation violation [/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info) [<unknown binary>] (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCling.6.22.06.so] cling::Value::isVoid() const (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCling.6.22.06.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/opt/anaconda3/envs/fermi/lib/libRint.6.22.06.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/opt/anaconda3/envs/fermi/lib/libRint.6.22.06.so] TRint::HandleTermInput() (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCore.6.22.06.so] TUnixSystem::CheckDescriptors() (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCore.6.22.06.so] TUnixSystem::DispatchOneEvent(bool) (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCore.6.22.06.so] TSystem::InnerLoop() (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCore.6.22.06.so] TSystem::Run() (no debug info)
[/opt/anaconda3/envs/fermi/lib/libCore.6.22.06.so] TApplication::Run(bool) (no debug info)
[/opt/anaconda3/envs/fermi/lib/libRint.6.22.06.so] TRint::Run(bool) (no debug info)
[/opt/anaconda3/envs/fermi/bin/root.exe] main (no debug info)
[/usr/lib/dyld] start (no debug info)
IncrementalExecutor::executeFunction: symbol '_ZN5cling7runtime6gClingE' unresolved while linking [cling interface function]! You are probably missing the definition of cling::runtime::gCling
【问题讨论】:
【参考方案1】:缺少符号通常意味着存在针对特定动态库的编译代码,但您安装了该库的不同版本。对于 Conda,这通常是由通道混合引起的,即从 Anaconda Cloud 通道安装动态库,该通道与构建包时使用的通道不同。
不过,Monterey 相当新,因此可能需要解决一些系统层面的问题。例如,我认为新的 MacOS 总是需要安装新的 XCode 命令行工具。如果您需要下载一些默认情况下不随 MacOS 12 提供的旧版 SDK,我不会感到惊讶。
Conda 通道混合
要在 Conda 端进行调试,应该查看包的来源渠道,即 conda list -n fermi
。根据the documentation 的说法,conda-forge 频道应该具有最高优先级,所以我希望除了各种 fermitools
包之外几乎所有东西都来自那里。
在 osx-64 上进行测试,我按照当前文档没有问题,除了必须有 channel_priority: flexible
:
## also, use mamba
CONDA_CHANNEL_PRIORITY mamba create -n fermi -c conda-forge -c fermi fermitools python=3 clhep=2.4.4.1
人们还可以通过查看运行激活的内容来深入了解它在激活时崩溃的位置:
conda shell.posix activate fermi
它将列出(不评估)激活期间运行的所有命令。
但是,我只会专注于使用正确的频道进行干净的安装。
【讨论】:
当我打开 .condarx 文件时,它只显示默认值,没有 Conda-forge 这是什么意思?? @parthpatil 是一个全局配置。如果您完全使用文档中所述的命令,Conda 将优先考虑 conda-forge 通道。以上是关于无法使用 fermitools 激活 Conda 环境的主要内容,如果未能解决你的问题,请参考以下文章
[Win11] ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块 Conda无法激活环境