10

I had spyder installed with Python 3.4 on Windows Vista.

Today I wanted to run spyder with Python 2.7. So, went through this post & installed Python 2.7 for spyder. Now, how do I start spyder with Python 2.7 instead of the default 3.4? (I wanted to comment at the post & ask @user3058525 but could not due to reputation restriction)

Could anyone help out?

P.S: I could create a virtualenv. But want to work in spyder...

Community
  • 1
  • 1
Rampy
  • 395
  • 1
  • 3
  • 13
  • I wonder why the question has been down voted. Could the down-voters explain please? Is the question trivial? I did not find solution to it online. Is the answer to the question trivial? I wish to know the answer for it isn't trivial to me. Thanks... – Rampy Feb 04 '15 at 10:18
  • 1
    Past downvoters will not see your request for explanation, so I will make a guess. The question *seems* trivial: to 'run with 2.7', do whatever you do to 'run with 3.4' except change '3.4' to '2.7' or, if '3.4' is default, somehow add '2.7' somewhere, somehow. (I am quoting 'run with x.y' because I am not sure what that means, since I know nothing about spyder except what I just read in the popup.) But perhaps there is some complication that makes this less trivial. Perhaps spyder, unlike, for instance, Idle, but like, for instance, Notepad++, only allows one instance to be running. – Terry Jan Reedy Feb 04 '15 at 22:04
  • Anaconda Python or homebrew? – Roberto Feb 04 '15 at 22:05
  • Thank you @TerryJanReedy for trying to let me know what might have caused the down-vote. Yeah, there isn't straight-forward solution in some preferences or settings to make spyder suddenly load python 2.7 instead of python 3.4 (which was the default & only python installed on my system till now). – Rampy Feb 05 '15 at 04:50
  • @Roberto: Its Anaconda package for python – Rampy Feb 05 '15 at 04:51
  • Ok, so you used `conda` to install Py2.7; you don't have a true virtualenv but you have an environment, right? Navigate to the Python 2.7 environment folder, and under the `scripts` subfolder you should find a script to launch Spyder. I.e. in Windows I have a spyder.exe file that will launch Spyder under that environment's Python. (There is also a Spyder.bat, but that would open with the main Python installation). – Roberto Feb 05 '15 at 13:17
  • ...iIf you don't have Spyder installed, then on terminal, do `conda activate ` and then `conda install spyder`. – Roberto Feb 05 '15 at 13:20
  • You are right all along @Roberto. I already have Spyder running very well for Python 3.4... I searched for Python 2.7 environment folder. Dint find it. The command prompt, using which I installed Python 2.7 (`conda create -n python2 python=2.7 anaconda`) says successfully installed. It got activated (`activate python2`) But I am unable to find any of the packages which it listed on the screen on my computer. Wonder why it is so. Looks like I will have to start afresh, starting by uninstalling Python 3.4 – Rampy Feb 06 '15 at 06:03
  • Does this answer your question? [How to run Spyder in virtual environment?](https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment) – questionto42 Oct 24 '20 at 10:32
  • Hey @Lorenz, thanks for checking. I have moved to Jupyter Notebook on pySpark & do not have a way to check this right away. The explanation given in that answer talks about creating a virtual environment for different version of python (& other libraries). That should definitely work. I vaguely remember that I was looking for a solution where I did not have to create a separate virtual environment. – Rampy Oct 26 '20 at 11:05

1 Answers1

13

@Roberto: Gotcha!

Learnt that we can check for environments installed in conda using conda info -e

It showed the path for installed python 2 environment as C:\Users\ramprasad.g\AppData\Local\Continuum\Anaconda3\envs\python2\

Spyder IDE for Python 2 was in Scripts folder inside envs\python2 (C:\Users\ramprasad.g\AppData\Local\Continuum\Anaconda3\envs\python2\Scripts)

Clicked on it & voila, Spyder started with Python 2.7!

Thank you...

Rampy
  • 395
  • 1
  • 3
  • 13
  • thanks! is there a way to add this spyder to anaconda navigator? – YJZ Aug 15 '16 at 00:16
  • Hey @YJZ, apologies that I missed your comment. Not sure if you still need this. https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment (shared by @Lorenz) suggests a way to create a virtual environment from Navigator. See if you find it useful. – Rampy Oct 26 '20 at 11:12