# PyTorch build from source on Windows

**URL:** <https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288>\
**Category:** Uncategorized\
**Created:** [March 19, 2019, 1:50pm UTC](https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288 "2019-03-19T13:50:28Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![mmisiur](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmisiur/32/10162_2.png) [@mmisiur](https://discuss.pytorch.org/u/mmisiur)\
**Post date:** [March 22, 2019, 1:35pm UTC](https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288/17 "2019-03-22T13:35:27Z")

</div>

Yes! That worked! Everything went well with it. Pytorch was installed, and is working with cuda. Thank you so much peterjc123!

For future readers, to sum up:

1. I reinstalled drivers for CUDA, reinstalled CUDA with VS extensions and Nsight Compute (actually with everything checked), reinstaled CUDnn
2. went with

```auto
pip install ninja
set CMAKE_GENERATOR=Ninja
set CC=cl.exe
set CXX=cl.exe
set CUDAHOSTCXX=
set DISTUTILS_USE_SDK=1
for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11
python setup.py build --cmake
python setup.py install

```

---

_[View the full topic](https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288)._
