How to Set Up Jupyter Notebooks for S4TF on Docker

This Gist got me on the right track. It took some experimentation to sort everything out, but I finally got there…at least for Swift-Jupyter…

These are the steps for my conda env setup and registration of the Swift-Jupyter kernel.

$ conda create -n s4tf python==3.6
$ conda activate s4tf
(s4tf) $ conda install jupyter numpy matplotlib
(s4tf) $ python register.py --sys-prefix --swift-toolchain ~/Applications/swift-tensorflow --swift-python-library ~/miniconda3/envs/s4tf/lib/libpython3.6m.so

After these steps, I was able to run the tutorial Jupyter notebooks without any errors.

Out of curiosity, I next tried to set the PYTHON_LIBRARY environment variable, to then run the Swift REPL and play around with Python interop… This was the result.

I’m pretty content to use Swift-Jupyter for now, but would appreciate any suggestions you might have as to how this might be remedied for future use of the Swift REPL.