Swift: Errors in Installation.md for Mac users

Created on 26 Nov 2019  路  3Comments  路  Source: tensorflow/swift

In https://github.com/tensorflow/swift/blob/master/Installation.md, step 6 of "using downloads" on macOS says xcrun --toolchain swift. This attempts to use a toolchain that's nonexistent based on the above steps. The correct toolchain is com.google.swift.20191121 which can be found in /Library/Developer/Toolchains/swift-latest/Info.plist. This should be changed.

Furthermore, export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}" breaks the command line on my machine. I am not entirely sure why to be honest.

Finally, I think it should be stated explicitly that TensorFlow has serious issues on macOS when using REPL (see usage.md). This information is crucial for people installing TensorFlow for the first time on their Mac.

I'm willing to fix these errors if you would like me to. Thanks.

Most helpful comment

I think the best solution is to change the macOS installation instructions to teach swiftenv, the Swift version manager. Tracked at https://github.com/tensorflow/swift/issues/360.

I've used swiftenv with Swift for TensorFlow macOS toolchains since 2018 and never had any issues. It's much easier than fumbling around with $PATH or xcrun --toolchain swift.


Example usage:

$ swiftenv versions # list available versions
  tensorflow-DEVELOPMENT-2019-12-22-a
  tensorflow-RELEASE-0.5
  tensorflow-RELEASE-0.6
  5.1.1
* 5.1.2 (set by /Users/danielzheng/.swiftenv/version)

$ swiftenv global tensorflow-DEVELOPMENT-2019-12-22-a # set global version

$ swiftenv global # print global version
tensorflow-DEVELOPMENT-2019-12-22-a

$ swift # use toolchain set by swiftenv
Welcome to Swift version 5.2-dev (Swift a34e25915a).
Type :help for assistance.
  1> import TensorFlow
  2>

All 3 comments

PATH issue was addressed in #345, fwiw.

I don't think that fix is related to the issue @rickwierenga brings up here. I also ran into issues when installing a new environment with pyenv, which appears to be some kind of zsh conflict. pyenv install failed at the "use zlib from xcode sdk" step (logs here). After removing the swift toolchain from my PATH, pyenv worked without issues. I think this would be worthwhile to address, so that python and swift dev environments don't step on each other.

I think the best solution is to change the macOS installation instructions to teach swiftenv, the Swift version manager. Tracked at https://github.com/tensorflow/swift/issues/360.

I've used swiftenv with Swift for TensorFlow macOS toolchains since 2018 and never had any issues. It's much easier than fumbling around with $PATH or xcrun --toolchain swift.


Example usage:

$ swiftenv versions # list available versions
  tensorflow-DEVELOPMENT-2019-12-22-a
  tensorflow-RELEASE-0.5
  tensorflow-RELEASE-0.6
  5.1.1
* 5.1.2 (set by /Users/danielzheng/.swiftenv/version)

$ swiftenv global tensorflow-DEVELOPMENT-2019-12-22-a # set global version

$ swiftenv global # print global version
tensorflow-DEVELOPMENT-2019-12-22-a

$ swift # use toolchain set by swiftenv
Welcome to Swift version 5.2-dev (Swift a34e25915a).
Type :help for assistance.
  1> import TensorFlow
  2>
Was this page helpful?
0 / 5 - 0 ratings