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

  • | | |

    Deploy Productionalise Azure Machine Learning Algorithm Using Python

    This is a script to consume Azure Machine Learning Model which you build using Azure ML Studio. So basically this is a Request-Response Service (RRS)  according to Microsoft. This was a Boosted Decision Tree Algorithm build with Census Adult Data which is available as one of the Sample DataSet in Azure ML. You can adapt the…

  • | |

    Running a Classification Tree – Decision Tree – 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. Picture Of My Final Decision Tree Outputted From My Python Program   The variables in my observation dataset are all quantitative. For the purposes of this assignment, I have binned…

  • | | |

    K-Means Cluster Analysis – 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 I conducted a k-means cluster analysis to find out the underlying sets of the population of Ghana based on their similarity of responses on 22 variables that represent characteristics…

  • |

    Rank Sort Series DataFrames in Python Pandas Numpy

      In this quick notes, we will have a look at Rank and Sort in Series and DataFrames in Python In [1]:

      In [3]:

      Out[3]:

    In [4]:

      Out[4]:

    In [5]:

     

    Out[5]:

    In [6]:

      Out[6]:

    In [7]:

      In [8]:

      Out[8]:

    In [10]:

     …

  • Simple Python Logging Callling Reload to Help Save Logging to File

      In this notes, we are looking at a simple but yet useful and powerful logging in Python In [77]:

      In [78]:

      In [79]:

     

      Want more information like this?

  • Array Processing – Python Numpy – How to work with Arrays in Python

      Hi Guys, Thanks for all your emails. In this note, we will be looking at Array Processing in Python. This is part of lectures on Learning Python for Data Analysis and Visualization by Jose Portilla on Udemy. In [3]:

      In [4]:

      In [5]:

      In [6]:

      Out[6]:

    In [7]:

      Out[7]:

    In [8]:…

Leave a Reply

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