hengameh bagherian
hengameh bagherian

Reputation: 1

Spyder not opening in a new virtual environment

Hi I am pretty new to python. I am coding with spyder using the Navigator(anaconda launcher). I have created a new virtual environment named 'john' and installed some packages on it using the following commands in terminal:

conda create -n john python=2.7 anaconda
source activate john
conda install -n john -c akode lasagne=0.1dev
conda install -n john -c derickl nolearn=0.5b1

then I tried to open spyder and run the code by typing ‘spyder’ in terminal and this is the error I get:

Traceback (most recent call last):
  File "/Users/Hengameh/anaconda2/envs/john/bin/spyder", line 3, in  <module>
    start_app.main()
  File "/Users/Hengameh/anaconda2/envs/john/lib/python2.7/site-  packages/spyderlib/start_app.py", line 114, in main
    from spyderlib import spyder
  File "/Users/Hengameh/anaconda2/envs/john/lib/python2.7/site- packages/spyderlib/spyder.py", line 88, in <module>
    from spyderlib.qt.QtGui import (QApplication, QMainWindow,  QSplashScreen,
  File "/Users/Hengameh/anaconda2/envs/john/lib/python2.7/site- packages/spyderlib/qt/QtGui.py", line 10, in <module>
    from PyQt4.Qt import QKeySequence, QTextCursor  # analysis:ignore
ImportError: cannot import name QKeySequence

and also when I try to open the Navigator launcher associated with the john environment it crashes and doesn’t open.

Now the interesting part is that the Navigator launcher associated with the default root environment opens without any problem and so does the spyder in the root env.

Any ideas of how to make it work or why is it doing this? id really appreciate your help :))

Upvotes: 0

Views: 2317

Answers (1)

MrA
MrA

Reputation: 31

I had recently a similar issue (Although I was upgrading to v 3.5 but the process should be the same), so I went first to update my 'conda' before defining the virtual environment and launching 'Spyder'. More precisely :

  1. do the update: conda update conda
  2. create your environment: conda create -n john27 python=2.7 anaconda
  3. activate it : activate john27
  4. install the packages in this environment by using a simple command conda install PackageName (you don't need to specify again the name of the environement as it is already active) if the package is from the Anaconda repository, otherwise use pip install PackageName (NB: you don't need to activate'virtualenv' in this case as conda environment looks already after this)
  5. launch Spyder from the command : spyder

And things should be working fine -I hope this helps!

Upvotes: 3

Related Questions