Using Wing with Anaconda

Index of All Documentation » How-Tos » How-Tos for Specific Environments »

Wing Pro Screenshot

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

If you do not already have Wing Pro 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 Project Properties 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

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.

Note that using Activated Env does not work if the full path to Anaconda's activate contains spaces. In that case, use Command Line option instead as described above.

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. Note that you can create a new Anaconda environment from the New Project dialog by selecting Create New Environment on the second dialog page and choosing Conda Env from the dropdown menu.

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 Pro can also 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, choose the source directory to use with your project, and press the Next button. Then select Create New Environment and choose Conda Env from the menu of available environment types.

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 read from an existing requirements.txt or Pipfile. 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.

Package Management

Once you've configured your project to use an Anaconda environment, you can use the Packages tool in the Tools menu to list, add, remove, or update packages. See Package Manager for details.

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:

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: