A bit frustated getting swift+tensorflow to run

I just finished watching Deep Learning from the Foundations and was excited to try out Swift for Tensorflow. I now it’s early days, but so far I’m having a bad experience in getting it up and running. I’ve tried:

a) Compiling Swift on my Ubuntu 19.04 (as per https://github.com/tensorflow/swift/blob/master/Installation.md)
Discovered it wasn’t compatible with Ubuntu 19 ( as some libs have been deprecated or are different versions). Tried downloading and installing old versions, but it didn’t work.

b) Running the ToolChain (0.4 Release) on Xcode (10.2.1 and 11.0 beta) Playground MacOS 10.14
I get an error saying the toolchain is not compatible, but it does find the Tensorflow module.

FIX :run on the command line: export TOOLCHAINS=com.google.swift.20190627

c) Running the jupyter-swift-notebook docker on my Ubuntu (https://github.com/google/swift-jupyter)
A simple print(“hello world”) inside the notebook gives me the
“Exception: Expected value from Int.bitWidth, but got: SuccessWithoutValue()”

FIX: run the docker with the --privileged option:
docker run -p 8888:8888 --privileged -v /home/ale/notebooks:/notebooks swift-jupyter

Any help is welcome!

For B did you try what I did

On the mac I was trying to get it running on the Playgrounds. But just tried setting the command line and I get the error:
$ swift
error: failed to launch REPL process: process exited with status -1 (Error 1)

If I revert to XCode 10.2 command line it works normally
$ swift
Welcome to Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.4).
Type :help for assistance.

So if you’ve done what I mentioned in my other post, that is, making sure the command line tools are using XCode 11 Beta and you’ve installed the v0.4.0-rc0 June 27, 2019 version of the toolchain from https://github.com/tensorflow/swift/blob/master/Installation.md then on the command line execute the following command:

export TOOLCHAINS=com.google.swift.20190627

Then try running swift again and this should be the versions. Hope it helps.

1 Like

yes! it worked! that was very helpful!

1 Like

@stephenjohnson did you get swift notebooks running on the mac? on the github it officially only supports ubuntu.

No, I haven’t tried running them on the Mac.

1 Like

For anybody interested, for option C) I was able to get the Docker running after asking for help on the Swift forums, by instead of using the repository instructions:
$ docker run -p 8888:8888 --cap-add SYS_PTRACE -v /my/host/notebooks:/notebooks swift-jupyter

I used the —privileged option
$ docker run -p 8888:8888 --privileged -v /my/host/notebooks:/notebooks swift-jupyter