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

How do I install PyTorch3d on Windows #876

Closed
andrearosasco opened this issue Oct 11, 2021 · 14 comments
Closed

How do I install PyTorch3d on Windows #876

andrearosasco opened this issue Oct 11, 2021 · 14 comments
Assignees
Labels
installation Installation questions or issues

Comments

@andrearosasco
Copy link

andrearosasco commented Oct 11, 2021

❓ Questions on how to use PyTorch3D

I know it's a pretty broad question but here's my situation:

  • I installed `pytorch 1.9.1 py3.9_cuda11.1_cudnn8_0 pytorch
  • CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1

I clone the repository move into it and run:

  • call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
  • set DISTUTILS_USE_SDK=1
  • python setup.py install

The output is the following.
Nice part

running install
running bdist_egg
running egg_info
writing pytorch3d.egg-info\PKG-INFO
writing dependency_links to pytorch3d.egg-info\dependency_links.txt
writing requirements to pytorch3d.egg-info\requires.txt
writing top-level names to pytorch3d.egg-info\top_level.txt
reading manifest file 'pytorch3d.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'pytorch3d.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\docs
copying docs\conf.py -> build\lib.win-amd64-3.9\docs
copying docs\__init__.py -> build\lib.win-amd64-3.9\docs
creating build\lib.win-amd64-3.9\packaging
copying packaging\__init__.py -> build\lib.win-amd64-3.9\packaging
creating build\lib.win-amd64-3.9\projects
copying projects\__init__.py -> build\lib.win-amd64-3.9\projects
creating build\lib.win-amd64-3.9\pytorch3d
copying pytorch3d\__init__.py -> build\lib.win-amd64-3.9\pytorch3d
creating build\lib.win-amd64-3.9\scripts
copying scripts\parse_tutorials.py -> build\lib.win-amd64-3.9\scripts
copying scripts\__init__.py -> build\lib.win-amd64-3.9\scripts
creating build\lib.win-amd64-3.9\packaging\linux_wheels
copying packaging\linux_wheels\publish.py -> build\lib.win-amd64-3.9\packaging\linux_wheels
copying packaging\linux_wheels\__init__.py -> build\lib.win-amd64-3.9\packaging\linux_wheels
creating build\lib.win-amd64-3.9\pytorch3d\common
copying pytorch3d\common\compat.py -> build\lib.win-amd64-3.9\pytorch3d\common
copying pytorch3d\common\types.py -> build\lib.win-amd64-3.9\pytorch3d\common
copying pytorch3d\common\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\common
creating build\lib.win-amd64-3.9\pytorch3d\datasets
copying pytorch3d\datasets\shapenet_base.py -> build\lib.win-amd64-3.9\pytorch3d\datasets
copying pytorch3d\datasets\utils.py -> build\lib.win-amd64-3.9\pytorch3d\datasets
copying pytorch3d\datasets\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\datasets
creating build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\experimental_gltf_io.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\mtl_io.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\obj_io.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\off_io.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\pluggable.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\pluggable_formats.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\ply_io.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\utils.py -> build\lib.win-amd64-3.9\pytorch3d\io
copying pytorch3d\io\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\io
creating build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\chamfer.py -> build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\mesh_edge_loss.py -> build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\mesh_laplacian_smoothing.py -> build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\mesh_normal_consistency.py -> build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\point_mesh_distance.py -> build\lib.win-amd64-3.9\pytorch3d\loss
copying pytorch3d\loss\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\loss
creating build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\ball_query.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\cameras_alignment.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\cubify.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\graph_conv.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\interp_face_attrs.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\iou_box3d.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\knn.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\laplacian_matrices.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\marching_cubes.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\marching_cubes_data.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\mesh_face_areas_normals.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\mesh_filtering.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\packed_to_padded.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\perspective_n_points.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\points_alignment.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\points_normals.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\points_to_volumes.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\sample_farthest_points.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\sample_points_from_meshes.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\subdivide_meshes.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\utils.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\vert_align.py -> build\lib.win-amd64-3.9\pytorch3d\ops
copying pytorch3d\ops\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\ops
creating build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\blending.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\cameras.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\camera_conversions.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\camera_utils.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\compositing.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\lighting.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\materials.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\utils.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
copying pytorch3d\renderer\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\renderer
creating build\lib.win-amd64-3.9\pytorch3d\structures
copying pytorch3d\structures\meshes.py -> build\lib.win-amd64-3.9\pytorch3d\structures
copying pytorch3d\structures\pointclouds.py -> build\lib.win-amd64-3.9\pytorch3d\structures
copying pytorch3d\structures\utils.py -> build\lib.win-amd64-3.9\pytorch3d\structures
copying pytorch3d\structures\volumes.py -> build\lib.win-amd64-3.9\pytorch3d\structures
copying pytorch3d\structures\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\structures
creating build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\math.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\rotation_conversions.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\se3.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\so3.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\transform3d.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
copying pytorch3d\transforms\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\transforms
creating build\lib.win-amd64-3.9\pytorch3d\utils
copying pytorch3d\utils\camera_conversions.py -> build\lib.win-amd64-3.9\pytorch3d\utils
copying pytorch3d\utils\ico_sphere.py -> build\lib.win-amd64-3.9\pytorch3d\utils
copying pytorch3d\utils\torus.py -> build\lib.win-amd64-3.9\pytorch3d\utils
copying pytorch3d\utils\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\utils
creating build\lib.win-amd64-3.9\pytorch3d\vis
copying pytorch3d\vis\plotly_vis.py -> build\lib.win-amd64-3.9\pytorch3d\vis
copying pytorch3d\vis\texture_vis.py -> build\lib.win-amd64-3.9\pytorch3d\vis
copying pytorch3d\vis\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\vis
creating build\lib.win-amd64-3.9\pytorch3d\common\workaround
copying pytorch3d\common\workaround\symeig3x3.py -> build\lib.win-amd64-3.9\pytorch3d\common\workaround
copying pytorch3d\common\workaround\utils.py -> build\lib.win-amd64-3.9\pytorch3d\common\workaround
copying pytorch3d\common\workaround\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\common\workaround
creating build\lib.win-amd64-3.9\pytorch3d\datasets\r2n2
copying pytorch3d\datasets\r2n2\r2n2.py -> build\lib.win-amd64-3.9\pytorch3d\datasets\r2n2
copying pytorch3d\datasets\r2n2\utils.py -> build\lib.win-amd64-3.9\pytorch3d\datasets\r2n2
copying pytorch3d\datasets\r2n2\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\datasets\r2n2
creating build\lib.win-amd64-3.9\pytorch3d\datasets\shapenet
copying pytorch3d\datasets\shapenet\shapenet_core.py -> build\lib.win-amd64-3.9\pytorch3d\datasets\shapenet
copying pytorch3d\datasets\shapenet\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\datasets\shapenet
creating build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\raymarching.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\raysampling.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\renderer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\sample_pdf.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\utils.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
copying pytorch3d\renderer\implicit\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\implicit
creating build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\clip.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\rasterizer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\rasterize_meshes.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\renderer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\shader.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\shading.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\textures.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\utils.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
copying pytorch3d\renderer\mesh\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\mesh
creating build\lib.win-amd64-3.9\pytorch3d\renderer\points
copying pytorch3d\renderer\points\compositor.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points
copying pytorch3d\renderer\points\rasterizer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points
copying pytorch3d\renderer\points\rasterize_points.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points
copying pytorch3d\renderer\points\renderer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points
copying pytorch3d\renderer\points\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points
creating build\lib.win-amd64-3.9\pytorch3d\renderer\points\pulsar
copying pytorch3d\renderer\points\pulsar\renderer.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points\pulsar
copying pytorch3d\renderer\points\pulsar\unified.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points\pulsar
copying pytorch3d\renderer\points\pulsar\__init__.py -> build\lib.win-amd64-3.9\pytorch3d\renderer\points\pulsar
copying pytorch3d\datasets\r2n2\r2n2_synset_dict.json -> build\lib.win-amd64-3.9\pytorch3d\datasets\r2n2
copying pytorch3d\datasets\shapenet\shapenet_synset_dict_v1.json -> build\lib.win-amd64-3.9\pytorch3d\datasets\shapenet
copying pytorch3d\datasets\shapenet\shapenet_synset_dict_v2.json -> build\lib.win-amd64-3.9\pytorch3d\datasets\shapenet
running build_ext
building 'pytorch3d._C' extension
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\ball_query
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\blending
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\compositing
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\face_areas_normals
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\gather_scatter
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\interp_face_attrs
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\iou_box3d
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\knn
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\mesh_normal_consistency
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\packed_to_padded_tensor
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\point_mesh
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\points_to_volumes
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\pulsar
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\pulsar\cuda
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\pulsar\host
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\pulsar\pytorch
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\rasterize_coarse
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\rasterize_meshes
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\rasterize_points
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\sample_farthest_points
creating C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-
[error.txt](https://github.com/facebookresearch/pytorch3d/files/7324692/error.txt)
3.9\Release\Users\arosasco\Desktop\pytorch3d\pytorch3d\csrc\sample_pdf
Emitting ninja build file C:\Users\arosasco\Desktop\pytorch3d\build\temp.win-amd64-3.9\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable 
```MAX_JOBS=N)

