13

I am developing plugins and for some reason my QGIS keeps getting slower and slower. At first when I clicked on QGIS it opened right away, now it takes at least 2 minutes just to open and it also can take up to one minute just to close. Going into Manage and install plugins now times out because it takes forever to open. The way I'm pushing my changes is with this:

@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W64
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat

@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass78\lib
path %PATH%;C:\OSGeo4W64\apps\Qt5\bin
path %PATH%;C:\OSGeo4W64\apps\Python37\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37

set PATH=C:\Program Files\Git\bin;%PATH%

cmd.exe

Which is located in C:\OSGeo4W64. I then just type in pb_tool deploy in the directory of the plugin.

I tried reinstalling QGIS 3.10.7 but it didn't change anything. Also tried on QGIS 3.12 and 3.14 and it didn't change anything.

Looking for a way to fix my QGIS being so slow. My codes use a couple of files and they are quite large so I can't really post everything here, but I'm mostly using processing algorithms from qgis and grass and I use "memory:" and "TEMPORARY_OUTPUT" for QGIS and GRASS algorithms respectively.

Just tried the Plugin Load Times and it doesn't seem to be because of my plugins: enter image description here

Also here's the QGIS consumption when I just opened it and I have yet to even open a new project: enter image description here


The problem seems to be coming from my QGIS3.ini. When I create a new user it's size is only 13KB while the default one is 547,018KB. The new profile's QGIS3.ini looks like this: enter image description here

But the older one is actually insane it looks like this: enter image description here

The [UI] part contains hundreds of millions of characters by itself and I don't know why.

15
  • 1
    I know nothing about what in a plugin makes QGIS slow but I have used the Plug-in load times plugin to see what is causing QGIS to open slowly. You might want to try it and see if your plugin is causing the slowdown.
    – Baswein
    Jul 13, 2020 at 15:07
  • Did you remove your plugin(s) just to see how it impact the loading speed?
    – ThomasG77
    Jul 13, 2020 at 17:10
  • @ThomasG77 Yup I tried to uninstall them and it didn't change anything. My QGIS became slow all of a sudden and I can't find a way to get it as it was before. Just tried the Plugin Load Times like Baswein recommended and it takes only 4sec for all my plugins to load. Jul 13, 2020 at 17:15
  • 1
    What happened if you create a New Profile (e.g Settings -> User Profiles -> New Profile...) and run QGIS with it? Always slow?
    – ThomasG77
    Jul 13, 2020 at 17:54
  • 1
    It's because "New Profile" more or less a QGIS with default conf, no plugins and other things (clearly do not know all about this) You can go to Settings -> User Profiles -> Open Active Profile Folder and do it for both your profiles and then can try to sort out why it's so slow by comparing contents from both folders. More a beginning to track the memory issue but at least a clue.
    – ThomasG77
    Jul 13, 2020 at 18:04

2 Answers 2

23

So after taking into account what ThomasG77 told me to fix my QGIS, I've found that indeed creating a new profile fixes the slowdown, but I didn't want to have to create a new profile everytime it got this slow, then reinstall my plugins,etc. The problem does seem to lie with the QGIS3.ini which kept getting bigger and bigger (After creating a new profile I saw that the default QGIS3.ini which I was using was 42000 times bigger than the one that you begin with from scratch).

However I found a simple solution to fix it without having to delete anything or create a new profile. You simply need to open QGIS, go in Settings > Options... > System. Then under "Settings" you'll see this: enter image description here

I tried it and this not only reset my QGIS3.ini from 547k KB to 59KB, but it also kept all of the plugins I'd installed. Now it opens super fast again and everything works as it should.

Alternatively, creating a new profile does work if you're scared that doing the reset will affect some changes you've made, but as for myself the reset accomplished everything I needed it to do.

3
  • 1
    This was a great find! It took my load times from 3 minutes (or more) to under 10 seconds.
    – Cary H
    Jun 10, 2021 at 19:06
  • It would be interesting to see what in the qgis3.ini file that differs from the clean version. Trying a tool like text-compare.com with the raw text will show differences clearly. In my case the biggest difference was the "state=" settings. Jul 7, 2021 at 6:56
  • Any chance to use this Reset user interface function on PYQGIS? Sep 27, 2021 at 14:50
16

More a guide than a definitive answer. It's a structured compilation of comments from the post.

Try to find out why it's slow by using

  • a plugin called "Plugin Load Times" to see plugins loading consumption. Be careful as stated in the plugin description

    It does not give you information about the speed of plugins when they are used.

  • try to disable all your plugins to track if any memory leak somewhere

  • see your overall memory consumption (using Windows Task Manager if Windows; use glances, top or ps on Linux; use OSX Task Manager for Mac)

  • try to create a new user profile and use QGIS with it going to "Settings -> User Profiles -> New Profile...". If it works, try to compare both Profile folders by opening both of them using "Settings -> User Profiles -> Open Active Profile Folder". Profiles are more or less like a reset, you need to reinstall plugins. They can be useful if you have different QGIS user profiles in your company. Some people do only drawing: hide to them most buttons not for edition. Some other does only need to consult, give them only buttons to browse, click informations and select features, ...

  • close "Browser panel" window as it may cause a scan of directories that consume a lot of memory and slow things down

  • be sure you do not have a 2nd hard drive remains info (https://gis.stackexchange.com/a/384356/638) or you do not load stuff from a shared network hard drive disk. Try by loading stuff from local hard drive to be sure it's not related

  • Go to menu "Settings" > "Options". In new Windows, go to tab "System" > "Settings" > "Reset user interface to default settings (restart required)" and restart QGIS (info from accepted answer from the current question)

  • Particular case: when related to particular projects layer, it may be slow because you do not set an index (for vector data). Go to "Layer properties" > tab "Source" > "Geometry" and click on "Create Spatial Index". It may not be possible to do so (greyed option) if index already exists or the layer uses a vector format not supporting indexing within QGIS

This answer can also help troubleshooting in particular if network issues https://gis.stackexchange.com/a/402625/638 or plugins issues (by looking at "Log Messages Panel")

1
  • all I had to do was close the Browser window - cured the whole issue.
    – Kevin H
    Aug 26, 2022 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.