Spyder does not run in Anaconda virtual environment on Windows 10
Asked Answered
S

4

21

This is my first post here. I tried to find an answer to this question but to no avail.

Just installed Anaconda2 (2.7.11 Python kernel) on my Win10 machine. I am trying to learn the conda command. Here is my problem.

  1. I go to the Anaconda prompt window.
  2. I create a virtual environmant with conda create -n myenv python=3.4 command.
  3. I activate the environment with activate myenv.
  4. When I list the environmants with conda env list it shows as active (star next to it).
  5. When I start python from a command line it shows me that it is running 3.4.
  6. The same with ipython.
  7. When I type spyder it opens the spyder window but shows me 2.7.11. This is confirmed by running print(sys.version).

Am I doing anything wrong or is this just windows 10 problem.

Thanks in advance, Andy

Stillness answered 11/12, 2015 at 6:11 Comment(2)
did you install spyder by calling conda install spyder?Stemson
You can just use spyder-kernels instead of spyder itself. Just got to make sure spyder, python and spyder-kernels versions all agree. The ipython console in spyder will usually yell at you about what version kernels you need.Patric
C
44

When you type spyder, the search for this command begins in the paths that the conda environment created. If it cannot find it there, it will go and search at other places. In your case in the paths of the default Anaconda install. So after you activate your environment:

activate myenv

you need to install sypder inside this environment:

(myenv) conda install spyder   

where (myenv) indicates the active environment.

Commercialize answered 12/12, 2015 at 7:32 Comment(4)
Thanks MIke for a very clear answer. I guess I should have thought about this myself. What I wanted was an independent 3.5 environment, so I simply did "create -n python35 python=3.5 anaconda". This installs the whole anaconda distribution for Python 3.5.Stillness
I have installed spyder inside my arc1040 environment but it keeps using the regular python installation. What should I do ?Amblygonite
Please open a new shell window (cmd) and try again. If this does not work, check with where spyder what executables are available.Kylakylah
I have found it difficult to ensure that you're launching the correct version of Spyder (unless you have no environment and set a permanent PATH, which causes lots of other problems). What I do is, after creating the environment and installing Spyder inside of it, I look for the symlink and copy it in a convenient place, like the Applications folder, and launch from there. It works.Brentwood
E
6

Change the Python interpreter in the Preference menu. See pic below.

Spyder Preferences

Eisenhower answered 11/2, 2018 at 14:56 Comment(0)
W
2

you just have to write

  1. conda create -n myenv python=3.4 spyder
  2. conda activate myenv
  3. spyder

and for deactivation later on ..

conda deactivate

Willywilly answered 16/5, 2019 at 9:21 Comment(0)
C
1

Note: using Windows 10.

To use Spyder in a particular environment, there are at least two options:

  1. conda install spyder into that environment - the problem, for me, is that it also wants to install a large number of other packages that I don't want or need in that environment.

I just want to use Spyder for interactive programming/investigation using the particular packages that I have chosen to install in a particular environment. The solution to this is option 2.

Note: I installed Anaconda initially and so have Spyder in the Anaconda environment.

  1. Copy the relevant Spyder files from the Anaconda environment into the particular environment(s) you want to use Spyder in:

From: C:\Users\User\Anaconda\Lib\site-packages
Copy: spyderlib & spyderplugins Folders

To: C:\Users\User\Anaconda\envs\[Environment_Name]\Lib\site-packages

From: C:\Users\User\Anaconda\Scripts
Copy: spyder.exe, spyder.ico, spyder_light.ico & spyder-script.py Files

To: C:\Users\User\Anaconda\envs\[Environment_Name]\Scripts

To use Spyder in the desired environment:

  1. Activate the environment
  2. (Environment_Name) prompt> spyder

This works for me!

Changsha answered 23/3, 2018 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.