Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm hanging for a long time in iPython console with big data

I've seen some reports PyCharm is slow but I'm having an issue that seems that's too slow even compared to normal operation.

I have a big set of data in a pandas dataframe (read from a 440 MB csv file).

When I'm using the ipython console inside PyCharm, every time I try to handle that data, let's say, I write my_data. it just hangs there for about 30 seconds.

I don't really understand what is going on, but it seems PyCharm is going trough all the data to find some smart auto completion (which is a really dumb thing to do).

Any way to deactivate this behavior?

like image 333
jbssm Avatar asked Feb 19 '14 00:02

jbssm


People also ask

Can PyCharm run IPython?

PyCharm supports usage of IPython magic commands. Prior to start working, consider the following prerequisites: IPython is available on your computer with Anaconda. The corresponding Conda environment is set as the default interpreter for the current project.

Why is PyCharm running in console?

The main reason for using the Python console within PyCharm is to benefit from the main IDE features, such as code completion, code analysis, and quick fixes.


2 Answers

I have been facing the same issue for a long time as well: PyCharm debugging is extremely slow when using large pandas dataframes. If I want to view the contents of a dataframe in the Watches is often gives me a time out after waiting for minutes, so I basically stopped using the debug when working with dataframes

What I just found however, it that under

Files -> Settinggs -> Build, Execution, Deployment -> Python Debugger

You have to switch on the "Gevent Compatible" flag

I also have switched on all the other flags in this window (Collect rum-time types information, attach subprocess, and PyQt compatible). But the Gevent compatible flag really does the job for me: it suddenly instantanuously gives me the dataframe contents in the debugger watches.

I am using PyCharm verion 2016.2.3

like image 183
Eelco van Vliet Avatar answered Sep 30 '22 17:09

Eelco van Vliet


Disabling "show variables" alleviated the slowness I was experiencing. To do this, go to

Pycharm > Preferences > Build, Execution, Deployment > Console and uncheck Show console variables by default.

Then restart your session.

like image 28
Ben Avatar answered Sep 30 '22 16:09

Ben