[Django]-PyCharm hangs on 'scanning files to index' background task

52👍

My project contained a folder that had like 100k files/folders inside. This was making indexing way too slow.

To fix this, exclude the folder from Project structure in PyCharm.

File - Settings - Project: yourprojectname - Project Structure - Right click on folder and press "Excluded"
👤Jaanus

20👍

I just tried the following:

In PyCharm, go to the “File” on the left top, then select “invalidate caches/restart…”, and press “Invalidate and restart”.

After that, it can finish scanning in a short period without hanging anymore.

👤Choi

7👍

I’ve already answered this question on Stackoverflow, so I’ll just copy and paste…
I had the same problem and “File | Invalidate Caches/Restart” had not helped because Pycharm didn’t respond at all. I found “.Pycharm50” directory in my home directory — it contains configuration files. After its removal Pycharm launched as if you’ve just downloaded it, everything still goes well.

5👍

Late answer but this may help other people in the future.
For me this issue was fixed by raising the inotify watches limit. After raising it as described on jetbrains their website (https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit) it worked properly.

  1. Add the following line to either /etc/sysctl.conf file or a new *.conf file (e.g. idea.conf) under /etc/sysctl.d/ directory:

fs.inotify.max_user_watches = 524288

  1. Then run this command to apply the change:

sudo sysctl -p --system

1👍

I ended up going to the .idea folder of the project and deleting it in order to keep it from hanging when it starts. Then made any appropriate changes to keep it from indexing unnecessary files.

0👍

In Pycharm click to File->Invalidate Caches… and choose all in the list. Then click to Invalidate and Restart button.
It helps to me

0👍

Pycharm was starting up just to freeze instantly and pemanently, with even the "scanning files to index" stuck in the taskbar. I just figured out this was due to the deletion of a Pycharm project folder the software was opening with. Restoring the folder back from the bin made it work normally.

-2👍

Deleting and reinstalling Pycharm 4.0.5 fixed this for me.

Leave a comment