tensorflow / swift

Swift for TensorFlow
https://tensorflow.org/swift
Apache License 2.0
6.13k stars 608 forks source link

Verify Installation Step in Installation instructions fail on Windows #421

Closed maxvol closed 3 years ago

maxvol commented 4 years ago

swift test.swift test.swift:1:8: error: missing required module 'CTensorFlow' import TensorFlow ^ with S4TF from 15 April 2020 on Windows 10 Version 1803 (OS Build 17134.1304) Toolchain is installed in C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain

ematejska commented 4 years ago

Hi, Thanks for reporting this in the nightly snapshot. We’ll look into it ASAP.

Ewa

On Wed, Apr 15, 2020 at 11:35 PM Maxim Volgin notifications@github.com wrote:

swift test.swift test.swift:1:8: error: missing required module 'CTensorFlow' import TensorFlow ^ with S4TF from 15 April 2020 on Windows 10 Version 1803 (OS Build 17134.1304)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/swift/issues/421, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUMI3QUQHSC6TSTMT64KUTRM2RMNANCNFSM4MJIFUEQ .

compnerd commented 4 years ago

@maxvol could you please provide a full compiler invocation that you are using?

maxvol commented 4 years ago

@compnerd ah, you mean that i missed an installation step? do i need to build TF first? i followed all the installation steps listed, but it seems that toolchain is only part of the problem and TF lib has to be built separately? if so, please add this to the installation manual.

jhoughjr commented 4 years ago

I followed the instructions day before yesterday and am having the same error. All prereqs are installed.

compnerd commented 4 years ago

No, swift-apis should be part of the installation which will have the CTensorFlow module. The disk layout requires that you are adding the include path though. You will need to have a -I C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift in addition to the -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk.

Effectively, your invocation should be something along the lines of:

set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk
swiftc -sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows -emit-executable -o reduced.exe reduced.swift

This is better captured in the docs for swift-models. I just want to ensure that the flags are being passed :)

maxvol commented 4 years ago

@compnerd thanks, that worked! still, i am unable to run the installation test (swift test.swift) even with these flags (error: could not load the swift standard library). so i have 3 questions:

  1. is it somehow possible not to use flags directly but store them in some kind environment variable?
  2. how to run interpreter (i.e. swift, not swiftc) so that it works? ;)
  3. is it possible to run either one directly from VC2019? how?
compnerd commented 4 years ago

Glad to hear that was it. Interesting, I've not tried it recently, but that has worked for me in the past. As to your questions ...

  1. No, swiftc does not consult the environment.
  2. I've not spent much time with the interpreter, but, yes, if you are interested in working on it it should be possible :). Probably requires a fair amount of work in the compiler.
  3. I assume that was a typo, and you meant VS2019? If so, yes, it is possible if someone is willing to do the work. It will require a new toolset definition and possibly a plugin for diagnostic reporting. Additionally, it probably will need a separate property sheet for the configuration of the targets.

Im happy to see someone else take on the last two items, but in the mean time, I would recommend that you use CMake+Ninja :)

maxvol commented 4 years ago

@compnerd thanks, clear. i am only asking about #2 because ironically it was given as an installation test ;)

compnerd commented 4 years ago

Hmm, I thought that the installation test was generating an executable. That’s something that we should clarify for the windows side. Thanks for the heads up on that. A patch to the documentation would be wonderful if you would like to get more involved in the project :)

maxvol commented 4 years ago

@compnerd sure, please let me know how to contribute.

compnerd commented 4 years ago

@maxvol I think that the first thing to do would be to update the documentation to make the difference clear. I would suggest that expanding the differences in the verification step in https://github.com/tensorflow/swift/blob/master/Installation.md would be a great first step.

Once the instructions are updated, we can start looking at what it would take to enable the interpreter mode on Windows :). But we should do that as a separate issue.