How to run Spyder in virtual environment?

tomaskazemekas picture tomaskazemekas · May 11, 2015 · Viewed 191.4k times · Source

I have been using Spyder installed with with Anaconda distribution which uses Python 2.7 as default. Currently I need to set up a development virtual environment with Python 3.4.

Top two suggestions after research online are:

  1. to set up virtual environment first and to point change the preferences of Spyder , e.g here;
  2. to install all Spyder dependencies, like PyQt4, in the virtual environment itself, e. g. here ;

Both recommendations are cumbersome and do not look like smart options for development.

Is there a solution that would allow to run Spyder with required Python version automatically after activating the required virtual environment?

Answer

adelriosantiago picture adelriosantiago · Dec 3, 2017

Here is a quick way to do it in 2020. Using the Anaconda Navigator:

  1. Open Anaconda Navigator
  2. Create your new environment as you wish. I named this environment "test". Click on it to activate it.

enter image description here

  1. Go to "Home" and click on "Install" under the Spyder box.

enter image description here

  1. Click "Launch/Run"

There are still some minor bugs when setting up your environment (most of which are solved by restarting the Navigator), if you find a bug, please post it in Anaconda Issues bug-tracker. Thanks.


If even then this doesn't work, Navigator could still be useful, clicking on >Enviroments takes you to a management window for the modules installed on such enviroment, searching and selecting the spyder related ones, and then clicking on Apply will install them and their dependencies.

enter image description here