Swift: TensorFlow doesn't work in REPL, Playground and macOS App

Created on 29 May 2018  ·  18Comments  ·  Source: tensorflow/swift

Hello! I have problem. I setup latest swift-tensorflow-DEVELOPMENT-2018-05-10-a.xctoolchain, used export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}" and select on 'Swift for TensorFlow Development Snapshot' and nothing.

My macOS Playground don't compile:
image

MacOS Cocoa App has crashes:
image

And REPL can't find TensorFlow Module:
image

That my toolchains:
image

And env:
image

What I do wrong? Except programming, of course..

Most helpful comment

  1. macOS playgrounds are known to hang, sometimes with the eSetupExpressionError error. Could you please try restarting Xcode or creating a new Playground?
  2. Could you please share the code for your Cocoa app? More information is needed to debug. I created a new Cocoa app, imported the TensorFlow module, and ran the app successfully:
    screen shot 2018-05-29 at 9 32 49 am
  3. It seems that you're using a different version of the Swift REPL. To use the Swift for TensorFlow toolchain with command-line tools, add the toolchain to your path as follows:
$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"

Alternatively, you can install swiftenv and run the following:

swiftenv global tensorflow-DEVELOPMENT-2018-05-10-a

All 18 comments

  1. macOS playgrounds are known to hang, sometimes with the eSetupExpressionError error. Could you please try restarting Xcode or creating a new Playground?
  2. Could you please share the code for your Cocoa app? More information is needed to debug. I created a new Cocoa app, imported the TensorFlow module, and ran the app successfully:
    screen shot 2018-05-29 at 9 32 49 am
  3. It seems that you're using a different version of the Swift REPL. To use the Swift for TensorFlow toolchain with command-line tools, add the toolchain to your path as follows:
$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"

Alternatively, you can install swiftenv and run the following:

swiftenv global tensorflow-DEVELOPMENT-2018-05-10-a

@Dan Zheng ,I received the Xcode 9.4

获取 Outlook for iOShttps://aka.ms/o0ukef


From: Dan Zheng notifications@github.com
Sent: Wednesday, May 30, 2018 12:46:08 AM
To: tensorflow/swift
Cc: Subscribed
Subject: Re: [tensorflow/swift] TensorFlow doesn't work in REPL, Playground and macOS App (#34)

  1. macOS playgrounds are known to hang, sometimes with the eSetupExpressionError error. Could you please try restarting Xcode or creating a new Playground?
  2. Could you please share the code for your Cocoa app? More information is needed to debug. I created a new Cocoa app, imported the TensorFlow module, and ran the app successfully:
    [screen shot 2018-05-29 at 9 32 49 am]https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F5590046%2F40672813-c052ff76-6324-11e8-8684-1712e44e844a.png&data=02%7C01%7C%7C27f41207a9e14d4ed00808d5c583ae92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632091715150261&sdata=HucmuD7%2FPLz9RAqzfAaKiITAJtt6EEGXHVri%2FWfhwfo%3D&reserved=0
  3. It seems that you're using a different version of the Swift REPL. To use the Swift for TensorFlow toolchain with command-line tools, add the toolchain to your path as follows:

$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"

Alternatively, you can install swiftenvhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fswiftenv.fuller.li%2F&data=02%7C01%7C%7C27f41207a9e14d4ed00808d5c583ae92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632091715150261&sdata=FRibDeWzq%2FYqODxjN7u%2B0rdbtt0k6YZcTSFQO7IGumM%3D&reserved=0 and run the following:

swiftenv global tensorflow-DEVELOPMENT-2018-05-10-a


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftensorflow%2Fswift%2Fissues%2F34%23issuecomment-392847010&data=02%7C01%7C%7C27f41207a9e14d4ed00808d5c583ae92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632091715150261&sdata=dglLy0luptrrfVIbIn8n9gj4hAr2K%2BF3B0s%2FzWryX%2BU%3D&reserved=0, or mute the threadhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANTBFMKB2NF7QCskEVwb6uZfFUOtSuT5ks5t3XtQgaJpZM4UR0NZ&data=02%7C01%7C%7C27f41207a9e14d4ed00808d5c583ae92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632091715150261&sdata=tWrUzF7NkkggtB0fZOLtYLrLoJhIabakxeUyfNCq9pI%3D&reserved=0.

