NVlabs / nvdiffrec

Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".
Other
2.09k stars 222 forks source link

error in one time setup #29

Closed TimSousa1 closed 8 months ago

TimSousa1 commented 2 years ago

when I run: pip install --global-option="--no-networks" git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch i get

    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\nunob\anaconda3\envs\dmodel\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nunob\\AppData\\Local\\Temp\\pip-req-build-ajsps1vv\\bindings/torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\nunob\\AppData\\Local\\Temp\\pip-req-build-ajsps1vv\\bindings/torch\\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'"'"'))' egg_info --egg-base 'C:\Users\nunob\AppData\Local\Temp\pip-pip-egg-info-gm8vy1dn'
         cwd: C:\Users\nunob\AppData\Local\Temp\pip-req-build-ajsps1vv\bindings/torch
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\nunob\AppData\Local\Temp\pip-req-build-ajsps1vv\bindings/torch\setup.py", line 3, in <module>
        import torch
      File "C:\Users\nunob\anaconda3\envs\dmodel\lib\site-packages\torch\__init__.py", line 126, in <module>
        raise err
    OSError: [WinError 182] The operating system cannot run %1. Error loading "C:\Users\nunob\anaconda3\envs\dmodel\lib\site-packages\torch\lib\shm.dll" or one of its dependencies.
jmunkberg commented 2 years ago

This seems to be a problem in the tiny-cuda-nn setup. I would suggest reporting that issue there https://github.com/NVlabs/tiny-cuda-nn, or testing their bindings in isolation to track down the issue: https://github.com/NVlabs/tiny-cuda-nn#pytorch-extension

MR-JR-01 commented 1 year ago

I got the one time setup to work on the thousandth try (because im not a programmer/scientist, just very stubborn) - so I hope this will help some people - heres a sketchfab model of bob so you can see I actually managed to get this working

I found that the dmodel environment wasnt working, but found it works in the torch environment we're going to create here.

Before we begin

your GPU must be NVIDIA CUDA enabled - check yours here https://developer.nvidia.com/cuda-gpus - keep the page open as we'll need this later If you do not know what GPU you have go to Start>Device Manager and look under 'display adapters' then compare this to the nvidia cuda gpus page.

Important!

ensure you have set this environment variable up:

in the System variables click 'new' and in variable name enter TCNN_CUDA_ARCHITECTURES in variable value enter your GPU compute value - this can be found on NVIDIA https://developer.nvidia.com/cuda-gpus e.g. mine has a Quadro RTX 4000 which has a compute capability of 7.5 - hint - remove the full stop - so 7.5 becomes 75, enter the latter: 75 as the value.

Lets go:

create the conda environment

conda create -n torch python=3.6

activate the created environment

conda activate torch

install numpy (if this returns 'requirement already satisfied' then move on to next step)

pip install numpy

install pytorch (I recommend the below, not tested with any other versions)

conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge

Test GPU install

python -c 'import torch; print(torch.rand(2,3).cuda())'

this should return something like:

tensor([[0.5690, 0.3455, 0.4558], [0.7590, 0.6625, 0.0733]], device='cuda:0')

thanks (https://github.com/williamFalcon/pytorch-gpu-install)

double check GPU install - in conda type:

python

(this will enable the python interpreter - you can see this is active as the line now starts with >>> then copy the bullet pointed text only

this should then return True or False - it should return True following this method so far

this should return the number of devices, in my case: 1

0

<torch.cuda.device at 0x7efce0b03be0>

exit python interpreter

then install following from nvdiffrec instructions

pip install ninja imageio PyOpenGL glfw xatlas gdown

pip install git+https://github.com/NVlabs/nvdiffrast/

now do this (this is where most of us have been having problems with bindings)

pip install --global-option="--no-networks" git+https://github.com/NVlabs/tiny-cuda-nn#subdirectory=bindings/torch

then

imageio_download_bin freeimage

then clone nvdiffrec repository (this will be stored wherever you are cd into - in my case c:\Users\Name

git clone https://github.com/NVlabs/nvdiffrec

move nvdiffrec folder into anaconda3\envs\torch (if you aren't already cd'd into this location)

cd into nvdiffrec folder then start training an example

python train.py --config configs/bob.json --display-interval 20


Did it work for you?

isaacperez commented 1 year ago

This worked for me

yuanzhi-zhu commented 1 year ago

Hi, I just made it work to install tiny-cuda-nn follow the instruction here: https://docs.nerf.studio/en/latest/quickstart/installation.html

2461011611 commented 6 months ago

嗨,我刚刚按照以下说明安装 tiny-cuda-nn https://docs.nerf.studio/en/latest/quickstart/installation.html

Hi, I just made it work to install tiny-cuda-nn follow the instruction here: https://docs.nerf.studio/en/latest/quickstart/installation.html

image