[torch]安装遇到的问题

本文记录了在Tsubame上安装Torch过程中遇到的OpenBLAS无法安装、CMake复制文件失败、quota超过限制等问题,以及如何通过建立软链接、修改文件权限、使用本地安装cmake等方式逐一解决的过程。最后成功安装了hdf5和rnn库,但遇到了cuda runtime error (30),通过更新驱动和库解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近提特征提的整个tsubame的空间都要满了..

1

今天安torch,http://torch.ch/docs/getting-started.html

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

tsubame没法和外部网络联系,所以我是先git clone到本机上后,scp到tsubame的.
第二行安装的是一些依赖库啥的, 我就没运行第二行代码.
第三行运行后,

Linking C shared module libtorch.so
[100%] Built target torch
cd build && make install
[  3%] Built target luaT
[ 50%] Built target TH
[100%] Built target torch
Install the project...
-- Install configuration: "Release"
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchExports.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchExports-release.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchConfig.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchWrap.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchPathsInit.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/share/cmake/torch/TorchPackage.cmake
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lib/libtorch.so
-- Set runtime path of "/work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lib/libtorch.so" to "$ORIGIN/../lib:/work1/t2g-shinoda2011/15M54105/software/torch/install/lib:/usr/apps.sp3/isv/ansys_inc/16.2/v162/Framework/bin/Linux64"
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/init.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/File.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/Tensor.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/CmdLine.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/FFI.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/Tester.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/TestSuite.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/test.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/README.md
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/doc
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/doc/random.md
CMake Error at cmake_install.cmake:101 (FILE):
  file INSTALL cannot copy file
  "/work1/t2g-shinoda2011/15M54105/software/torch/pkg/torch/doc/random.md" to
  "/work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/doc/random.md".

我把整个torch文件夹移除后,又来了一遍.

-- Set runtime path of "/work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lib/libtorch.so" to "$ORIGIN/../lib:/work1/t2g-shinoda2011/15M54105/software/torch/install/lib:/usr/apps.sp3/isv/ansys_inc/16.2/v162/Framework/bin/Linux64"
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/init.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/File.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/Tensor.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/CmdLine.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/FFI.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/Tester.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/TestSuite.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/test.lua
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/README.md
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/doc
-- Installing: /work1/t2g-shinoda2011/15M54105/software/torch/install/lib/luarocks/rocks/torch/scm-1/lua/torch/doc/random.md
-- Installing: /work1/t2
### torch 安装错误解决方案 在 Windows 10 下安装 PyTorch 及其扩展包(如 `torch_scatter` 和 `torch_sparse`)时可能会遇到各种问题,以下是针对常见错误的综合解决方案。 #### 1. 环境配置 确保 Python 版本与 PyTorch 的兼容性。PyTorch 支持的最低版本通常为 Python 3.7 或更高版本[^1]。建议使用 Anaconda 创建虚拟环境来管理依赖项: ```bash conda create -n pytorch_env python=3.9 conda activate pytorch_env ``` 如果未安装 CUDA,则需选择 CPU-only 版本;否则应根据显卡驱动程序支持的 CUDA 版本来匹配合适的 PyTorch 轮子文件。 #### 2. 使用官方推荐的方式安装 PyTorch 访问 [PyTorch官网](https://pytorch.org/get-started/locally/) 并根据操作系统、CUDA 配置自动生成适合的安装命令。例如,在不启用 GPU 加速的情况下可以运行如下指令完成基础框架部署: ```bash pip install torch torchvision torchaudio cpuonly ``` 对于需要 GPU 支持的情况,请替换相应参数以加载对应于本地硬件条件下的预编译二进制文件。 #### 3. 处理特定组件安装失败情况 当尝试通过 pip 单独获取某些附加模块像 `torch_scatter`, 如果直接调用标准方法报错提示无法构建 whl 文件时, 推荐采用 conda 渠道或者手动指定源地址来进行操作: - **Conda 方式**: ```bash conda install -c pyg torch-scatter ``` - **Pre-built Wheels 方法**: 访问 https://pytorch-geometric.com/whl/, 找到适合自己计算平台(CPU/CUDA X.X)以及当前已安裝之 PyTorch 版本相吻合的链接後执行下载并安装动作. #### 4. 自定义目标目录安装(备用选项) 若常规途径依旧碰壁可考虑更改默认存储位置规避权限冲突等问题发生 : ```bash pip install --upgrade pip setuptools wheel pip install --target=D:\custom_path\lib\site-packages torch-scatter ``` 注意调整实际路径至个人需求处[^3]. --- ### 示例代码片段展示如何验证安装成功与否 下面提供了一段简单的测试脚本用于确认所装设库能否正常运作无误. ```python import torch from torch_geometric.data import Data edge_index = torch.tensor([[0, 1], [1, 0]], dtype=torch.long) data = Data(edge_index=edge_index, num_nodes=2) print(data) ``` 如果一切顺利的话应该能够看到类似于这样的输出结果而不抛异常 : ``` Data(edge_index=[2, 2], num_nodes=2) ``` ---
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值