Using Wing with Anaconda

Index of All Documentation » How-Tos » How-Tos for Containers »


Wing Pro Screenshot

Wing is a Python IDE that can be used to develop, test, and debug Python code run with the Anaconda Distribution of Python.

Two versions of Wing are appropriate for use with this document: Wing Pro is the full-featured Python IDE for professional developers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

This document describes how to configure Wing for use with Anaconda Python. To get started using Wing as your Python IDE, please refer to the tutorial in Wing's Help menu or read the Quickstart Guide.

Configuring Your Project

To use Anaconda with an existing Wing project, simply set the Python Executable in your Project Properties in the Project menu to the interpreter that you want to use. There are several options for this:

Command Line can be selected to enter the full path to Anaconda's python.exe or python. In many cases, Wing will automatically find Anaconda and include it in the drop down menu to the right of the file selector shown for this option. The Python executable for Anaconda is typically located at the top level of the installation on Windows and in the bin sub-directory on other OSes. Another way to find the correct full path to use is to start Anaconda outside of Wing and then type the following:

import sys
print(sys.executable)

Activated Env can be selected to use an existing environment created with conda create or virtualenv. This should be the command that activates the environment, for example activate venv1. In this case, Wing starts Python by running python in that environment. If Anaconda is installed in a default location, Wing will find your existing environments, which can be selected with the drop down menu to the right of this field.

If you are creating a new Wing project and want to use Anaconda, select New Project from the Project menu and configure Python Executable in the New Project dialog in the same way as described above.

In most cases, setting Python Executable is all that you need to do. Wing will start using your Anaconda installation immediately for source intelligence, for the next debug session, and in the integrated Python Shell after it is restarted from its Options menu.

Creating a New Anaconda Environment

Wing can create a new Anaconda environment with conda create at the same time that it creates a new project. To do this, select New Project from the Project menu and then choose Create New Anaconda Environment as the project type.

You will need to enter the name for the new environment, choose the location to write the new environment, select the installation directory of the Anaconda that you want to use, and specify at least one package to install into the new environment.

Package specifications may either be entered directly into the New Project dialog, in a space-separate list, or placed into a requirements.txt file, with one package specification per line. In both cases, the package specifications may be anything accepted by conda install including just the package name, package==version, or package>=version:

flask gunicorn numpy==1.17.4 django>=3.1

When the New Project dialog is submitted, it will run conda create and then configure the project to use the new environment.

About Anaconda Environments

On Windows, Anaconda may fail to load DLLs when its python.exe is run directly without using a named environment. This is due to the fact that by default the Anaconda installer no longer sets the PATH that it needs to run, in order to avoid conflicting with different Python installations on the same system. A typical error message looks like this:

builtins.ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
...
Original error was: DLL load failed: The specified module could not be found.

The exact message you see will vary depending on which packages you are using, or you may not run into this at all if you are not using packages that are affected by it.

This may occur when running Anaconda Python outside of Wing without using a named Anaconda environment or when using virtualenv with Anaconda. The solution on the command line is to call conda activate base before starting Anaconda or activating the virtualenv.

The problem should not appear in Wing because it detects when Anaconda is being used and automatically activates the base environment before launching Anaconda.

Related Documents

For more information see: