python应用安装报错,部分信息如下:
Traceback (most recent call last):
File “\models\utils.py”, line 10, in
import tinycudann as tcnn
ModuleNotFoundError: No module named ‘tinycudann’
报错信息为缺少tinycudann模块,安装上这个模块就可以了。我的是Windows系统电脑,CUDA为12.4,折腾过程:
看作者发布的PyTorch 扩展版安装方法为执行下面命令安装:
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
我试了下不行,会报错,错误信息有如下等内容
==================================================
File “\site-packages\torch\utils\cpp_extension.py”, line 2121, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tinycudann
Running setup.py clean for tinycudann
Failed to build tinycudann
Installing collected packages: tinycudann
Running setup.py install for tinycudann … error
error: subprocess-exited-with-error
× Running setup.py install for tinycudann did not run successfully.
│ exit code: 1
╰─> [216 lines of output]
Building PyTorch extension for tiny-cuda-nn version 1.7
Obtained compute capability 75 from PyTorch
Detected CUDA version 12.4
Targeting C++ standard 17
running install
site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\include\crt/host_config.h(248): fatal error C1083: 无法打开包括文件: “crtdefs.h”: No such file or directory
object.cu
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "site-packages\torch\utils\cpp_extension.py", line 2105, in _run_ninja_build
subprocess.run(
File "\subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
==================================================
继续折腾,网上搜索了一下,看到如下一个解决方案,
先执行下面命令,打开一个新窗口
#此处路径根据自己的文件路径做调整
start "E:\Microsoft\2022\VC\Auxiliary\Build\vcvars64.bat"
在新的vcvars64.bat窗口中执行安装命令:
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
如果你安装成功了的话,那么恭喜你,很幸运,如果你像我一样还是报错的话,可按照下面的方式处理,
点击【开始】找到visual studio 点击启动【x64 Native Tools Command Prompt…】
然后在终端里运行安装命令:
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
OK,终于成功安装tinycudann,太痛苦了,给遇到相同问题的伙伴一点解决思路。
tinycudann项目地址:https://github.com/NVlabs/tiny-cuda-nn