安装torch-sparse 0.6.12时出现“‘CppTypeToScalarType’不是‘c10’的成员”和“错误:::value未被声明”

1 投票
0 回答
24 浏览
提问于 2025-04-12 06:05

我想在一个运行Red Hat Enterprise Linux 8.6(Ootpa)的高性能集群上运行这个git仓库里的代码。为了准备,我通过ssl连接,设置了一个Python 3.6的虚拟环境'hgclr_venv',克隆了这个仓库,并按照requirement.txt里的说明安装了所有必要的包,过程还算顺利。唯一的问题是最后一个包,torch-sparse 0.6.12,安装不成功。

我尝试了pip install torch-sparse==0.6.12,结果出现了我见过的最长的错误信息。下面是我的命令和完整的输出。

我在网上搜索解决方案,但没有找到有用的信息。有一个建议是安装GCC,但我检查后发现它已经安装好了。

不幸的是,我甚至不知道该从哪里开始查找这个错误信息中的线索,非常希望能得到一些帮助。

(hgclr_venv) [ul_rpv49@uc2n996 hgclr_venv]$ pip install torch-sparse==0.6.12
Collecting torch-sparse==0.6.12
  Using cached torch_sparse-0.6.12.tar.gz (43 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: scipy in ./lib/python3.6/site-packages (from torch-sparse==0.6.12) (1.5.4)
Requirement already satisfied: numpy>=1.14.5 in ./lib/python3.6/site-packages (from scipy->torch-sparse==0.6.12) (1.19.5)
Using legacy 'setup.py install' for torch-sparse, since package 'wheel' is not installed.
Installing collected packages: torch-sparse
    Running setup.py install for torch-sparse ... error
    ERROR: Command errored out with exit status 1:
     command: /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/scratch/pip-install-cju09brx/torch-sparse_0e0832cccd184eb19ed9a06356a54e91/setup.py'"'"'; __file__='"'"'/scratch/pip-install-cju09brx/torch-sparse_0e0832cccd184eb19ed9a06356a54e91/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /scratch/pip-record-gxct63ib/install-record.txt --single-version-externally-managed --compile --install-headers /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/include/site/python3.6/torch-sparse
         cwd: /scratch/pip-install-cju09brx/torch-sparse_0e0832cccd184eb19ed9a06356a54e91/
    Complete output (85 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/__init__.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/add.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/bandwidth.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/cat.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/coalesce.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/convert.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/diag.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/eye.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/index_select.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/masked_select.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/matmul.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/metis.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/mul.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/narrow.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/padding.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/permute.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/reduce.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/rw.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/saint.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/sample.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/select.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/spmm.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/spspmm.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/storage.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/tensor.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/transpose.py -> build/lib.linux-x86_64-3.6/torch_sparse
    copying torch_sparse/utils.py -> build/lib.linux-x86_64-3.6/torch_sparse
    running build_ext
    building 'torch_sparse._convert_cpu' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/csrc
    creating build/temp.linux-x86_64-3.6/csrc/cpu
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Icsrc -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/TH -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/THC -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/include -I/usr/include/python3.6m -c csrc/convert.cpp -o build/temp.linux-x86_64-3.6/csrc/convert.o -O2 -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_convert_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Icsrc -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/TH -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/THC -I/pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/include -I/usr/include/python3.6m -c csrc/cpu/convert_cpu.cpp -o build/temp.linux-x86_64-3.6/csrc/cpu/convert_cpu.o -O2 -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_convert_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    In file included from csrc/cpu/convert_cpu.cpp:5:
    csrc/cpu/utils.h: In function ‘at::Tensor from_vector(const std::vector<T>&, bool)’:
    csrc/cpu/utils.h:24:42: error: ‘CppTypeToScalarType’ is not a member of ‘c10’
                                         c10::CppTypeToScalarType<scalar_t>::value);
                                              ^~~~~~~~~~~~~~~~~~~
    csrc/cpu/utils.h:24:42: note: suggested alternative: ‘typeMetaToScalarType’
                                         c10::CppTypeToScalarType<scalar_t>::value);
                                              ^~~~~~~~~~~~~~~~~~~
                                              typeMetaToScalarType
    csrc/cpu/utils.h:24:70: error: expected primary-expression before ‘>’ token
                                         c10::CppTypeToScalarType<scalar_t>::value);
                                                                          ^
    csrc/cpu/utils.h:24:73: error: ‘::value’ has not been declared
                                         c10::CppTypeToScalarType<scalar_t>::value);
                                                                             ^~~~~
    csrc/cpu/utils.h:24:73: note: suggested alternative:
    In file included from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/Dimname.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/NamedTensor.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:19,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/Tensor.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/Context.h:4,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/ATen.h:5,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                     from /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/torch/extension.h:4,
                     from csrc/cpu/convert_cpu.h:3,
                     from csrc/cpu/convert_cpu.cpp:1:
    /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/aten_interned_strings.h:1024:9: note:   ‘c10::attr::value’
     _(attr, value) \
             ^~~~~
    /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/interned_strings.h:414:35: note: in definition of macro ‘DEFINE_SYMBOL’
       namespace ns { constexpr Symbol s(static_cast<unique_t>(_keys::ns##_##s)); }
                                       ^
    /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/interned_strings.h:242:3: note: in expansion of macro ‘FORALL_ATTR_BASE_SYMBOLS’
       FORALL_ATTR_BASE_SYMBOLS(_)        \
       ^~~~~~~~~~~~~~~~~~~~~~~~
    /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/lib64/python3.6/site-packages/torch/include/ATen/core/interned_strings.h:415:1: note: in expansion of macro ‘FORALL_NS_SYMBOLS’
     FORALL_NS_SYMBOLS(DEFINE_SYMBOL)
     ^~~~~~~~~~~~~~~~~
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/scratch/pip-install-cju09brx/torch-sparse_0e0832cccd184eb19ed9a06356a54e91/setup.py'"'"'; __file__='"'"'/scratch/pip-install-cju09brx/torch-sparse_0e0832cccd184eb19ed9a06356a54e91/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /scratch/pip-record-gxct63ib/install-record.txt --single-version-externally-managed --compile --install-headers /pfs/data5/home/ul/ul_student/ul_rpv49/contrastive-htc/hgclr_venv/include/site/python3.6/torch-sparse Check the logs for full command output.

0 个回答

暂无回答

撰写回答