我尝试了以下代码并得到了导入错误:
import os
import torch
import matplotlib.pyplot as plt
import cv2
from pytorch3d.utils import ico_sphere
import numpy as np
from tqdm.notebook import tqdm
from pytorch3d.io import load_objs_as_meshes, save_obj
from pytorch3d.loss import (
chamfer_distance,
mesh_edge_loss,
mesh_laplacian_smoothing,
mesh_normal_consistency,
)
from pytorch3d.structures import Meshes
from pytorch3d.renderer import (
look_at_view_transform,
OpenGLPerspectiveCameras,
PointLights,
DirectionalLights,
Materials,
RasterizationSettings,
MeshRenderer,
MeshRasterizer,
SoftPhongShader,
SoftSilhouetteShader,
SoftPhongShader,
TexturesVertex
)
在这里,我提供了错误的完整回溯:
Traceback (most recent call last):
File "/home/parallels/Documents/Program_training/Framework/Framework-HW5/run.py", line 5, in <module>
from pytorch3d.utils import ico_sphere
File "/home/parallels/anaconda3/lib/python3.8/site-packages/pytorch3d/utils/__init__.py", line 3, in <module>
from .ico_sphere import ico_sphere
File "/home/parallels/anaconda3/lib/python3.8/site-packages/pytorch3d/utils/ico_sphere.py", line 5, in <module>
from pytorch3d.ops.subdivide_meshes import SubdivideMeshes
File "/home/parallels/anaconda3/lib/python3.8/site-packages/pytorch3d/ops/__init__.py", line 5, in <module>
from .graph_conv import GraphConv
File "/home/parallels/anaconda3/lib/python3.8/site-packages/pytorch3d/ops/graph_conv.py", line 8, in <module>
from pytorch3d import _C
ImportError: libcudart.so.10.1: cannot open shared object file: No such file or directory
我在 Ubuntu 虚拟机上运行我的代码,我的设备是没有 cuda 支持 gpu 的 Mac,所以我以这种方式安装 pytorch 和 pytorch3d,对于 pytorch:
pip3 install torch==1.10.0+cpu torchvision==0.11.1+cpu torchaudio==0.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
对于 pytorch3d:
pip install pytorch3d
请帮我解决这个错误,任何帮助将不胜感激。