Everything is changing pretty fast for Swift for Tensorflow related tools.
I was struggling to come up with an up to date working environment to run the fastai_dev/course-v3/swiftai notebooks (are they all essentially comes of each other?).
All of the earlier scripts I saw reference older non-nightly versions of Swift for Tensorflow, but those are way too old for the current notebooks.
So after I figured out all of the required bits, I made an idempotent script to set everything up in Ubuntu 18.04 to run the notebooks successfully:
By default this will download the Swift and S4TF related files and repos under ~/swift and use a conda environment called “swiftai”. Those are customizable at the top of the file.
Provided that Visual Studio Code (and npm) are installed, the script will also install sourcekit-lsp support for the Swift Development Environment extension
I will keep maintaining this script until some better way comes along.
- currently Swift auto-completion in Jupyter notebooks (and the REPL!) is broken and the fix is landing only after Swift 5.1. Upstream bug.
- some of the notebooks cause mysterious crashes. I hit this LLVM assertion error many times.
- there’s tons of somewhat out of date documentation by now. I wonder what’s the best way to stay in the loop…
- To use SwiftCV in the notebooks, source bashrc after running the script. It will export
PKG_CONFIG_PATHso that the conda-installed headers are available for the Swift/Jupyter environment. Ubuntu repositories only had OpenCV 3, so this seemed more convenient (SwiftCV requires OpenCV 4).