torchmcubes icon indicating copy to clipboard operation
torchmcubes copied to clipboard

I just cant install the library

Open math-sasso opened this issue 1 year ago • 8 comments

Command:

 pip install git+https://github.com/tatsy/torchmcubes.git

Error:

Collecting git+https://github.com/tatsy/torchmcubes.git
  Cloning https://github.com/tatsy/torchmcubes.git to /tmp/pip-req-build-yl8cxb4s
  Running command git clone --filter=blob:none --quiet https://github.com/tatsy/torchmcubes.git /tmp/pip-req-build-yl8cxb4s
  Resolved https://github.com/tatsy/torchmcubes.git to commit 3aef8afa5f21b113afc4f4ea148baee850cbd472
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-yl8cxb4s/setup.py", line 2, in <module>
          from torch.utils.cpp_extension import BuildExtension
      ModuleNotFoundError: No module named 'torch'
      [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.

math-sasso avatar Mar 15 '24 22:03 math-sasso

+1

Dragoy avatar Mar 17 '24 22:03 Dragoy

+1

jinqing0000000 avatar Mar 19 '24 16:03 jinqing0000000

you can try: pip install wheel setuptools pip --upgrade

UnrealBook avatar Mar 20 '24 08:03 UnrealBook

+1

seifXD avatar Mar 21 '24 16:03 seifXD

I had some progress. I understand that this project does not have any update since 2021. So I am trying to use as a base image nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu20.04

In the commands in my custom container I added this line otherwise the error I described happens

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

And also another line with @UnrealBook suggestion:

you can try: pip install wheel setuptools pip --upgrade

In this case the error is new:

  Building wheel for torchmcubes (setup.py): started
  Building wheel for torchmcubes (setup.py): finished with status 'error'
  error: subprocess-exited-with-error                                                                                                                                                                                            
                                                                                                                                                                                                                                 
  × python setup.py bdist_wheel did not run successfully.                                                                                                                                                                        
  │ exit code: 1                                                                                                                                                                                                                 
  ╰─> [121 lines of output]                                                                                                                                                                                                      
      No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'                                                                                                                                                                
      running bdist_wheel                                                                                                                                                                                                        
      /usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py:500: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))                                                                                                                                                                    
      running build                                                                                                                                                                                                              
      running build_py                                                                                                                                                                                                           
      creating build                                                                                                                                                                                                             
      creating build/lib.linux-x86_64-cpython-310                                                                                                                                                                                
      creating build/lib.linux-x86_64-cpython-310/torchmcubes                                                                                                                                                                    
      copying torchmcubes/__init__.py -> build/lib.linux-x86_64-cpython-310/torchmcubes                                                                                                                                          
      running build_ext                                                                                                                                                                                                          
      CUDA environment was not successfully loaded!                                                                                                                                                                              
      Build only CPU module!                                                                                                                                                                                                     
      running bdist_wheel                                                                                                                                                                                                        
      /usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py:500: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))                                                                                                                                                                    
      running build                                                                                                                                                                                                              
      running build_py                                                                                                                                                                                                           
      copying torchmcubes/__init__.py -> build/lib.linux-x86_64-cpython-310/torchmcubes                                                                                                                                          
      running build_ext                                                                                                                                                                                                          
      Traceback (most recent call last):                                                                                                                                                                                         
        File "/tmp/pip-req-build-fe0hrii5/setup.py", line 43, in <module>                                                                                                                                                        
          setup(**setup_kwargs)                                                                                                                                                                                                  
        File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 104, in setup                                                                                                                                
          return distutils.core.setup(**attrs)                                                                                                                                                                                   
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup                                                                                                                         
          return run_commands(dist)                                                                                                                                                                                              
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands                                                                                                                  
          dist.run_commands()                                                                                                                                                                                                    
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands                                                                                                                  
          self.run_command(cmd)                                                                                                                                                                                                  
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/wheel/bdist_wheel.py", line 368, in run                                                                                                                                    
          self.run_command("build")                                                                                                                                                                                              
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command                                                                                                                    
          self.distribution.run_command(command)                                                                                                                                                                                 
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build.py", line 131, in run                                                                                                                  
          self.run_command(cmd_name)                                                                                                                                                                                             
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command                                                                                                                    
          self.distribution.run_command(command)                                                                                                                                                                                 
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 91, in run                                                                                                                          
          _build_ext.run(self)                                                                                                                                                                                                   
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build_ext.py", line 345, in run                                                                                                              
          self.build_extensions()                                                                                                                                                                                                
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 509, in build_extensions                                                                                                               
          compiler_name, compiler_version = self._check_abi()                                                                                                                                                                    
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 895, in _check_abi                                                                                                                     
          _, version = get_compiler_abi_compatibility_and_version(compiler)                                                                                                                                                      
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 359, in get_compiler_abi_compatibility_and_version                                                                                     
          if not check_compiler_ok_for_platform(compiler):                                                                                                                                                                       
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 312, in check_compiler_ok_for_platform                                                                                                 
          which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)                                                                                                                                         
        File "/usr/lib/python3.10/subprocess.py", line 421, in check_output                                                                                                                                                      
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,                                                                                                                                                       
        File "/usr/lib/python3.10/subprocess.py", line 526, in run                                                                                                                                                               
          raise CalledProcessError(retcode, process.args,                                                                                                                                                                        
      subprocess.CalledProcessError: Command '['which', 'x86_64-linux-gnu-g++']' returned non-zero exit status 1.                                                                                                                
                                                                                                                                                                                                                                 
      During handling of the above exception, another exception occurred:                                                                                                                                                        
                                                                                                                                                                                                                                 
      Traceback (most recent call last):                                                                                                                                                                                         
        File "<string>", line 2, in <module>                                                                                                                                                                                     
        File "<pip-setuptools-caller>", line 34, in <module>                                                                                                                                                                     
        File "/tmp/pip-req-build-fe0hrii5/setup.py", line 63, in <module>                                                                                                                                                        
          setup(**setup_kwargs)                                                                                                                                                                                                  
        File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 104, in setup                                                                                                                                
          return distutils.core.setup(**attrs)                                                                                                                                                                                   
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 185, in setup                                                                                                                         
          return run_commands(dist)                                                                                                                                                                                              
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands                                                                                                                  
          dist.run_commands()                                                                                                                                                                                                    
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands                                                                                                                  
          self.run_command(cmd)                                                                                                                                                                                                  
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/wheel/bdist_wheel.py", line 368, in run                                                                                                                                    
          self.run_command("build")                                                                                                                                                                                              
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command                                                                                                                    
          self.distribution.run_command(command)                                                                                                                                                                                 
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build.py", line 131, in run                                                                                                                  
          self.run_command(cmd_name)                                                                                                                                                                                             
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 318, in run_command                                                                                                                    
          self.distribution.run_command(command)                                                                                                                                                                                 
        File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 967, in run_command                                                                                                                              
          super().run_command(command)                                                                                                                                                                                           
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command                                                                                                                   
          cmd_obj.run()                                                                                                                                                                                                          
        File "/usr/local/lib/python3.10/dist-packages/setuptools/command/build_ext.py", line 91, in run                                                                                                                          
          _build_ext.run(self)                                                                                                                                                                                                   
        File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/build_ext.py", line 345, in run                                                                                                              
          self.build_extensions()                                                                                                                                                                                                
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 509, in build_extensions                                                                                                               
          compiler_name, compiler_version = self._check_abi()                                                                                                                                                                    
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 895, in _check_abi                                                                                                                     
          _, version = get_compiler_abi_compatibility_and_version(compiler)                                                                                                                                                      
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 359, in get_compiler_abi_compatibility_and_version                                                                                     
          if not check_compiler_ok_for_platform(compiler):                                                                                                                                                                       
        File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 312, in check_compiler_ok_for_platform                                                                                                 
          which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)                                                                                                                                         
        File "/usr/lib/python3.10/subprocess.py", line 421, in check_output                                                                                                                                                      
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,                                                                                                                                                       
        File "/usr/lib/python3.10/subprocess.py", line 526, in run                                                                                                                                                               
          raise CalledProcessError(retcode, process.args,                                                                                                                                                                        
      subprocess.CalledProcessError: Command '['which', 'x86_64-linux-gnu-g++']' returned non-zero exit status 1.                                                                                                                
      [end of output]           

math-sasso avatar Mar 28 '24 14:03 math-sasso

you can try: pip install wheel setuptools pip --upgrade

I had already upgraded pip and setuptools, but upgrading wheel is what actually fixed this for me, thanks!

CodePeasants avatar Mar 30 '24 19:03 CodePeasants

Thanks @CodePeasants it worked to me. Were you able to retrieve the textures? I can only get the mesh

math-sasso avatar Apr 01 '24 15:04 math-sasso

Thanks @CodePeasants it worked to me. Were you able to retrieve the textures? I can only get the mesh

I just got the geometry, but it seems that's by design.

CodePeasants avatar Apr 01 '24 17:04 CodePeasants

I've managed to install it by cloning and then installing it with pip install . while the env is activated with torch installed

da2r-20 avatar May 21 '24 11:05 da2r-20

I'm using virtualenv and was facing the same issue. What worked for me:

  1. Go to pyvenv.cfg of your venv
  2. Change to: include-system-site-packages = true
  3. Deactivate and activate your venv again

zlenyk avatar Jun 24 '24 12:06 zlenyk

Now, I specify "torch" as a requirement for this library. Please try installing in your computer again? If the problem still continues, please kindly let me know.

tatsy avatar Jul 16 '24 05:07 tatsy