4

I am using QGIS 3.14.16 and I believe, I have somehow corrupted my QGIS/Python interaction.

My Problem: When I open QGIS and the status information reads "Starting Python", the application just closes. No error message, it is just gone. When I start in administrator mode however, it all works fine.

How I ruined the setup I had it running just fine after the initial installation. I then changed the PYTHONPATH and PYTHONHOME variables in QGIS to try to work on a virtual environment on my system. After restarting QGIS, it would not start again. I have not added any System or User Variables in the Windows settings.

How I tried to fix it I have uninstalled and deleted all files associated with QGIS twice now, but whenever I reinstall the problem is the same. QGIS is now installed in C:\Program Files\QGIS. I checked the file \QGIS\bin\qgis-bin.env and PYTHONHOME and PYTHONPATH look fine to me:

PYTHONHOME=C:\PROGRA~1\QGIS\apps\Python37
PYTHONPATH=C:\PROGRA~1\QGIS\apps\Python37;C:\PROGRA~1\QGIS\apps\Python37\Scripts

The content in \QGIS\bin\p3_env.bat also looks fine to me:

SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37
SET PYTHONPATH=%PYTHONHOME%;%PYTHONHOME%\Scripts
PATH %PYTHONPATH%;%PATH%

My research I found this unresolved Bug, which describes someone messing with PYTHONPATH and PYTHONHOME as well and consequently resulting in QGIS crashing. I believe he changed the variables not within QGIS (what I did), but within his User Environmental Variables. After deleting them, it worked for him again.

I found a similar bug here where the solution again was to delete environment variables. Again, I did not set any windows environment variables.

As I said, starting in administrator mode is possible, but this is not my preferred option. I want to make sure that my setup is well defined. Additionally I have encountered problems when working with "Actions", which might be related to this problem. Does anyone have ideas, what might cause the troubles? Any suggestions on what to try?

3
  • 1
    Dont have an answer, but does "uninstalled and deleted all files" also include your QGIS user profile within C:/Users...? Usually this should reset all settings made in QGIS.
    – MrXsquared
    Sep 28 '20 at 14:02
  • I believe I did that, but to be entirely sure I will do the same thing now again and let you know.
    – anonix89
    Sep 28 '20 at 14:10
  • Wow, I don't believe it... There were some QGIS profile settings in C:Users\Me\Appdata\Roaming which I apparently did not find before (when searching for QGIS in the file explorer...). After deleting everything there, it works again! Thank you so much
    – anonix89
    Sep 28 '20 at 15:09
4

Make sure to also delete your QGIS profile located at C:\Users\YourUsername\AppData\Roaming\QGIS\QGIS3\profiles. This should reset all settings you have made in QGIS. After you deleted this folder, you can reinstall QGIS clean and freshly.

Note that AppData folder is hidden by Windows by default. Here is how to show them.

On linux it should be located at /home/USER/.local/share/QGIS/QGIS3/profiles and on MacOS ~/Library/Application\Support/QGIS/QGIS3/profiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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