36

When I launch PyCharm it starts scanning files to index background task and hangs for ~1 hour/forever. From time to time it finishes and proceeds with updating indices task. It lasts for ~3 hours/forever. While these processes are running it is very hard to use PyCharm and even some other programs. PyCharm starts from ~200MB and took ~1GB of memory at the end of these tasks.

On my laptop, which is much worse. PyCharm launches in 30 seconds and ready to work. I'm working on the same project on my PC/Laptop.

I'm using Windows 64 bit. PyCharm 4.0.5

P.S. I don't have symlinks to exclude in my Project Structure.

enter image description here

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Hacking Node
  • 422
  • 1
  • 6
  • 9

8 Answers8

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
  • 16,161
  • 49
  • 147
  • 202
  • 2
    I had a virtualenv folder of only 5000 files and that was even causing this behavior. – fred271828 May 05 '17 at 19:45
  • 1
    Haha, awesome. I had a symlink to a folder with a symlink and... yeah, circular reference! Boooom! Haha. Now it works again. – Atcold Jun 13 '17 at 15:34
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.

vdmit
  • 45
  • 5
Choi
  • 389
  • 3
  • 6
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.

  • 2
    Worked beautifully! Name of hidden directory may vary depending on release and whether it is Community or Professional Edition. – Ron Kalian Feb 12 '20 at 17:06
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

Community
  • 1
  • 1
  • I did this while it was scanning (and taking ages) - once I `sysctl`'d I saw the progress bar shoot to 100%. Debian 8. – cpb2 Jul 02 '18 at 19:26
  • This solution is for a Linux user. It still works with Ubuntu 22.04 and PyCharm 2023.1.3. It seems PyCharm and many of JetBrains IDEs are still using inotify as of July 2023. So, the problem persists in a not so small project, and this solution, which was posted in 2017, still works like a charm. Note: the OP used Windows 64 bit. Although this solution may seem off topic because of that, please don't down vote it. It is only proper solution I can find for my Linux machine. I (and many Linux users) probably could not see it, if it was buried at the bottom. – pinyotae Jul 10 '23 at 16:29
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.

NotARobot
  • 978
  • 2
  • 14
  • 36
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

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 26 '23 at 15:10
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.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Bendoline
  • 1
  • 1
-2

Deleting and reinstalling Pycharm 4.0.5 fixed this for me.

W.P. McNeill
  • 16,336
  • 12
  • 75
  • 111
  • 1
    I'm sure there is always a better solution instead of restarting, removing and so on my dear friend. Jaanus' answer is one of the solutions – Mojtaba Yousefi Sep 01 '16 at 07:13