**Bad part**
https://github.com/facebookresearch/pytorch3d/files/7324694/error.txt

I tried different versions of cuda but I couldn't solve the problem, what could it be?
@gkioxari gkioxari added the installation Installation questions or issues label Oct 14, 2021
@bottler
Copy link
Contributor

bottler commented Oct 14, 2021

There are lots of errors in the STL, used with torch stuff, inside a CUDA compilation. (These are a bit like the sort of errors you'd get if the compiler was too old / in a mode for old C++.) I have no idea what is wrong. What happens without DISTUTILS_USE_SDK? What prompted you to use that?

Do you know if you can compile a simple CUDA test program with your setup?

@andrearosasco
Copy link
Author

Hi, thanks for getting back to me!

I'm using the latest version of Visual Studio 2019 so the compiler should be up to date.

Running it without DISTUTILS_USE_SDK causes this error:

running build_ext
Traceback (most recent call last):
  File "C:\Users\arosasco\Desktop\pytorch3d\setup.py", line 132, in <module>
    setup(
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\bdist_egg.py", line 164, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\bdist_egg.py", line 150, in call_command
    self.run_command(cmdname)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
    _build_ext.run(self)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 379, in build_extensions
    self._check_abi()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 741, in _check_abi
    raise UserWarning(msg)
UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.

I'm not sure if that's what you meant but I've tried to compile this simple CUDA program with nvcc

#include <stdio.h>

__global__ void cuda_hello(){
    printf("Hello World from GPU!\n");
}

int main() {
    cuda_hello<<<1,1>>>(); 
    return 0;
}

and it generated the .lib and .exp file without any problem.

@bottler
Copy link
Contributor

bottler commented Oct 14, 2021

Your error list has

C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/include\xutility(1309): error: expected a "("
          detected during instantiation of "void std::_Adl_verify_range(const _Iter &, const _Sentinel &) [with _Iter=const char *, _Sentinel=const char *]"
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/include\xlocale(1990): here

Can you check actions/runner-images#3485 and https://stackoverflow.com/questions/67732065/why-does-vs2019-pro-have-compile-errors-with-xutility-xmemory-and-atomic-when which seem to be related to what you are seeing? If you need to get rid of the c++14 flag, you would change pytorch3d's setup.py.

@andrearosasco
Copy link
Author

Ok so, removing the c++14 flag just stops the compiler from printing "Ignoring flag" but it doesn't help.
I've tried downgrading Visual Studio 2019 to version 16.9.6 as suggested in those answers but now I get the following error:

C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(427): note: see reference to alias template instantiation 'c10::OptionalBase<c10::impl::InlineStreamGuard<c10::cuda::impl::CUDAGuardImpl>>' being compiled
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/core/impl/InlineStreamGuard.h(196): note: see reference to class template instantiation 'c10::optional<c10::impl::InlineStreamGuard<c10::cuda::impl::CUDAGuardImpl>>' being compiled
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/cuda/CUDAGuard.h(273): note: see reference to class template instantiation 'c10::impl::InlineOptionalStreamGuard<c10::cuda::impl::CUDAGuardImpl>' being compiled
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(395): warning C4624: 'c10::trivially_copyable_optimization_optional_base<T>': destructor was implicitly defined as deleted
        with
        [
            T=c10::impl::InlineStreamGuard<c10::cuda::impl::CUDAGuardImpl>
        ]
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(183): warning C4624: 'c10::constexpr_storage_t<T>': destructor was implicitly defined as deleted
        with
        [
            T=c10::cuda::impl::CUDAGuardImpl
        ]
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(367): note: see reference to class template instantiation 'c10::constexpr_storage_t<T>' being compiled
        with
        [
            T=c10::cuda::impl::CUDAGuardImpl
        ]
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(427): note: see reference to class template instantiation 'c10::trivially_copyable_optimization_optional_base<T>' being compiled
        with
        [
            T=c10::cuda::impl::CUDAGuardImpl
        ]
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(427): note: see reference to alias template instantiation 'c10::OptionalBase<c10::cuda::impl::CUDAGuardImpl>' being compiled
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/core/impl/InlineStreamGuard.h(231): note: see reference to class template instantiation 'c10::optional<T>' being compiled
        with
        [
            T=c10::cuda::impl::CUDAGuardImpl
        ]
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/cuda/CUDAGuard.h(292): note: see reference to class template instantiation 'c10::impl::InlineMultiStreamGuard<c10::cuda::impl::CUDAGuardImpl>' being compiled
C:/Users/arosasco/AppData/Local/mambaforge/envs/pcr/lib/site-packages/torch/include\c10/util/Optional.h(395): warning C4624: 'c10::trivially_copyable_optimization_optional_base<T>': destructor was implicitly defined as deleted
        with
        [
            T=c10::cuda::impl::CUDAGuardImpl
        ]
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 1666, in _run_ninja_build
    subprocess.run(
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\arosasco\Desktop\pytorch3d\setup.py", line 132, in <module>
    setup(
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install.py", line 67, in run
    self.do_egg_install()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\bdist_egg.py", line 164, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\bdist_egg.py", line 150, in call_command
    self.run_command(cmdname)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\build_ext.py", line 79, in run
    _build_ext.run(self)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 709, in build_extensions
    build_ext.build_extensions(self)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\setuptools\command\build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\distutils\command\build_ext.py", line 529, in build_extension
    objects = self.compiler.compile(sources,
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 682, in win_wrap_ninja_compile
    _write_ninja_file_and_compile_objects(
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 1355, in _write_ninja_file_and_compile_objects
    _run_ninja_build(
  File "C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\lib\site-packages\torch\utils\cpp_extension.py", line 1682, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

These are only the last lines, I've uploaded the full log here:
https://github.com/facebookresearch/pytorch3d/files/7351545/err.txt

@bottler
Copy link
Contributor

bottler commented Oct 15, 2021

Looking at the actual errors in that text file, in particular the first occurrences of the error in it, suggests that the first thing to try would be to replace the two nonstandard not keywords in pytorch3d\csrc\iou_box3d/iou_utils.h with !. Can you make that change and try again? The compilers we normally use are happy with these.

@andrearosasco
Copy link
Author

andrearosasco commented Oct 15, 2021

Ok basically I fixed some "not errors" and this too

C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\corecrt_math.h(670): error: identifier "kEpsilon" is undefined in device code

Sadly, now I'm stuck with this:

Using c:\users\arosasco\appdata\local\mambaforge\envs\pcr\lib\site-packages
Searching for tqdm==4.62.3
Best match: tqdm 4.62.3
Adding tqdm 4.62.3 to easy-install.pth file
Installing tqdm-script.py script to C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\Scripts
Installing tqdm.exe script to C:\Users\arosasco\AppData\Local\mambaforge\envs\pcr\Scripts
error: [WinError 5] Access is denied: 'C:\\Users\\arosasco\\AppData\\Local\\mambaforge\\envs\\pcr\\Scripts\\tqdm.exe'

Some suggested running the cmd as Administrator but it doesn't fix the problem for me :(
Also, tqdm is already installed in my environment so I don't really know what's going on

@andrearosasco
Copy link
Author

I could try to uninstall mamba and install anaconda. If I remember correctly, anaconda is installed in the home directory and shouldn't cause any permission issues.

@andrearosasco
Copy link
Author

Alright it finally worked! Thank you very much for your help 👌
Do you plan to release a conda package for windows?

@bottler
Copy link
Contributor

bottler commented Oct 15, 2021

Can you mention what you had to change for kEpsilon to work? No windows package planned soon, although in general it would be a good idea.

@andrearosasco
Copy link
Author

andrearosasco commented Oct 15, 2021

Sure, these are all the modifications I had to do:

  1. Replaced two not with ! in pytorch3d\csrc\iou_box3d/iou_utils.h
  2. Replaced two not with ! in pytorch3d\csrc\iou_box3d/iou_utils.cuh
  3. Deleted const auto kEpsilon and replaced all of its references with its value (1e-4) in pytorch3d\csrc\iou_box3d/iou_utils.cuh

Yeah, it would be a great idea, I had almost given up trying to make it work. But I guess it's pretty complex to do since no one has done it already

@bottler
Copy link
Contributor

bottler commented Oct 15, 2021

Thanks!

@claragarciamoll
Copy link

Hello, I need to install Pytorch3d using Windows 10 as SO. My environment is:
Python 3.7
Pytorch 1.10.2
CUDA toolkit 10.2
CUB 1.10.0
I clone the repository and then execute:

  • call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
  • set DISTUTILS_USE_SDK=1
  • set CUDA_HOME="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2"
  • set CUDA_PATH="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2"
  • set CUB_HOME="D:/cub-1.10.0”
  • cd pytorch3d
  • python setup.py install
    And I get the following error:
    running install
Anaconda3\envs\envPytorch3d\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
Anaconda3\envs\envPytorch3d\lib\site-packages\setuptools\command\easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
running bdist_egg
running egg_info
writing pytorch3d.egg-info\PKG-INFO
writing dependency_links to pytorch3d.egg-info\dependency_links.txt
writing entry points to pytorch3d.egg-info\entry_points.txt
writing requirements to pytorch3d.egg-info\requires.txt
writing top-level names to pytorch3d.egg-info\top_level.txt
reading manifest file 'pytorch3d.egg-info\SOURCES.txt'
adding license file 'LICENSE'
adding license file 'LICENSE-3RD-PARTY'
writing manifest file 'pytorch3d.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
error: [WinError 5] Access is denied

Someone faced this problem or know how to solve it?

@andrearosasco
Copy link
Author

It's not the first time that I see an error like that but I don't remember exactly how to solve it. Maybe running it as administrator could help?

@bottler
Copy link
Contributor

bottler commented Oct 9, 2022

This issue is closed. The "access is denied" thing is being discussed on #1353

@facebookresearch facebookresearch locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
installation Installation questions or issues
Projects
None yet
Development

No branches or pull requests

4 participants