尝试导入 OPCCalculator 时出现操作系统错误

问题描述 投票:0回答:1

我在导入计算器 (OCPCalculator) 时遇到问题。我卸载了现有的 torch 版本并安装了支持该任务的版本。但它仍然给我一个操作系统错误。

代码:

from fairchem.core.common.relaxation.ase_utils import OCPCalculator
import ase.io
from ase.optimize import BFGS

错误:

OSError   Traceback (most recent call last)/var/folders/n7/96_5cstj2sn6g5ll0b979w380000gn/T/ipykernel_49125/1241704498.py in <module>
----> 1 from fairchem.core.common.relaxation.ase_utils import OCPCalculator
  2 import ase.io
  3 from ase.optimize import BFGS
~/opt/anaconda3/lib/python3.9/site-packages/fairchem/core/common/relaxation/ase_utils.py in <module>
 24 
 25 from fairchem.core.common.registry import registry
---> 26 from fairchem.core.common.utils import (
 27     load_config,
 28     setup_imports,

~/opt/anaconda3/lib/python3.9/site-packages/fairchem/core/common/utils.py in <module>
 30 import torch
 31 import torch.nn as nn
---> 32 import torch_geometric
~/opt/anaconda3/lib/python3.9/sitepackages/torch_geometric/__init__.py in <module>
 11 import torch_geometric.loader
 12 import torch_geometric.transforms
---> 13 import torch_geometric.datasets
...
384             self._handle = handle

OSError: 
dlopen(/Users/roshnidantuluri/opt/anaconda3/lib/python3.9/sitepackages/torch_cluster/_version_cpu.so, 0x0006): 
Symbol not found: __ZN3c1017RegisterOperatorsD1Ev
Referenced from: <6A95460A-9602-33F2-92B2-6A9C90B59457>/Users/roshnidantuluri/opt/anaconda3/lib/python3.9/site-packages/torch_cluster/_version_cpu.so
Expected in:     <709C1DF5-D253-3C66-87E2-C99FD3A259DF>/Users/roshnidantuluri/opt/anaconda3/lib/python3.9/site-packages/torch/lib/libtorch_cpu.dylib
python torch oserror
1个回答
0
投票

您还需要安装

[torch_geometric][1]
[torch_scatter][1]
使用
fairchem.core
中的模块的软件包。使用 Python 3.10 或更高版本(我使用 Python 3.10.14)创建
venv
或 anaconda 环境,并按照以下安装步骤操作:

pip install fairchem-core
pip install torch_geometric torch-scatter

然后运行以下命令:

from fairchem.core import OCPCalculator
© www.soinside.com 2019 - 2024. All rights reserved.