daniilidis-group / neural_renderer

A PyTorch port of the Neural 3D Mesh Renderer
Other
1.12k stars 248 forks source link

pip install neural_renderer_pytorch ERROR: Could not build wheels for neural_renderer_pytorch, which is required to install pyproject.toml-based projects #147

Open snowmint opened 7 months ago

snowmint commented 7 months ago

I run the command pip install neural_renderer_pytorch I tried to install pip install pyproject-toml

Get the error message:

rom neural_renderer/cuda/load_textures_cuda.cpp:1:
      /home/user/anaconda3/envs/texformer/lib/python3.11/site-packages/torch/include/ATen/core/TensorBody.h:222:30: note: declared here
        222 |   DeprecatedTypeProperties & type() const {
            |                              ^~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for neural_renderer_pytorch
  Running setup.py clean for neural_renderer_pytorch
Failed to build neural_renderer_pytorch
ERROR: Could not build wheels for neural_renderer_pytorch, which is required to install pyproject.toml-based projects

But the Error message still appears, what is the possible way to solve this error? I really appreciate any help you can provide.

julyaugust12345 commented 5 months ago

Have you solved it? I'm afraid I have the same problem

teethoe commented 4 months ago

Has anyone solved it? I have the same issue here.

HenryZhuHR commented 2 months ago

PR #86 has changed all AT_CHECK to TORCH_CHECK, so I change all these in 3 files:

from

#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x " must be contiguous")
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)

to

#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x) TORCH_CHECK(x.is_contiguous(), #x " must be contiguous")
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)

🔨 I solved this problem very coincidentally. You can try it.

(mcc_nmr) zhr@ubuntu-System-Product-Name:~/project/diffusion-attack/libs$ pip install neural_renderer_pytorch/
Processing ./neural_renderer_pytorch
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: neural-renderer-pytorch
  Building wheel for neural-renderer-pytorch (setup.py) ... done
  Created wheel for neural-renderer-pytorch: filename=neural_renderer_pytorch-1.1.3-cp310-cp310-linux_x86_64.whl
  Stored in directory: /tmp/.......
Successfully built neural-renderer-pytorch
Installing collected packages: neural-renderer-pytorch
Successfully installed neural-renderer-pytorch-1.1.3

✅ For convenience, you can directly obtain the modified source code from wangyida/neural_renderer and install neural-renderer-pytorch-1.1.4 directly

git clone git@github.com:wangyida/neural_renderer.git neural_renderer_pytorch_fix
cd neural_renderer_pytorch_fix
python3 setup.py install

🎉 Hope it can help your project!