I recently installed QGIS 2.4, but Python does not load. I am running on a Windows 64 bit machine.
I receive the error message "Couldn't load SIP module Python support will be disabled".
Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed: %1 is not a valid Win32 application.
I have another installation of Python at C:/Python27. It is the 32-bit version.
When I remove C:/Python27 folder, QGIS works fine, so there is some linkage between the new QGIS installation and the C:/Python27 python interpreter. I can't permanently delete C:/Python because I need it for other applications, so I am wondering if there are any suggestion as to how to fix this.
5 Answers 5
In a command window, type set > set.txt
to get a list of all environment variables you have set. Your python installation may have set some values that QGIS does not like.
The PATH variable is save, because qgis.bat sets its own path variable, but PYTHONPATH or something else may be harmful.
Once you found a link to C:\Python27
, go to the system properties and change the environment variable (not sure how the commands are in your language version).
-
Thanks Andre, I deleted out the PYTHONPATH links and the problem was solved. Interestingly, when I added them back into a new PYTHONPATH, QGIS/Python still work.user44796– user447962014年07月25日 19:12:57 +00:00Commented Jul 25, 2014 at 19:12
pip3 uninstall PyQt5 worked for me
In my case, it turns out to be a conflict of different versions of python. I uninstalled python 3.7 after I installed the latest python 3.8.
Somehow QGIS was still using python 3.7. And the folder python 3.7
reminds in the directory C:\Users\user\AppData\Roaming\Python
.
Problem solved by deleting the python 3.7 folder.
BTW, it is a case on Windows
-
Deleting
C:\Users\user\AppData\Roaming\Python
folder worked for me.Kadir Şahbaz– Kadir Şahbaz2020年10月26日 23:05:15 +00:00Commented Oct 26, 2020 at 23:05 -
Useful tip. However, I had to use Anaconda also. Therefore , I am just renaming the folderaddcolor– addcolor2021年06月16日 16:36:21 +00:00Commented Jun 16, 2021 at 16:36
Removing the PYTHONPATH
environment variable as suggested above did not work in my case with QGIS 2.18.9 w/ GRASS x64 and python 2.7 on Win7. For some reason, I had to remove c:\python27
from my PATH
(temporarily), and add the QGIS install python27 folder to my PYTHONPATH
variable. Then QGIS 2.18.9 started up without this error. I was able to add c:\python27
back into my path and restart QGIS with no difficulty, and my python plugins are working again.
-
I found a (possibly) better solution. There is a
python-core.bat
inC:\Program Files\QGIS 2.18\etc\ini
that sets up the python environment variables. I just added a:set PYTHONPATH=%OSGEO4W_ROOT%\apps\Python27;%OSGEO4W_ROOT%\apps\Python27\Lib;%OSGEO4W_ROOT%\apps\Python27\Lib\site-packages;%PYTHONPATH%
. I also added the%OSGEO4W_ROOT%\apps\Python27
directory to the PATH on the next line.Heath– Heath2017年06月21日 14:45:38 +00:00Commented Jun 21, 2017 at 14:45
for QGIS 3.22 below commands works
sudo -H pip3 uninstall PyQt5-sip
sudo -H pip3 uninstall PyQt5
sudo -H pip3 install sip
Explore related questions
See similar questions with these tags.