Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete installation procedure, how to solve No module named 'torch' #40

Closed
shodanx2 opened this issue Mar 8, 2024 · 10 comments
Closed

Comments

@shodanx2
Copy link

shodanx2 commented Mar 8, 2024

As discussed in tatsy/torchmcubes#5

Here is the complete solution to install TripoSR

Install python https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe
Install rust package manager https://win.rustup.rs/x86_64
Install Visual Studio Community https://visualstudio.microsoft.com/visual-cpp-build-tools/
Include "Desktop C++" workload and the buildtools (should be selected by default)
download triposr https://github.com/VAST-AI-Research/TripoSR/archive/refs/heads/main.zip
uncompress with tar -xf TripoSR-main.zip

You'll want to restart your computer or at least your terminal here

Now run, in a console, in the folder TripoSR-main

pip install --upgrade setuptools
pip install wheel
pip install ninja
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

Finally test triposr with

python run.py examples/chair.png --output-dir output/

This should get you a chair like this

image

For viewing OBJ files, you can use
https://www.meshlab.net/
or
https://sourceforge.net/projects/glc-player/

You can then try installing gradio, but that did not work for me at the moment due to a pip problem

image

@diego-lipinski-de-castro

Same problem on mac m1, cannot for god solve this problem

@mirinaeman
Copy link

mirinaeman commented Mar 10, 2024

I'm crazy @@

Building wheels for collected packages: torchmcubes, tokenizers
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]

@bennyguo
Copy link
Contributor

@diego-lipinski-de-castro Could you please give the error messages? I can successfully run on my M1 Mac.

@bennyguo
Copy link
Contributor

@mirinaeman Could you please try cloning https://github.com/tatsy/torchmcubes.git to a local directory, enter the cloned directory, and do pip install -v .? This will give more thorough error messages if it does not build.

@zubairhamed
Copy link

zubairhamed commented Mar 11, 2024

I'm getting the same error. ModuleNotFound

Processing d:\projects\gh\torchmcubes
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=40.8.0
    Using cached setuptools-69.1.1-py3-none-any.whl.metadata (6.2 kB)
  Using cached setuptools-69.1.1-py3-none-any.whl (819 kB)
  Installing collected packages: setuptools
  Successfully installed setuptools-69.1.1
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "C:\Users\zubai\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Users\zubai\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\zubai\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\zubai\AppData\Local\Temp\pip-build-env-8ku58s29\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\zubai\AppData\Local\Temp\pip-build-env-8ku58s29\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "C:\Users\zubai\AppData\Local\Temp\pip-build-env-8ku58s29\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "C:\Users\zubai\AppData\Local\Temp\pip-build-env-8ku58s29\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 2, in <module>
  ModuleNotFoundError: No module named 'torch'
  error: subprocess-exited-with-error

@shodanx2
Copy link
Author

Installing MS Visual Studio with the Desktop C++ workload was how I solved this issue.
Let me know if there is a way to resolve this without installing that huge thing.
Preferably, without even having to click a "I agree" box

@zubairhamed
Copy link

@shodanx2 Ok i had installed prior to this VC++ toolchain but didn't work. However i ran your pip install manually and that worked.

@pookiefoof
Copy link
Contributor

Installing MS Visual Studio with the Desktop C++ workload was how I solved this issue. Let me know if there is a way to resolve this without installing that huge thing. Preferably, without even having to click a "I agree" box

Installing torchmcubes requires C++ build toolchains, so on Windows installing MSVC actually might be the easiest way.

@shodanx2
Copy link
Author

Is there an alternative to installing Visual Studio ?
Maybe an open source equivalent C++ compiler ?

@Xiuzhenpeng
Copy link

As discussed in tatsy/torchmcubes#5 tatsy/torchmcubes#5 正如

Here is the complete solution to install TripoSR这是安装TripoSR的完整解决方案

Install python https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe安装 python https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe Install rust package manager https://win.rustup.rs/x86_64安装 rust 包管理器 https://win.rustup.rs/x86_64 Install Visual Studio Community https://visualstudio.microsoft.com/visual-cpp-build-tools/安装 Visual Studio Community https://visualstudio.microsoft.com/visual-cpp-build-tools/ Include "Desktop C++" workload and the buildtools (should be selected by default)包括“桌面 C++”工作负载和构建工具(应默认选中) download triposr https://github.com/VAST-AI-Research/TripoSR/archive/refs/heads/main.zip下载 Triposr https://github.com/VAST-AI-Research/TripoSR/archive/refs/heads/main.zip uncompress with tar -xf TripoSR-main.zip使用 tar -xf TripoSR-main.zip 解压缩

You'll want to restart your computer or at least your terminal here您需要在此处重新启动计算机或至少重新启动终端

Now run, in a console, in the folder TripoSR-main现在,在控制台中,在 TripoSR-main 文件夹中运行

pip install --upgrade setuptools
pip install wheel
pip install ninja
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

Finally test triposr with最后测试triposr

python run.py examples/chair.png --output-dir output/

This should get you a chair like this这应该会给你一把这样的椅子

image

For viewing OBJ files, you can use要查看 OBJ 文件,您可以使用 https://www.meshlab.net/ or 或 https://sourceforge.net/projects/glc-player/

You can then try installing gradio, but that did not work for me at the moment due to a pip problem然后您可以尝试安装 gradio,但由于 pip 问题,目前对我不起作用

image

I donnot know to install wheel and ninja. Now i have fix this problem. Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants