windows env variables
Kur-Ich opened this issue · comments
On Windows I've added LIBTORCH and its path to the env variables. I'm getting the following error when I run go get "github.com/sugarme/gotch":
torch_api.cpp:1:9: fatal error: torch/csrc/autograd/engine.h: No such file or directory 1 | #include<torch/csrc/autograd/engine.h> compilation terminated.
What else would be needed? Many thanks!
@Kur-Ich ,
We haven't got a setup instruction for Windows yet!
There's different libtorch
for Windows. You can download from Pytorch site:
and unzip to your system. Then setup environment:
- Temporary: in your console/shell window
$Env:GOTCH_LIBTORCH = "PATH_TO_YOUR_INSTALLED_LIBTORCH"
$Env:Path += ";PATH_TO_YOUR_INSTALL_LIBTORCH/lib"
- System-wide: set environment at
Control Panel -> System -> Advanced -> Environment Variables
Hope that helps.
Thanks. I've added both but I'm still getting the same error unfortunately. Is anything else needed, such as building the C++ lib with CMake?
Thanks. I've added both but I'm still getting the same error unfortunately. Is anything else needed, such as building the C++ lib with CMake?
I have the same problem on windows
I now can setup a Windows box for testing. Although the issue you mentioned above related to linking issue, it can be fixed by wiring up with absolute path at lib.go
file, the compilation still blocked with unsolved issue __assert_fail...
. It turns out: Pytorch has not supported MinGW64 GCC at this time while Golang CGO only support MinGW on Window for GCC. So 2 issues to follow up:
- Pytorch: pytorch/pytorch#42589
- GO: golang/go#20982
Temporary solution for Windows users would be using WSL2 and install a Linux distribution. If you like your Windows system and have Visual Code installed on your Windows, the following steps might help:
- Install WSL2 (https://docs.microsoft.com/en-us/windows/wsl/install)
- Install Ubuntu on WSL2 (https://www.microsoft.com/en-gb/p/ubuntu-2004-lts/9n6svws3rx71)
- Setup visual code for accessing WSL2 (https://code.visualstudio.com/docs/remote/wsl)
- Setup Go (install Go on Ubuntu side and set GOPATH environment)
- Install tools: sudo apt install build-essential clang
- Setup CC to use clang: export CC = clang export CXX = clang++ to fix undefined reference to mkl... at
.bashrc
(Ubuntu side) - Setup
gotch
for linux as inREADME.md
file.
Hope that helps.