1. Vs Code Jupyter Setup
  2. Vs Code Jupyter Shortcuts

Jupyter Notebooks are documents that contain a mix of live code (Python, R, Julia, JavaScript, and more), visualizations, and narrative text (Markdown). They're useful for breaking down concepts in a story telling form, where you can give some context and show the code below along with interactive visualizations. The Notebook API allows Visual Studio Code extensions to open files as notebooks, execute notebook code cells, and render notebook outputs in a variety of rich and interactive formats. You may know of popular notebook interfaces like Jupyter Notebook or Google Colab – the Notebook API allows for similar experiences inside Visual Studio Code. Within the Notebook Editor window, double-click any plot to open it in the viewer, or select the plot viewer button on the upper left corner of the plot (visible on hover). Read more about using Jupyter in Visual Studio Code.

Jupyter Notebook quick start. The Python extension and the Jupyter extension work together to give you a great Notebook experience in VS Code. Open or create a Jupyter Notebook file (.ipynb) and start coding in our Notebook Editor! For more information you can: Follow our Python tutorial with step-by-step instructions for building a simple app. Jupyter: Enter the url of local/remote Jupyter Notebook Select existing kernels from the drop-down list, or start a new kernel Select language for the kernel from drop-down list: e.g., 'Python 3'.

A Visual Studio Codeextension with rich support for the Python language (for all actively supported versions of the language: >=3.6), including features such as IntelliSense, linting, debugging, code navigation, code formatting, refactoring, variable explorer, test explorer, and more!

Additionally, the Python extension gives you an optimal and feature-rich experience for working with Jupyter notebooks through the Jupyter extension.

Quick start

  • Step 1.Install a supported version of Python on your system (note: that the system install of Python on macOS is not supported).
  • Step 2. Install the Python extension for Visual Studio Code.
  • Step 3. Open or create a Python file and start coding!

Set up your environment

  • Select your Python interpreter by clicking on the status bar

  • Configure the debugger through the Debug Activity Bar

  • Configure tests by running the Configure Tests command

Jupyter Notebook quick start

The Python extension and the Jupyter extension work together to give you a great Notebook experience in VS Code.

  • Open or create a Jupyter Notebook file (.ipynb) and start coding in our Notebook Editor!

For more information you can:

  • Follow our Python tutorial with step-by-step instructions for building a simple app.
  • Check out the Python documentation on the VS Code site for general information about using the extension.
  • Check out the Jupyter Notebook documentation on the VS Code site for information about using Jupyter Notebooks in VS Code.

Useful commands

Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type in one of the following commands:

CommandDescription
Python: Select InterpreterSwitch between Python interpreters, versions, and environments.
Python: Start REPLStart an interactive Python REPL using the selected interpreter in the VS Code terminal.
Python: Run Python File in TerminalRuns the active Python file in the VS Code terminal. You can also run a Python file by right-clicking on the file and selecting Run Python File in Terminal.
Python: Select LinterSwitch from Pylint to Flake8 or other supported linters.
Format DocumentFormats code using the provided formatter in the settings.json file.
Python: Configure TestsSelect a test framework and configure it to display the Test Explorer.

To see all available Python commands, open the Command Palette and type Python. For Jupyter extension commands, just type Jupyter.

Feature details

Node

Learn more about the rich features of the Python extension:

  • IntelliSense: Edit your code with auto-completion, code navigation, syntax checking and more

  • Linting: Get additional code analysis with Pylint, Flake8 and more

  • Code formatting: Format your code with black, autopep or yapf

  • Debugging: Debug your Python scripts, web apps, remote or multi-threaded processes

  • Testing: Run and debug tests through the Test Explorer with unittest, pytest or nose

  • Jupyter Notebooks: Create and edit Jupyter Notebooks, add and run code cells, render plots, visualize variables through the variable explorer, visualize dataframes with the data viewer, and more

  • Environments: Automatically activate and switch between virtualenv, venv, pipenv, conda and pyenv environments

  • Refactoring: Restructure your Python code with variable extraction, method extraction and import sorting

Supported locales

The extension is available in multiple languages: de, en, es, fa, fr, it, ja, ko-kr, nl, pl, pt-br, ru, tr, zh-cn, zh-tw

