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
After you correctly enter the path to the Python interpreter in your virtualenv (ie /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.
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:
source env/bin/activate
)pip install spyder-kernels==0.*
python -c "import sys; print(sys.executable)"
Preferences > Python Interpreter > Use the following interpreter
that should work, happy coding!
Solutions above didn't work for me. What worked for me was following this guide in the docs: https://docs.spyder-ide.org/ipythonconsole.html#connect-to-an-external-kernel
1) open terminal and activate your virtualenv 2) still in the terminal, run the command: python -m spyder_kernels.console
, you will get a message like:
To connect another client to this kernel, use:
--existing kernel-28340.json
3) to locate this json file location, run this in spyder:
from jupyter_core import paths
paths.jupyter_runtime_dir()
for me it was c:\\Users[myuser]\\AppData\\Roaming\\jupyter\\runtime\\
4) In jupyter, from menu, click on "Consoles => Connect to an existing kernel"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.