This article supplements either Enthought training class setup instructions, or the article Using the Enthought Deployment Manager (EDM) with the Visual Studio Code (VS Code) IDE.
Install the Enthought Deployment Manager (EDM)
Recent EDM installers for the Mac are not signed. This is because of changed Apple signing procedures, which we have no current plans to implement.
If you have admin rights to the machine, we recommend that you install the latest version. One method is to right-click on the downloaded .pkg file, click Open while holding down the Shift key, then "Yes" to "are you sure?" Or you can install EDM 2.1.0 which is signed with Apple's previous procedure, and should suffice for many purposes. For the differences, see http://docs.enthought.com/edm/dev/history.html .
Install Visual Studio Code (VS Code)
Microsoft provides the VS Code installer for macOS as a .zip file containing "Visual Studio Code.app" When unzipping, please drag this application to your Mac Applications folder rather than leaving it in your Downloads folder.
Selecting an Enthought Python environment / interpreter in VS Code
As an example, here is how to select the “python-class” Python environment in VS Code. (This is used in Enthought Python training classes. The same process can be used to select any other Enthought Python environment installed by EDM.)
- From the VS Code menu bar: View -> Command Palette.
- Start typing “Python sel” (this uses the palette's filtering ability), then select the command “Python: Select Interpreter” by clicking it or pressing the Return key.
- Click on "Enter interpreter path..."
- Click on "Find..."
- This drops down a Mac Finder search dialog window. Select your home directory on the left under "Favorites".
- (This is the fussy step on Mac!) You need to find and select the
.edmfolder. However by default, Finder does not show you "hidden" folders (whose names begin with period). If that's true on your machine, so that you cannot locate the
.edmfolder, then toggle Finder's display of "hidden" folders by pressing "
⇧⌘." (Shift Command Period). You should now be able to locate and select the
.edmfolder in your home directory.
- Now browse down three more folder (subdirectory) levels until you get to the file
~/.edm/envs/python-class/bin/python. Select that file and click "Select Interpreter".
- You should now see the "python-class" interpreter at the very left of the VS Code status bar.
Optional FYI: Launching VS Code from Terminal
Enthought integration on Mac no longer requires launching VS Code from a Terminal. Therefore, this section only applies to situations where you wish do do so as a convenience, for example using Terminal, rather than the VS Code GUI, to open a file into the VS Code editor.
By default on macOS, VS Code does not enable launching from Terminal. You can enable this either by following these instructions from Microsoft, or by adding a "soft link" to VS Code in a directory that is already on your PATH. To add such a link, copy/paste the following long command into a Terminal, then enter your macOS login password when prompted:
sudo ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
Whichever way you enable it, you can then launch VS Code by opening a Mac Terminal window and entering a command like this:
[Fixed] Python graphics on macOS Big Sur
This only applies to Python environments built from pre-2021 packages, and not updated.
If you are using Enthought Python to create graphics (plotting or GUI) using the widely-used Qt graphics backend, as is standard in Enthought training courses, and you still have a qt version older than 5.12 installed, and for some reason you cannot update the packages in this Python environment, then you will need to set the environment variable
QT_MAC_WANTS_LAYER=1. A simple way to do this is: in Terminal, before starting VS Code in Terminal, enter this command:
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.