Using the Enthought Deployment Manager (EDM) with the Visual Studio Code (VS Code) IDE

For context, please see Canopy GUI end of life -- transition to the Enthought Deployment Manager (EDM) and Visual Studio Code

Note: the tools described in this article are usually updated monthly, providing easier use, more capabilities, and bug fixes. VS Code and the Enthought Tools for VS Code will tell you when updates are available. For EDM updates, please check its download page.

If you are installing on a Mac, please also see Using Enthought Python / EDM with VS Code on a Mac.

Sections in this article

Install the Enthought Deployment Manager (EDM) 

Install Microsoft's Visual Studio Code

Use EDM to create an Enthought Python environment

Activate an Enthought Python environment 

The VS Code Terminal panel

"Linters" and the flake8 package

About Microsoft's Python Extension for VS Code 

Heads-up for Windows users who have another Python on PATH

Additional tips

Install the Enthought Deployment Manager (EDM) 

EDM overview and download. EDM is Enthought's preferred tool for Python installation and package management. 

Caution -- almost all of EDM's functionality is command-line only.  The separate "EDM" GUI desktop application, which is included with many EDM installers, is not a GUI for general EDM functionality. Rather, this GUI's primary purpose is discovering and installing applications written for and by Enthought consulting customers.

If you encounter an error when starting the EDM GUI: 

  • Unlike the EDM command line, the EDM GUI is not designed for offline / disconnected use. 
  • As of May 2020, some new users may find that EDM GUI crashes when attempting to save settings. In this case, please open a command line (terminal) and type "edm info", after which the EDM GUI should be able to save settings ok.
  • If the EDM GUI gives you a connectivity error when starting it, it is likely that your system needs proxy firewall configuration. This is outside the scope of this article. Since the EDM GUI is not necessary for using EDM and VS Code together, please quit the EDM GUI application and proceed with the rest of this article, or just use EDM from the command line.

Use EDM to create an Enthought Python environment

If you are an Enthought customer (e.g. for digital transformation, or in an Enthought training course), we provide you with a GettingStarted bundle that you can download in a browser, and instructions for importing it into EDM.

Otherwise, on an internet-connected machine, see the EDM user guide.

To create an environment on an offline machine, see Creating an Enthought Python environment on an offline / disconnected / airgapped machine.)

Install Microsoft's Visual Studio Code

Product info and download. VS Code is Microsoft's free, open-source, extensible, multi-platform IDE, not to be confused with Microsoft's commercial Visual Studio.

Install Microsoft's Python Extension for VS Code

Python extension for Visual Studio Code

Warning: DO NOT ACCEPT the following suggestion if it appears: "Python is not installed. Please download and install Python before using the extension." If you accept this, it could interfere with your Enthought Python environments (see next section).

Activate an Enthought Python environment 

When an Enthought Python environment is activated, it will be the Python used when you open a Terminal or when you click the editor's Run button. To activate an environment, click on the "Python" section at the left of the VS Code status bar, and select or browse to the environment's Python executable.

The VS Code Terminal panel

The VS Code Terminal panel usually occupies the lower-right quadrant of the VS Code window. The Terminal panel contains one or more Terminal instances, but it only shows one of these at a time. You can switch between these Terminal instances using the drop-down selector at the upper right of the Terminal panel. For Python programming, you'll mostly use two kinds of Terminal instance:

    • "Python" terminal. Generally, you should reserve this for use by VS Code itself. VS Code uses this terminal whenever you click the Run button at the upper right of a Python script in the VS Code editor. (Pro detail: Enthought Python is not activated in this terminal; instead, whenever you click the Run button, VS Code runs your script here -with a full explicit path to your Python interpreter.)VSC-Python-terminal.png

    • Enthought Python environment terminals, for example "python-class". These are created when you activate an Enthought Python environment and open a Terminal. Depending on your VS Code configuration, your Enthought Python environment may be activated in these terminals, as in this screen shot:
      VSC-python-class-terminal.pngIf it is not, then you can manually activate the Enthought Python environment with a command like this (again, assuming a "python-class" environment):
          edm shell -e python-class
      In either case, once the environment is activated, then when you enter any python command, it runs automatically in the Enthought Python environment, which allows you to directly run commands like these in that terminal instance:
      jupyter notebook

"Linters" and the flake8 package

 If a message pops up telling you that pylint is not installed, click "Select linter" and choose flake8 from the list, if it is available.  If it is not yet available, install it.

Flake8 is automatically installed with our default GettingStarted bundle. Otherwise, the following command can be run in each EDM environment that will be used with VS Code:

edm install -e <environment-name> flake8

Background: the flake8 package is a Python linter (syntax checker) that is known to VS Code; installing it will stop VS Code's reminders to select a linter. An added benefit is that linting code while editing is generally a good practice.

About Microsoft's Python Extension for VS Code 

The Microsoft extension has many settings; most of these are personal preferences. Here are a few basics; we plan to add more suggestions in the future. 

To open settings.json, the easiest way is to type Ctrl-Shift-P (Cmd-Shift-P on Mac) and then type Open Settings (JSON) in the Command Palette that appears at the top of VS Code.

The following is a simple sample settings.json file for VS Code:

    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": [
    "python.linting.pylintEnabled": false,
    "files.trimTrailingWhitespace": true,
    "[markdown]": {
        "files.trimTrailingWhitespace": false
    "": "C:\\Program Files\\Git\\bin\\bash.exe",
    "editor.rulers": [80, 120],
    "editor.hover.enabled": true,


Heads-up for Windows users who have another Python on PATH

If you have another Python (e.g. from Anaconda, Intel, or installed on your system and included in your PATH environment variable, then  the "Run" button in the VS Code editor will not work as expected in Enthought Python environments. You may experience errors trying to run many scripts, including those that use numpy or other packages with Python-specific DLL-based components. You may also experience errors running other Python-based VS Code extensions.

A simple test for this situation is to open a Command Prompt window, or a new VS Code Terminal panel, and try to run the python command. It should not succeed. If it does, then you are likely to experience this problem.

Note that it's normal and fine to have conda itself (like edm) on the PATH. The problem is privileging one Python environment over all others, by putting it on the PATH. This can be a problem up even if you are using only conda-based, or only edm-based, Python environments.

Solutions and workarounds

This behavior is inherited from the Microsoft Python extension; we are investigating ways to improve the experience.

1) Please note that having any Python on your PATH when you have multiple Pythons installed is a system configuration bug. The best practice for users who have multiple Pythons installed is not to have any of them on your PATH. For instructions for fixing this, see Editing environment variables on Windows. If this Python is in the system-controlled part of your PATH, then you might require help from a system administrator to remove it.

2) If fixing your PATH is not possible, the cleanest workaround in most cases is to start VS Code from within an already-activated Enthought Python environment. This temporarily places it on the PATH ahead of the other Python. To do that:

  • Completely quit VS Code
  • From the Windows Start Menu, open a Command Prompt window
  • Type edm shell -e your-Python-environment-name which temporarily modifies PATH and the prompt
  • Type code to restart VS Code with these modifications.

(Note that this workaround will fail for some combinations of environment and edm. We are investigating.)

3) Another workaround, which is easy, but somewhat inconvenient, is simply not to use the Run button. Instead, you can run all your scripts manually in VS Code Terminal window where Enthought Python has been activated. You'll know that you are in such a terminal, when you see the environment's name at the top of the VS Code's Terminal panel:



Additional tips

See More tips for using VS Code with EDM


Please do not enter support requests in article comments

Please use article comments for suggestions to improve the article. For individual support requests, please follow these guidelines.

Have more questions? Submit a request


Powered by Zendesk