Swift dev env for VSCode users


(Pranjal Yadav) #1

I was not sure to create a new topic as a very similar topics exists, but putting this under the vim title might not have brought you here in the first place

If you don’t want to rely on GoogleColab completely and want to setup swift locally and use it inside VSCode, follow the steps at https://bit.ly/2SYWZzB

You need to remember few things

  • Some of the steps (specially 7 and 8) might not work straight away for you and my advice is DON’T PANIC!
  • All you need to do is look at the error and it will mostly correspond to a missing cpp header file
  • Google the header file as is with ‘ubuntu’ as keyword and some packages will show up, look through those packages if they have the header file available, install them
  • The once I had to install were clang, llvm, npm, nodejs, ghc, icu-devtools, libicu-dev, libblocksruntime-dev
  • As always, if you find something still missing after above steps, keep looking and ask for help here, I’ll try my best to assist
  • VSCode extensions that I suggest are ’ SourceKit-LSP for Visual Studio Code’ and ‘Swift Language’

If all goes well then it should look something like below


For Mac users: https://nshipster.com/vscode/
Almost similar steps and same advice

Please remember that these installation steps are to install swift with a language server to write swift code inside VSCode. This has nothing to do with the TF 2.0 alpha and those tutorails will not work locally. You can choose to pip update your tensorflow and see if swift talks nicely with it or not (that’s a TODO for me). VSCode will only help you write good swift code and you still have to compile it outside in the terminal, as I have shown, I couldn’t find a swift interpreter support for VSCode yet.

For those enthusiasts who want to try swift with TF, goto https://colab.research.google.com/github/tensorflow/swift/blob/master/notebooks/blank_swift.ipynb
Here you can write everything from scratch for practice and for inspiration read https://github.com/tensorflow/swift/tree/master/docs/site/tutorials

I hope above information was helpful for you, cheers :slight_smile:


Swift development environment for vim users
(Jeremy Howard (Admin)) #2

Thanks for the links! :slight_smile: Who wants to make a compiled vscode extension available through the vscode extension manager now?..


#3

I was trying to build Swift for tensorflow for ubuntu 16.04 but found a link to download it for that version of linux.

Please see this link

However I am not sure if that is what is required. I am not sure if I have a toolchain or if I need to do something else.

Right now I can’t do anything as I upgraded my Nvidia drivers ready for CUDA10 etc but forgot that the updated drivers do not support the card that runs my video. So my new video card arrives friday so hopefully I can get back on my system without much trouble.


(Pranjal Yadav) #4

This post is about building swift to work on ubuntu inside VScode, I would call out again that it has nothing to do with tensorflow (for now). To answer your question, the link you are using is not what I suggested, you should be using this link.

The downloaded file from above link is what we refer to as a ‘toolchain’, use this and follow the instructions in the post. If you want to play around with swift and tensorflow, please use the notebook links provided in the post. I haven’t yet figured out a stable way of doing that inside VSCode and I’m waiting for the TF RC to take any concrete steps in that direction.


#5

Appreciate that advice but as a consequence of other things I have gone to 18.04, but perhaps I have misguided myself, heyho