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

  • 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…

  • Python Pandas Groupby function agg Series GroupbyObject

    Group By FunctionThis is a quick look at Python groupby function. Very powerful and useful function. We will take a simple look at it here. Credits to Data School , creator of Python course materials. lets import sample dataset In [18]:

      In [19]:

      In [20]:

      Out[20]: country beer_servings spirit_servings wine_servings total_litres_of_pure_alcohol continent…

  • | |

    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…

  • |

    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…

  • | |

    Save Multiple Pandas DataFrames to One Single Excel Sheet Side by Side or Dowwards – XlsxWriter

      This tutorial is just to illustrate how to save Python Pandas dataframe into one excel work SHEET . You can save it column-wise, that is side by side or row-wise, that is downwards, one dataframe after the other.   In [110]:

      In [111]:

     

    In [112]:

      Out[112]: First Name Last Name…

  • Python Pandas Pivot Table Index location Percentage calculation on Two columns

    pivot table for year on year This is a quick example of how to use pivot_table,  to calculate year on year percentage sales . In [162]:

      In [163]:

     

    In [164]:

      Out[164]: First Name Last Name Sex Phone Fax Email Address Booking Date Departure Date Arrival Date Address1 … Number of Passengers…

Leave a Reply

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