swim icon indicating copy to clipboard operation
swim copied to clipboard

TensorFlow dependency has a version incompatibility on macOS

Open BradLarson opened this issue 4 years ago • 4 comments

Thanks for putting this library together, we're looking at using it in the near term to perform image loading and saving within Swift for TensorFlow's models (pending PR for this ).

One issue we encountered is that if you attempt to build the current version of the library on macOS via SwiftPM, you will hit a version mismatch. By default, SwiftPM targets macOS 10.10, but we needed to set a minimum macOS version of 10.13 for Swift for TensorFlow. This causes a problem when building with one of our toolchains on macOS, triggering an error here.

To enable the import of TensorFlow in this project on macOS, I believe you'll need to add

    platforms: [
        .macOS(.v10_13),
    ],

just after the package name in Package.swift. One downside of this is that it will limit your backwards compatibility on macOS to 10.13.

In the meantime, I've pegged our import of Swim to 3.6.1, the release before the TensorFlow extensions were added. With that, we can use this framework, but I wanted to point this out for future commits.

BradLarson avatar Mar 31 '20 20:03 BradLarson

I encountered the same issue and the fix suggested by @BradLarson works well. I'd suggest to wrap the it in a #if canImport(...) so it doesn't affect backward compatibility for "regular" (i.e. non S4TF) toolchains or Linux.

#if canImport(TensorFlow)
    platforms: [.macOS(.v10_13)],
#endif

@t-ae , please, let me know if you'd like a PR.

vojtamolda avatar May 12 '20 14:05 vojtamolda

@BradLarson Sorry for late reply. Somehow I completely missed this issue. Now there's new version 3.8.1 which restricts macOS versions.

@vojtamolda Thank you for the suggestion. But it seems #if canImport doesn't work well in Package.swift. So I just add platforms without it.

t-ae avatar May 12 '20 15:05 t-ae

Thanks for the quick response! I just tested 3.8.1 and everything works like a charm. Sorry about the confusion with #if canImport.

vojtamolda avatar May 12 '20 16:05 vojtamolda

We also might be fixing this in the near term (or it may already be fixed) by lifting the platform requirements on our end. I know that was being worked on, but I haven't checked what the latest status was.

BradLarson avatar May 14 '20 19:05 BradLarson