赞
踩
显卡:RTX4070Ti
Anaconda 23.3.1
Ubuntu20.04 LTS
pytorch3d官方发布链接:https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md
conda create -n pytorch3d python=3.9
conda activate pytorch3d
conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
conda install pytorch3d -c pytorch3d
测试代码:
import sys import torch import pytorch3d from pytorch3d.utils import ico_sphere from pytorch3d.io import load_obj from pytorch3d.structures import Meshes from pytorch3d.ops import sample_points_from_meshes from pytorch3d.loss import chamfer_distance pyt_version_str=torch.__version__.split("+")[0].replace(".", "") version_str="".join([ f"py3{sys.version_info.minor}_cu", torch.version.cuda.replace(".",""), f"_pyt{pyt_version_str}" ]) print(version_str) print(torch.cuda.is_available()) print(torch.version.cuda) print(pytorch3d.__version__)
输出为:
py39_cu116_pyt1130
True
11.6
0.7.5
安装成功
第一次:
python =3.8,pytorch=2.1.0, cuda12.1
安装指令
conda create -n pyt3d python=3.8
conda activate pyt3d
conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=12.1 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
pip install black usort flake8 flake8-bugbear flake8-comprehensions
conda install pytorch3d -c pytorch3d
报错:
Package gst-plugins-base conflicts for:
pyqt -> qt-main=5.15 -> gst-plugins-base[version='>=1.12.2,<1.13.0a0|>=1.12.4,<1.13.0a0|>=1.14.0,<1.15.0a0|>=1.14.1,<1.15.0a0']
qt-main -> gst-plugins-base[version='>=1.14.0,<1.15.0a0|>=1.14.1,<1.15.0a0']The following specifications were found to be incompatible with your system:
- feature:/linux-64::__cuda==12.2=0
- feature:/linux-64::__glibc==2.31=0
.....手动省略
- zlib -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
- zstd -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
Your installed version is: 2.31
尝试去pytorch3d官方gthub问题板块找解决办法:
Can’t install pytorch3d using conda -> glibc error #1076
pytorch3d安装|踩坑指南
pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
version_str="".join([
f"py3{sys.version_info.minor}_cu",
torch.version.cuda.replace(".",""),
f"_pyt{pyt_version_str}"
])
用这个方法我安装成功,但是导入from pytorch3d.utils import ico_sphere这一句时报错:
ImportError: /xxxx/pytorch3d/pytorch3d/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC2ENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
又去官方issue找解决办法,就是各种试不同的python版本/cuda版本和pytorch版本的组合。最后试出了最终成功的版本,然后我发现这个组合和官方提供的一样,。。。。。。。
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。