Learning Python on Visual Studio Code

Today I was fiddling around with setting up python on Visual Studio Code a very elegant text editor that is well integrated with various programming languages. I had been using it for a while for editing bash code, and after exploring a few IDE options, I decided to just stick with it. Today I spent some time integrating python with VS code, and going through a machine learning exercise in python.

One note that I will make is that it makes sense to work with a virtual environment (I prefer conda), so that we can install python packages without disrupting the computer base code. Here and Here and Here are useful links with dealing with conda virtual environment and python.

As a side note, sci-kit seems like a generally useful package for implementing machine learning, and pandas seems to. be particularly useful for working with data frames. They even have a conversion table for R users!
Sci-Kit: https://scikit-learn.org/stable/
Pandas: https://pandas.pydata.org/
Pandas conversion table for R: https://pandas.pydata.org/docs/getting_started/comparison/comparison_with_r.html#compare-with-r


Generating an rsa key to ssh

If you want to set up an an rsa key to ssh into the server without

Generating an SSH key locally on terminal. First you will need to open a terminal.

(base) username@Debbies-MBP-2 ~ % ssh-keygen

Then you will want to copy your RSA code

ssh-copy-id -i ~/.ssh/id_rsa.pub transfer.ccv.brown.edu
ssh-copy-id -i ~/.ssh/id_rsa.pub ssh.ccv.brown.edu

You can validate that this works by ssh-ing in to the server name (or you can specify any name)

ssh transfer.ccv.brown.edu
ssh ssh.ccv.brown.edu

Finally, to see your keys, you can use this command

(base) username@Debbies-MBP-2 ~ % ls ~/.ssh            
authorized_keys	config		id_rsa		id_rsa.pub	known_hosts	known_hosts.old

And here the manual for ssh: https://www.man7.org/linux/man-pages/man5/ssh_config.5.html

Here is info for how to set up Oscar via VSCode: https://ask.cyberinfrastructure.org/t/vscode-remote-ssh-in-oscar/1533/2


  1. Download the Remote Development Extension Pack for VS code
  2. Select Remote-SSH:Connect to Host, and enter username@transfer.ccv.brown.edu. To pull up the function, you can press F1.
  3. Once you enter the host, it will autofill a config file for you. You can access this the SSH target from the Remote Explorer button on your VS code. If don’t see SSH Targets” automatically, check the dropdown menu for it.
  4. Voila! Once you press the target, you should be able to type your password (or if you have your RSA key set up it will be set up for you). Then you should be connected to the server.

More tips on ssh from the CCV website: https://docs.ccv.brown.edu/oscar/managing-files/version-control/ssh-agent-forwarding