@dan-zheng swiftenv helped me and REPL does work fine, but my macOS App and Playground don't compile... I create new macOS app and set your example below, but my compile get error:
image

And my playground has infinite running, I don't know why..
image

REPL:
image

Regarding the Mac app: could you try deleting the DerivedData directory? ~/Library/Developer/Xcode/DerivedData

Unfortunately, I don't have advice for fixing Playgrounds beyond restarting Xcode. For serious development, I'd recommend using the Swift interpreter via the command line to run code.

Deleting ‘DerivedData’ did not help me with problem. I’m trying restart Xcode and mac, but it’s doesn’t work.

What version of Xcode are you using? I'm using 9.3.

I’m using Xcode 9.3.1

I downloaded Xcode 9.3.1 but wasn't able to replicate your bug: I created and ran the app without issue.

It's difficult for me to debug the Cocoa app without being able to replicate, unfortunately.
What version of macOS are you running? I'm on 10.13.3.

May I ask you a favor? Would you open your tool chain folder and put on the snapshot.

获取 Outlook for iOShttps://aka.ms/o0ukef


From: Dan Zheng notifications@github.com
Sent: Wednesday, May 30, 2018 3:53:48 AM
To: tensorflow/swift
Cc: kfchyc; Comment
Subject: Re: [tensorflow/swift] TensorFlow doesn't work in REPL, Playground and macOS App (#34)

I downloaded Xcode 9.3.1 but wasn't able to replicate your bug: I created and ran the app without issue.

It's difficult for me to debug the Cocoa app without being able to replicate, unfortunately.
What version of macOS are you running? I'm on 10.13.3.


You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftensorflow%2Fswift%2Fissues%2F34%23issuecomment-392921277&data=02%7C01%7C%7Cdf15f60a9d2c4a2f731f08d5c59de730%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632204335890456&sdata=TaODMzcZ9aNysEJZ%2B0OzSz0GI5d%2BT1BP%2FldvJmXUwFo%3D&reserved=0, or mute the threadhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANTBFFWYaBI21hSkpOVCNfeiyowGEzrIks5t3adMgaJpZM4UR0NZ&data=02%7C01%7C%7Cdf15f60a9d2c4a2f731f08d5c59de730%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636632204335890456&sdata=rP2B5kVrloIxII0kM%2FZNe9JMuB1%2FogPF%2B8iVlLU5HEc%3D&reserved=0.

@kfchyc what do you mean by ‘put on the snapshot’. In xcode I set swift tensorflow toolchain. My screenshots demonstrate this.

@dan-zheng macOS 10.13.3 too :(

2018-05-30 8 26 45
2018-05-30 8 36 11
I have the same question .

The Xcode version is 9.4.

I updated Xcode, create new Playground and all works fine, but new created macOS app still crash with error about not loaded library libtensorflow.so. Maybe in Build Settings I should set path for this lib?

Hi @SpectralDragon,
I wonder if the new 06-01 toolchain works for you?

I'm try new build, but, it's doesn't work for me :c I will try install toolchain on new mac

Hi @SpectralDragon,
Are you still encountering issues with the 06-01 toolchain?

Closing, as issues are not reproducible.

Please open a new bug if the latest toolchain does not work for you.
Note that Xcode 10 beta is required for toolchains 6/29 and newer.
Xcode 10 Playgrounds seem to work:
screen shot 2018-06-30 at 4 28 42 am

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anthrotype picture anthrotype  ·  5Comments

elefantel picture elefantel  ·  5Comments

Zandew picture Zandew  ·  3Comments

donn picture donn  ·  3Comments

porterchild picture porterchild  ·  4Comments