VAST-AI-Research / TripoSR

MIT License
4.21k stars 488 forks source link

pip install git+https://github.com/tatsy/torchmcubes.git --> error #48

Open mirinaeman opened 5 months ago

mirinaeman commented 5 months ago

Building wheels for collected packages: torchmcubes Building wheel for torchmcubes (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [20 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-312 creating build\lib.win-amd64-cpython-312\torchmcubes copying torchmcubes__init.py -> build\lib.win-amd64-cpython-312\torchmcubes running build_ext C:\Users\TF_USER\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\utils\cpp_extension.py:381: UserWarning: Error checking compiler version for cl: [WinError 2] 지정된 파일을 찾을 수 없습니다 warnings.warn(f'Error checking compiler version for {compiler}: {error}') building 'torchmcubes_module' extension CUDA environment was not successfully loaded! Build only CPU module! running bdist_wheel running build running build_py copying torchmcubes\init__.py -> build\lib.win-amd64-cpython-312\torchmcubes running build_ext building 'torchmcubes_module' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

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

pls. solve the problem

bennyguo commented 5 months ago

If you're on Windows, you need some build tools to install torchmcubes. Install here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

jannathshaik123 commented 5 months ago

HI i have the same error but its on mac how do u think i can solve it??

bennyguo commented 5 months ago

@jannathshaik123 Hi are you sure the error message is the same? Theoretically, mac wouldn't require "Microsoft Visual C++". Could you please provide the exact error message?

pookiefoof commented 5 months ago

HI i have the same error but its on mac how do u think i can solve it??

On Mac you probably need xcode-select --install to install Xcode command line tools to build torchmcubes. https://mac.install.guide/commandlinetools/4

luminousking commented 5 months ago

If you're on Windows, you need some build tools to install torchmcubes. Install here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

I have the same issue on Linux server, can I solve it by this method?

pookiefoof commented 5 months ago

If you're on Windows, you need some build tools to install torchmcubes. Install here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

I have the same issue on Linux server, can I solve it by this method?

Could you provide your error message on Linux? On Linux it needs different toolchains.

jannathshaik123 commented 5 months ago

i made a new python environment and this the error i got

Screenshot 2024-03-14 at 9 20 52 AM
jannathshaik123 commented 5 months ago

File "", line 2, in ModuleNotFoundError: No module named 'torch' [end of output]

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

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

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

i have already install torch and its shown in my pip list but however this is still not running.

jannathshaik123 commented 5 months ago

HI i have the same error but its on mac how do u think i can solve it??

On Mac you probably need xcode-select --install to install Xcode command line tools to build torchmcubes. https://mac.install.guide/commandlinetools/4

i already have xcode preinstalled

raverydavis commented 5 months ago

@jannathshaik123 same issue on mac - xcode installed, torch installed - I get the same as https://github.com/VAST-AI-Research/TripoSR/issues/48#issuecomment-1997684547

raverydavis commented 5 months ago

How I resolved this on mac

git clone https://github.com/VAST-AI-Research/TripoSR.git .

go to the directory

cd ./TripoSR

start virtual env - i use pyenv

pyenv virtualenv triposr

activate

pyenv activate triposr

install torch

pip3 install torch torchvision torchaudio

setuptools

pip install --upgrade setuptools

requirements

 pip install -r requirements.txt

python run.py examples/chair.png --output-dir output/ should now work

mark20044 commented 5 months ago

Windows here, modified steps from @raverydavis to: Open the folder you want to use for the repo Type "cmd" into the address bar (opens command prompt in current location)

clone repo

git clone https://github.com/VAST-AI-Research/TripoSR.git

change dir

cd TripoSR

make python virtual environment

python -m venv venv

activate venv

venv\Scripts\activate.bat

install torch

pip install torch torchvision torchaudio

setuptools

pip install --upgrade setuptools

requirements

pip install -r requirements.txt

launch gui (downloads model on first run, 1.68GB)

python gradio_app.py

You can then open your browser to http://127.0.0.1:7860 to use the app. Launch with "--port" to use a different port, such as 7865: python gradio_app.py --port 7865

theCuriousOne commented 5 months ago

I resolve it on windows by cloning locally https://github.com/tatsy/torchmcubes and running the python setup.py build_ext -i After that I added the compiled module, i.e the torchmcubes_module.****.pyd file into the %PYTHONPATH%

The modified the tsr/models/isosurface.py by adding the following lines instead of from torchmcubes import marching_cubes

import torchmcubes_module as mc

def marching_cubes(vol, thresh):
    """
    vol: 3D torch tensor
    thresh: threshold
    """

    if vol.is_cuda:
        return mc.mcubes_cuda(vol, thresh)
    else:
        return mc.mcubes_cpu(vol, thresh)

def grid_interp(vol, points):
    """
    Interpolate volume data at given points

    Inputs:
        vol: 4D torch tensor (C, Nz, Ny, Nx)
        points: point locations (Np, 3)
    Outputs:
        output: interpolated data (Np, C)    
    """

    if vol.is_cuda:
        return mc.grid_interp_cuda(vol, points)
    else:
        return mc.grid_interp_cpu(vol, points)

the lines are from the https://github.com/tatsy/torchmcubes/blob/master/torchmcubes/init.py because those module are not exported when the repository is build.

(note: I am novice at python)

HogwartsRico commented 3 months ago

I resolve it on windows by cloning locally https://github.com/tatsy/torchmcubes and running the python setup.py build_ext -i After that I added the compiled module, i.e the torchmcubes_module.****.pyd file into the %PYTHONPATH%

The modified the tsr/models/isosurface.py by adding the following lines instead of from torchmcubes import marching_cubes

import torchmcubes_module as mc

def marching_cubes(vol, thresh):
    """
    vol: 3D torch tensor
    thresh: threshold
    """

    if vol.is_cuda:
        return mc.mcubes_cuda(vol, thresh)
    else:
        return mc.mcubes_cpu(vol, thresh)

def grid_interp(vol, points):
    """
    Interpolate volume data at given points

    Inputs:
        vol: 4D torch tensor (C, Nz, Ny, Nx)
        points: point locations (Np, 3)
    Outputs:
        output: interpolated data (Np, C)    
    """

    if vol.is_cuda:
        return mc.grid_interp_cuda(vol, points)
    else:
        return mc.grid_interp_cpu(vol, points)

the lines are from the https://github.com/tatsy/torchmcubes/blob/master/torchmcubes/init.py because those module are not exported when the repository is build.

(note: I am novice at python)

it works ! Thanks

nitxxs commented 2 months ago

스크린샷 2024-06-19 160556 how can i fix this in linux?

Liar-zzy commented 1 month ago

If you're on Windows, you need some build tools to install torchmcubes. Install here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

I have the same issue on Linux server, can I solve it by this method?

Could you provide your error message on Linux? On Linux it needs different toolchains.

maybe u can try this

pip install git+https://github.com/tatsy/torchmcubes.git@3aef8afa5f21b113afc4f4ea148baee850cbd472
Adarshh9 commented 1 week ago

If you're on Windows, you need some build tools to install torchmcubes. Install here: https://visualstudio.microsoft.com/visual-cpp-build-tools/

I have the same issue on Linux server, can I solve it by this method?

Could you provide your error message on Linux? On Linux it needs different toolchains.

maybe u can try this

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

This works for me. I have Ubuntu and got stuck with this since 2 days. Thanks!!