Questions, issues, feature requests, and contributions

  • If you have a question about how to accomplish something with the extension, please ask on Stack Overflow
  • If you come across a problem with the extension, please file an issue
  • Contributions are always welcome! Please see our contributing guide for more details
  • Any and all feedback is appreciated and welcome!
    • If someone has already filed an issue that encompasses your feedback, please leave a πŸ‘/πŸ‘Ž reaction on the issue
    • Otherwise please start a new discussion
  • If you're interested in the development of the extension, you can read about our development process
Node

Data and telemetry

Run jupyter notebook in visual studio code

The Microsoft Python Extension for Visual Studio Code collects usagedata and sends it to Microsoft to help improve our products andservices. Read ourprivacy statement tolearn more. This extension respects the telemetry.enableTelemetrysetting which you can learn more about athttps://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting.

Few days back, I decided to setup development environment for deep learning on my Windows 10 laptop. In this article, I would share my experience in setting up a system typically for Data Science developers. Although I used Windows 10 but the steps will be same for Linux and Mac OS.

Being a developer, need IDE for coding and not fan of browser based editor. Jupyter Notebook is favourite tool for data scientist and we can’t skip that in case of data science. Fortunately, VS Code supports Jupyter notebook. You can now directly edit .ipynb files and get the interactivity of Jupyter notebooks with all of the power of VS Code. We will go through it.


In this tutorial, we will cover the following steps:

1. Install Python
2. Install TensorFlow 2.0
3. Install Jupyter Notebook
4. Setup VS Code
5. Testing Environment
6. Virtual Environment (Optional)

1. Install Python

Download Python 3.7.6 from www.python.org(Currently, Tensorflow doesn’t support Python 3.8). I would suggest to install it with β€œcustomize installation” option and allow all users.

After installation, check the Python version on terminal. If there are multiple versions of python installed in the machine then change PATH in environment variable to the installed version and restart terminal to check version.

2. Install TensorFlow 2.0

TensorFlow is open source deep learning framework by Google, helps us to build and design Deep Learning models.
For simplicity, we will install CPU version of TensorFlow.

It will install all supportive extensions like numpy …etc.

Note: Install the GPU version of TensorFlow only if you have an Nvidia GPU. It is good and recommended for better performance. It needs to Install/Update nvidia driver, cuda toolkit, cuDNN and then run following command to install

For more information, check out the official guide here.

The next is to install Matplotlib- a Python library for 2D plotting and can work together with NumPy.

3. Install Jupyter Notebook

Jupyter Notebook is web based interactive environment for writing the code, creating & sharing files and doing visualizations as well.

run following command to install it:

Start the notebook server from the command line:

You should see the notebook open in your browser.

If you want to specify port:

4. Setup VS Code

Download and install VS Code if not already installed.

Install the following VS Code extension from the marketplace.

Note: Make sure you have installed the latest version of the extension.

First time, open the VS Code Command Palette with the shortcut CTRL + SHIFT + P (Windows) or Command + SHIFT + P (macOS) in VSCode and select β€œPython: Select Interpreter” command. It will display all installed versions. Select the appropriate python environment where Jupyter notebook is installed.

Jupyter Notebook In Visual Studio Code

To create new Jupyter notebook, open VS Code Command Palette again and run the β€œPython: Create Blank New Jupyter Notebook” command.

Why VS Code?

– You can manage source control, open multiple files, and leverage productivity features like IntelliSense, Git integration, and multi-file management, offering a brand-new way for data scientists and developers to experiment and work with data efficiently.
– Variable Explorer will help you keep track of the current state of your notebook variables at a glance, in real-time.
– You can export as Python code and do debugging and other operation like do in regular python application

5. Testing Environment

Vs Code Jupyter Setup

Now, it is time to test the environment.

Create a new Jupyter book in VS Code and run following code to test :

The output should be following:

6. Virtual Environment (Optional)

a) As we are going to use same environment for all so installed TensorFlow, Jupyter Notebook in global Python environment. If you want to create a separate environment for this, you can create a virtual environment by running following command:

Notebook

It will create .venv directory at specified path.

b) To activate python virutal environment

In VS Code:

In Command Palette CTRL + SHIFT + P, Run β€œPython: Create Terminalβ€œ. It will open and activate the terminal in selected Python environment.

c) Now install the TensorFlow, Jupyter notebook …etc in the activated environment.

Conclusion

In this tutorial, we saw
– how to set up a Python Deep Learning development environment using TensorFlow 2.0, Jupyter Notebook and VS Code.
– how Python extension in VS Code empowers notebook development in developer way.

If you face any problems, then feel free to share them in the comment section.

Vs Code Jupyter Shortcuts

Enjoy Deep Learning !!