Getting Python Spyder Anaconda IDE To Work Using Virtualenv

If you have some Python scripts which rely on some packages that need a different version other than the version your Python Spyder uses, you can simply use Python Virtualenv to run Spyder IDE .

This will save you a lot of headache and you can simply continue with your development projects.

This tutorial will guide you through how to run Spyder Anaconda IDE from Python’s Virtualenv

  1. Install the versions of Python you want to use. In my case, Python 2.7 and Python 3.5 (Python 3.5 is the default my Spyder uses so i will only install 2.7)
  2. Set the appropriate environment Variables.
  3. Note the User Environment Variables take precedence over the System variables
  4. Create Virtualenv environment for Spyder in my case I created it for Python 2.7  by calling from command prompt:

  5.  

    This will create virtual environment to virtualenv. To activate it :

     

    And now to run Spyder with Python 3.4 just type:

     

  6. the above instruction is from stackoverflow here and it is further explained below:
  7. Replacing Python 3.4 with Python 2.7  (or the python version you want to install) and give it appropriate name , replacing myenv with the name you want, eg spyderenv
  8. Once it is installed , in my case (\Users\adaba\Anaconda3\envs\spydervirenv\Scripts>) navigate to that source , as in the directory path, and activate the virtualenv, by calling activate and then the name of your virtualenv , hence “activate spyderenv”
  9. virtualenv spyder
  10. You can double-check which python was used for the spyder virtual environment by typing python -V at the command prompt (in the activated virtualenv)
  11. You can install any modules or packages you want by calling pip install inside of your activated virtualenv (spyderenv)
  12. You can finally launch spyder from the virtualevn with the Python version you want by simply typing spyder at the command prompt
  13. You can also access it from your windows All Programs in the Start Menu virtualenv in all programs
  14. And if you want to check all available virtualenvs you have created, you can list all discoverable environments with `conda info –envs` at the command prompt conda-info-env
  15. The other option will be to “have to path out to python.exe, but it seems that in Linux/OS X you just path to the folder. Example: Windows:  virtualenv -p <PATH TO PYTHON.EXE> venv

     

    Creates a virtual environment in subfolder “venv” in current directory.” 

    This is courtesy of the stackoverflow comment by “Mike Davlantes” here

  16. Hope this helps.
Want more information like this?

Similar Posts

  • | |

    Running a Random Forest – Data Analysis and Intrepretation

    Overview My research work deals with Ghana, a country from the Gapminder dataset as has already been discussed from the beginning and progression through this course. The variables in my observation dataset are all quantitative. For the purposes of this assignment, I have binned my quantitative target variable, Life Expectancy (lifeexpectancy) into a 2-level binary categorical target variable. I have named…

  • | |

    Testing a Basic Linear Regression Model – Data Analysis and Intrepretation

    Testing a Basic Linear Regression Model Background My research work deals with Ghana, a country from the Gapminder dataset as has already been discussed from the beginning and progression through this course.     1)     Program  Code and Output

           #####################     OUTPUT BEGIN  #####################     Axes(0.125,0.125;0.775×0.775) Describe the centered…

  • Aggregation – Pandas Numpy Python Series DataFrame

      In this quick notes, we will go through aggregation in Python. This is part of lectures on Learning Python for Data Analysis and Visualization by Jose Portilla on Udemy.

      url = “http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/” In [2]:

      In [4]:

      Out[4]: fixed acidity volatile acidity citric acid residual sugar chlorides free sulfur dioxide total sulfur dioxide density…

  • Python PyQt Gui Basics Button Window PyQt4 Pt1

    This is just some quick scrap notes on the basics of Python GUI building using PyQt. In [1]:

     

      the ‘init‘ statements runs anytime we call call the Window class we have created and it runs all the code in the Window class the _init__ method calls the super constructor and then sets…

  • |

    Create Batch Dot Bat File to Run Your Python Script With Windows Scheduler

    After writing your script, you might want to schedule it to run periodically, let’s say, Daily, Weekly or Any Time interval you will decide Before you schedule that you want to  simply create a batch file and schedule it run with a Windows Scheduler. Here are simple steps to do that. First of all, if…

  • | |

    Test a Logistic Regression Model – Data Analysis and Intrepretation

    OVERVIEW My research work deals with Ghana, a country from the Gapminder dataset.     What I found in my logistic regression analysis. Discussion of the results for the associations between all of my explanatory variables and my response variable   The primary quantitative explanatory variable in my regression analysis is the Income Per Person…

Leave a Reply

Your email address will not be published. Required fields are marked *