-
Notifications
You must be signed in to change notification settings - Fork 15
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
Windows Installation Issue #124
Comments
Hi @vbalmer Thanks for bringing this to our attention and trying those simple suggestions. I have now spun up a Windows VM and successfully replicated the problem you are having (and also found an opportunity to improve some of our documentation in #123) which is the first step. I'll work on finding a solution and get back to you once we have more news. |
Adding notes: It seems to be that there is an issue locating mkl correctly ( This source suggests that it could be because calling the setvars.bat sets a number of environment variables, including To check this I have tried running CMake with I tried setting the
I also tried setting it to
It seems that despite setting CMake is ignoring the location to link from, so next steps might be to try hadr-coding to see if we can force a link for success at all. I am running cmake with the
@jwallwork23 these may be useful as a starting point if you get chance to look. |
Related issues andf PRs on the PyTorch repo:
Some suggest that it is an issue with the FindMKL file supplied with pytorch/cmake/ Tried setting It may be that we consider opening an issue on the PyTorch repository as this seems to perhaps be an issue with libtorch. |
Hi Jack, |
Hi @vbalmer I'm afraid not - I was away presenting at a conference for the last 3 days, and am now on leave. I want to get this sorted, but in the meantime, are you bound to building your code using Windows, or is there an option for you to build on a linux system, or using the Windows Subsystem for Linux? |
OK @vbalmer, I've opened something here: pytorch/pytorch#125871 as you can see linked above. In the meantime I would still encourage WSL or a Linux build if possible. |
Hi Jack,
|
@vbalmer PyTorch have provided a solution to the first part of your problem on the issue here: pytorch/pytorch#125871 (comment). It requires changing line 9 of the following file in your libtorch installation
Please let me know if this works in allowing you to build and install FTorch and I will let them know (I have checked and it fixes the problem for me). There is a follow on issue when I try to build the first example whereby it seems unable to match the type of the
However, if I change the function call in
Which implies a type mismatch between the It is odd that this only occurs on Windows (I have just checked and it runs fine on unix-based OSX). I did note that there are a number of warnings when compiling FTorch against libtorch regarding
|
Thanks Jack! This installation is now also working for me 😊 A few elaborations on it below:
I had previously built the required files with the commands below, maybe there’s something missing there?
Thank you so much for your help with this! I hope that we'll soon be able to fix this such that FTorch works for a Windows machine as well. |
Hi @jatkinson1000 |
I was on leave last week but am back now (though will be at PASC in Zurich next week). One suggestion based on your comments would be to try the 2023 release of OneAPI to see if the process is smoother. The other thing, which may or may not help would be to try using the ifort compiler rather than ifx. As for improving guidance for Windows this is certainly welcome and please do feel free to open a pull request with changes. |
thanks for your fast reply!
It would be great to know if once you are back from vacation / conferences, you plan on having a look at this problem again, if there still is no fix for the issue yet. Thanks again a lot in advance for helping! |
@vbalmer Yes, I would very much like to see this fixed and working on Windows, and used in more projects. I and my colleagues have been looking for a solution, but it takes some time as Windows is not our main development environment. I would also note that the maintenance of FTorch is done in addition to/above our full-time work so sometimes these things can take some time, especially when they are unfamiliar. I very much hope we can work something out. My colleagues are also looking at this when they can and I will do my best to push this forward on my return. |
@jatkinson1000 Okay, perfect that is good to hear! Let me know if you want to meet up at ETH on Monday when you're at PASC. And in the mean time I will for sure give an update if I find something noteworthy! |
Hi @jatkinson1000
leads to
I have started to google for possible solutions to this and came across this potential solve: Would one of these point us in the right direction?
|
Ah, that is interesting. Sometimes on linux you need to add the location of the shared library to the As a first diagnosis could you try updating the CMake lists in the example to explicitly require FTorch and then try re-running cmake to check it is definitely finding FTorch?
to: find_package(FTorch REQUIRED)` and re-running I'm not experienced with the equivalent to |
Hi @jatkinson1000, here a summary of what I tried out:
Some thoughts / next ideas that I have:
Thanks again for your help and sorry for not having any better news... :/ |
Hi @vbalmer , I have been able to reproduce the errors with I think there might be an issue with using |
Hi @TomMelt |
hi @vbalmer . I think I have finally fixed it 😅 Can you try these instructions (adjusting for paths etc.) checkout my test branchIn git bash (or otherwise)
add patch for libtorchMake change suggested here to libtorch's cmake file build ftorch lib** NOTE ** if you have pre-existing builds please delete them with something like ** NOTE ** the following instructions are for cmd prompt running in administrator mode E:\Intel\oneAPI\setvars.bat
cd /d E:\FTorch\src
cmake -Bbuild -G "NMake Makefiles" -DCMAKE_PREFIX_PATH="C:\Users\melt\Downloads\libtorch-win-shared-with-deps-2.3.0+cpu\libtorch" -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=ifx -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx
cmake --build build
cmake --install build build example 1cd /d E:\FTorch\examples\1_SimpleNet
cmake -Bbuild -G "NMake Makefiles" -DCMAKE_PREFIX_PATH="C:/Program Files (x86)/FTorch/lib" -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=ifx
cmake --build build
cmake --install build
set PATH=C:\Users\melt\Downloads\libtorch-win-shared-with-deps-2.3.0+cpu\libtorch\lib;%PATH%
set PATH=C:\Program Files (x86)\FTorch\bin;%PATH%
set PATH=E:\FTorch\examples\1_SimpleNet\venv\Library\bin;%PATH% run example 1** NOTE ** you will need to have already generated cd build
simplenet_infer_fortran.exe ..\saved_simplenet_model_cpu.pt You should get output: E:\FTorch\examples\1_SimpleNet\build>simplenet_infer_fortran.exe ..\saved_simplenet_model_cpu.pt
0.0000000E+00 2.000000 4.000000 6.000000 8.000000 #itworksinmyVM |
Hi @TomMelt, these are fantastic news, I will try it out asap and let you know whether it works. |
Hi @TomMelt almost everything is working now, thank you so much!! 😍 TL;DREverything works except for the final running of the example: Details[Working] Steps on Windows for Installation
Changes made: Paths, especially the full paths to the compilers [Working] Steps on Windows for Build
Changes made:
[Not working] Running the code
Throws errors, see screenshots:
I have tried so far:
I will try after lunch:
|
This is great news. The following may be useful:
Both suggest you need the VS redistributable installer: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 The alternative solution seems to be to place those Let me know if this helps and we can update the guidance over in #123 |
Hi @TomMelt and @jatkinson1000 I have tried many things which all did not work:
Finally what worked to fix the above error was manually moving the dll-flies to the build folder from where I'm running the code. This however gives a new error:
I am looking into it.
This is of course not the most elegant solution, so I will try to find a way in which these paths can be added more efficiently such that the dlls can be found more easily. In any case, thank you very much for your help throughout the entire process!! I will keep you updated if I manage to find a better solution for this. |
Hi @vbalmer , I had a similar issue. I must admit I am not a windows user so I don't fully understand but it seems Windows has an issue finding Essentially:
My only suggestion (other than manually copying the Sorry I can't offer more support because I don't understand how Windows locates But, I am really glad it now works (with workarounds) 🎉 If switching the order of I will tidy up the bugfix PR #137 and merge it into |
@vbalmer , I also just wanted to say thanks for all your help spotting the issue in the first place and helping us to debug it. Our software is now in a better place because of it. Thanks 👍 |
Hi @TomMelt thank you very much as well for your help. I really hope I get this to work in the simulation environment I would like to use it in too now in the future :) I have also updated the README for the SimpleNet example to your branch As for the Otherwise I also think that the issue can be closed. Thank you again. PS. What was it actually in your new git fork that then made everything work? Using the |
hi @vbalmer , The main change that "fixed" it was the following change to Lines 6 to 9 in e9db293
Now The change of instructions were mostly just my preference to make it less typing. E.g.,
instead of
Then, once I fixed the build issue the |
Thanks for the explanation! That makes sense :) |
@vbalmer Following up on the issue of the See the information here: https://pytorch.org/cppdocs/installing.html They provide the functionality as part of a CMakeLists file assuming you build your code using CMake, but if you are not doing this you will need to copy them across manually. It looks like any We have a summer school this week and next, but will aim to improve the documentation around this after that. |
Hi @jatkinson1000 thank you for the update! Thanks for updating the documentation. You're really putting a lot of effort into it - it's highly appreciated. |
I am rather new to the Fortran environment in Windows and have encountered some trouble during installation. Even though I have followed the instructions provided on the Website for Windows (https://cambridge-iccs.github.io/FTorch/page/troubleshooting.html), the following error consistently shows up when running the "cmake --build ." command:
(and additional functions see second image attached). Is this error related to the first? Where is this variable defined?
The following changes to the installation have also been tried out but were not successful:
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release-DCMAKE_PREFIX_PATH="C:\Users\vbalmer\Anaconda3\envs\Py-F-02\Lib\site-packages\torch" -DCMAKE_INSTALL_PREFIX="C:\Users\vbalmer\AppData\Local\FTorch"
--> doesn't successfully run cmake command
Thank you very much for your help in advance!
BuildInstructions_Clean.txt
The text was updated successfully, but these errors were encountered: