Wing Tips: Using Anaconda with Wing Python IDE

Apr 18, 2019

In this issue of Wing Tips we take a look at how to use the Anaconda Distribution of Python with Wing.

Anaconda's key advantage is its easy-to-use package management system. Anaconda comes with a large collection of third party packages that are not in an installation of Python from Many additional packages can be installed quickly and easily as needed, from the command line with conda install.

Anaconda's marketing focuses on data science and machine learning applications, but its extensive packages library makes it a good option also for other types of desktop and web development.

There is much ongoing work in the world of Python packaging but, at least for now, Anaconda seems to fail less often than other solutions for resolving dependencies and installing necessary packages automatically.

Configuring the Environment

To use the Anaconda with Wing, simply set the Python Executable used in your Wing project to Anaconda's python or python.exe. How you do this depends on whether you are creating a new project or have an existing project that you want to modify.

New Projects

To create a new Wing project that uses Anaconda, select New Project from the Project menu and then under Python Executable select Custom and enter the full path to Anaconda's python or python.exe.

In many cases, Wing will automatically find Anaconda and include it in the drop down menu to the right of the entry area that enables when Custom is chosen:


Shown Above: Choose "New Project" from the "Project Menu", select "Custom" for "Python Executable", find Anaconda in the drop down menu, and press "OK" to create the new project.

If Anaconda does not appear in Wing's list of available Python installations, and you don't know the full path to use, then you can start Anaconda from the command line outside of Wing and use the value printed by the following, when run interactively:

import sys

Existing Projects

To change an existing project to use Anaconda Python, the steps are the same as above except that the change is made under Project Properties in the Project menu.


If you are using virtualenv with Anaconda, use the full path of the virtualenv's python.exe or python instead. When in doubt, you can print sys.executable as already described to find the correct full path to use in Wing's Python Executable configuration.

☕ Et Voila!

In most cases, that 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.

Package Management

Once you've configured your project, you can use the Packages tool in the Tools menu to list, add, remove, or update packages. We will cover this in a future Wing Tip. See Package Manager for details.

Fixing Import Errors on Windows

On Windows, Anaconda may fail to load DLLs when its python.exe is run directly from the command line or within Wing. 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.

Simple Solution

A simple solution to fix this problem is to run Scripts\activate (located within your Anaconda installation) on the command line, and then start Wing from within the activated environment, for example with c:\Program Files (x86)\Wing Pro 7\bin\wing.exe. This causes Wing to inherit the necessary PATH that was set up by Anaconda's activate script.

This solution works well if you will be using the same Anaconda installation for all projects that you open in a session. If you change to projects that use a different Python installation, you will need to quit and restart Wing in the correct environment.

Recommended Solutions

Our recommended solutions require a bit more work up front, but once in place they automatically set the necessary PATH without the potential for polluting other Python installations with unwanted environment.

A good one-time fix is to create a small wrapper script called wrap_anaconda.bat and place the following into it:

@echo off
call %USERPROFILE%\Anaconda3\Scripts\activate
python %*

You will need to change the path on the second line to match where Anaconda is installed on your system.

Then set Python Executable in Wing's Project Properties to the full path of this batch file. This sets up the necessary environment and then runs Anaconda's Python. No other configuration is necessary, and this script can also be used on the command line or in other IDEs.

A similar solution that does not require creating a wrapper script is to set the necessary PATH in Wing's Project Properties, from the Project menu. Add the following to Environment under the Environment tab:


You may need to change the value of ANACONDA_DIR to match where Anaconda is installed on your system.

Both of these solutions work well if there are multiple Python installations on your system, because it ensures that the correct PATH is always set when the project is open, allowing other projects to use a different environment.

That's it for now! In next week's Wing Tips we'll get back to looking at some of the lesser-known but useful features in Wing.

Share this article: