NVlabs / tiny-cuda-nn

Lightning fast C++/CUDA neural network framework
Other
3.77k stars 458 forks source link

can't install tiny-cuda-nn in window python environment. #442

Closed kotran88 closed 5 months ago

kotran88 commented 5 months ago

my torch version is

2.1.2+cu118

python version 3.8

and I tried to install tiny-cuda-nn with command pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

but it cause error saying

Collecting git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
  Cloning https://github.com/NVlabs/tiny-cuda-nn/ to c:\users\pedro\appdata\local\temp\pip-req-build-25iwmcx0
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn/ 'C:\Users\pedro\AppData\Local\Temp\pip-req-build-25iwmcx0'
  Resolved https://github.com/NVlabs/tiny-cuda-nn/ to commit 4892659e015b12bd2fce446b8a8e33e646b21746
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      C:\Users\pedro\AppData\Local\Temp\pip-req-build-25iwmcx0\bindings/torch\setup.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        from pkg_resources import parse_version
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\pedro\AppData\Local\Temp\pip-req-build-25iwmcx0\bindings/torch\setup.py", line 11, in <module>
          from torch.utils.cpp_extension import BuildExtension, CUDAExtension
        File "C:\Users\pedro\anaconda3\envs\nerf\lib\site-packages\torch\utils\cpp_extension.py", line 28, in <module>
          from pkg_resources import packaging  # type: ignore[attr-defined]
      ImportError: cannot import name 'packaging' from 'pkg_resources' (C:\Users\pedro\anaconda3\envs\nerf\lib\site-packages\pkg_resources\__init__.py)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

what may be the problem?

kotran88 commented 5 months ago

it is same in ubuntu system...

etam103 commented 5 months ago

@kotran88 Any luck getting this to work?

utaysi commented 5 months ago

Also having the same problem.

finickyDrone commented 5 months ago

Seeing this exact error as well when building inside a Ubuntu 22.04 Docker image:

 > [13/23] RUN python3.10 -m pip install --user --no-cache-dir git+https://github.com/NVlabs/tiny-cuda-nn.git@v1.6#subdirectory=bindings/torch:                                                                    
0.530 Collecting git+https://github.com/NVlabs/tiny-cuda-nn.git@v1.6#subdirectory=bindings/torch                                                                                                                   
0.530   Cloning https://github.com/NVlabs/tiny-cuda-nn.git (to revision v1.6) to /tmp/pip-req-build-ffj71o2f                                                                                                       
0.534   Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn.git /tmp/pip-req-build-ffj71o2f                                                                                
1.678   Running command git checkout -q 8e6e242f36dd197134c9b9275a8e5108a8e3af78                                                                                                                                   
2.129   Resolved https://github.com/NVlabs/tiny-cuda-nn.git to commit 8e6e242f36dd197134c9b9275a8e5108a8e3af78
2.130   Running command git submodule update --init --recursive -q
5.240   Preparing metadata (setup.py): started
6.916   Preparing metadata (setup.py): finished with status 'error'
6.930   error: subprocess-exited-with-error
6.930   
6.930   × python setup.py egg_info did not run successfully.
6.930   │ exit code: 1
6.930   ╰─> [8 lines of output]
6.930       Traceback (most recent call last):
6.930         File "<string>", line 2, in <module>
6.930         File "<pip-setuptools-caller>", line 34, in <module>
6.930         File "/tmp/pip-req-build-ffj71o2f/bindings/torch/setup.py", line 5, in <module>
6.930           from torch.utils.cpp_extension import BuildExtension, CUDAExtension
6.930         File "/home/agarcia/.local/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 25, in <module>
6.930           from pkg_resources import packaging  # type: ignore[attr-defined]
6.930       ImportError: cannot import name 'packaging' from 'pkg_resources' (/home/agarcia/.local/lib/python3.10/site-packages/pkg_resources/__init__.py)
6.930       [end of output]
6.930   
6.930   note: This error originates from a subprocess, and is likely not a problem with pip.
6.933 error: metadata-generation-failed
6.933 
6.933 × Encountered error while generating package metadata.
6.933 ╰─> See above for output.
6.933 
6.933 note: This is an issue with the package mentioned above, not pip.
6.933 hint: See above for details.

So, it seems the new version of setuptools v7.0 introduced some breaking changes. I targeted an earlier version to get things working: pip install setuptools==69.5.2

humberthardy commented 5 months ago

For my case, it was a problem regarding setuptools. python -m pip install setuptools==69 did the work. Source: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15863#issuecomment-2125026282

finickyDrone commented 5 months ago

For my case, it was a problem regarding setuptools. python -m pip install setuptools==69 did the work. Source: AUTOMATIC1111/stable-diffusion-webui#15863 (comment)

Yes, same for me.