Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

virtualenv IPython in Spyder not working

I have installed Spyder on Linux (Mint 17 to be exact) and created a scientific virtualenv (sci) with ipython, numpy, etc. The idea is to vary my virtual env for python 2 / python 3 and being a bit more flexible than installing the whole of Anaconda / python(x,y). I am having problems getting ipython to work in Spyder now.

I went to

Tools->Preferences->Console->Advanced settings

Use the following Python interpreter

 /home/mike/envs/sci/bin/ipython

but this did not start ipython. It responds with

...
Execute the given command[TerminalIPythonApp] CRITICAL | Bad config     encountered during initialization:
[TerminalIPythonApp] CRITICAL | Unrecognized flag: '-u'
...

It also does not show "Open an IPython console" under Consoles.

any ideas what I am missing?

cheers, Mike

like image 669
Mike Avatar asked Jan 28 '15 10:01

Mike


2 Answers

the process is described in the following link :

https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder

It is recommended to install a modular approach with spyder-kernels:

  1. activate the environment where you want to work (ex : source env/bin/activate)
  2. install the kernel in the environment by typing : pip install spyder-kernels==0.*
  3. get the interpreter path to be used by typing : python -c "import sys; print(sys.executable)"
  4. copy this path
  5. enter the path in Spyder in the menu

Preferences > Python Interpreter > Use the following interpreter

that should work, happy coding!

like image 128
David Avatar answered Sep 20 '22 16:09

David


After you correctly enter the path to the Python interpreter in your virtualenv (i.e. /home/mike/envs/sci/bin/python, not /home/mike/envs/sci/bin/ipython), you just need to go to the menu

Consoles > Open an IPython console

and, as long as you have IPython and PyQt/PySide installed in your virtualenv, an IPython console will be opened for you using the IPython version of your virtualenv.

like image 33
Carlos Cordoba Avatar answered Sep 22 '22 16:09

Carlos Cordoba