IPython console in spyder extremely slow in Anaconda

℡╲_俬逩灬. 提交于 2019-12-05 02:06:53

问题


I'm trying Anaconda/Spyder after using the standard python installation/IDLE for several years. The console (and variable explorer) becomes progressively slower during each work session, with every script and interactive command that I run. Eventually it takes minutes to get a response to simple commands like print, and then it stops responding completely and I shut it down. It's pretty disruptive to my work.

Mac OSX 10.13.6

conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0

qt 5.9.6
spyder 3.3.1 
ipython 7.1.1

I do use matplotlib frequently. Whenever possible I use plt.ioff() at the beginning of a script and/or plt.close('all') at the end. Turning off matplotlib support completely in preferences doesn't help and it's not a permanent fix anyway. Python is not using anywhere near all my CPU or RAM.


回答1:


So this is not a totally satisfying solution but it seems to be a reasonable temporary fix. If you downgrade your spyder version to 3.1.X you will be able to use the python console rather than the Ipython console, and this seems to work for me. To do this just run:

conda install spyder=3.1

in the terminal while your environment of choice is active. This is not ideal, because the developers removed the python console for a specific reason as mentioned in this question, How to add python console in spyder. Additionally downgrading this much may have unforeseen effects on other packages your code uses and may cause other issues but so far this is the only solution I was able to come up with.




回答2:


As far as I've found out, the problem seems to be with the latest major release of the ipython kernel. Pinning the version of ipykernel to 4.10.0 solved it for me. To do so, add a line containing ipykernel 4.* to the file ~/anaconda3/conda-meta/pinned. Create the file if it does not exist yet. Then conda update ipykernel which will actually downgrade to 4.10.0. Worked for me!




回答3:


you don't need to downgrade the entire spyder. For me it worked with downgrading these two: conda install ipython=6.4.0 conda install ipykernel=4.10.0




回答4:


@Sjoerd Thanks for your answer, this is what worked for me. To be still clearer, here's what I did in terminal on Anaconda 3 on High Sierra:

echo "ipykernel 4.10.0" >> ~/anaconda3/conda-meta/pinned

conda update anaconda

When I tried to update only ipykernel, I would have dependencies errors. By updating anaconda, everything is now up to date but ipykernel which is effectively at version 4.10.0. I didn't experience any hang since then.




回答5:


@JJR4's answer didn't work for me (seems to work for others). Another workaround is to type %connect_info magic command into the IPython Spyder console which will display the JSON info to connect another console to the kernel.

The output of the magic command explains how to connect, but basically there are three options.

Paste the above JSON into a file, and connect with:

$> jupyter <app> --existing <file>

or, if you are local, you can connect with just:

$> jupyter <app> --existing <kernel>.json

or even just:

$> jupyter <app> --existing

if this is the most recent Jupyter kernel you have started.

I typically use qtconsole as the app. Once you enter your chosen connection method into the command line, a new console will open that is connected to the same kernel as the console in Spyder. For some reason, the new console does not lag even if the Spyder console does.

Enter everything in the new console, even runfile()

Hope this helps!

UPDATE: Downgrading to ipykernel version 4.10 seems to solve the issue for me. Thanks to Carlos Cordoba - see GitHub conversation in link below.



来源:https://stackoverflow.com/questions/53381373/ipython-console-in-spyder-extremely-slow-in-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!