[Qgis-user] FW: Couldn't load SIP module - Windows 10

Fred Perloff fred at perloff.us
Tue Oct 5 12:10:30 PDT 2021


Prior to starting QGIS:
Path=C:\PROGRA~1\QGIS32~1.3\apps\qt5\bin;C:\PROGRA~1\QGIS32~1.3\apps\Python39\Scripts;C:\PROGRA~1\QGIS32~1.3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem
PYTHONHOME=C:\PROGRA~1\QGIS32~1.3\apps\Python39
PYTHONPATH=C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\DLLs;C:\ProgramData\Anaconda3\lib;C:\ProgramData\Anaconda3\lib\site-packages;C:\ProgramData\Anaconda3\lib\site-packages\win32;C:\ProgramData\Anaconda3\lib\site-packages\win32\lib;C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin;
QGIS_PREFIX_PATH=C:/PROGRA~1/QGIS32~1.3/apps/qgis
QT_PLUGIN_PATH=C:\PROGRA~1\QGIS32~1.3\apps\qgis\qtplugins;C:\PROGRA~1\QGIS32~1.3\apps\qt5\plugins

After starting QGIS from OSGeo4W shell:
Path=C:\PROGRA~1\QGIS32~1.3\apps\qgis\bin;C:\PROGRA~1\QGIS32~1.3\apps\grass\grass78\lib;C:\PROGRA~1\QGIS32~1.3\apps\grass\grass78\bin;C:\PROGRA~1\QGIS32~1.3\apps\qt5\bin;C:\PROGRA~1\QGIS32~1.3\apps\Python39\Scripts;C:\PROGRA~1\QGIS32~1.3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem
PYTHONHOME=C:\PROGRA~1\QGIS32~1.3\apps\Python39
PYTHONPATH=C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\DLLs;C:\ProgramData\Anaconda3\lib;C:\ProgramData\Anaconda3\lib\site-packages;C:\ProgramData\Anaconda3\lib\site-packages\win32;C:\ProgramData\Anaconda3\lib\site-packages\win32\lib;C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin;
QGIS_PREFIX_PATH=C:/PROGRA~1/QGIS32~1.3/apps/qgis
QT_PLUGIN_PATH=C:\PROGRA~1\QGIS32~1.3\apps\qgis\qtplugins;C:\PROGRA~1\QGIS32~1.3\apps\qt5\plugins

PYTHONPATH is owned by Anaconda – QGIS doesn’t seem to touch that variable.
When QGIS starts, it prepends apps\qgis\bin and app\Python39\Scripts to the PATH

I started python from the OSGeo4W console. Here’s output of sys.path:

['', 'C:\\ProgramData\\Anaconda3', 'C:\\ProgramData\\Anaconda3\\DLLs', 'C:\\ProgramData\\Anaconda3\\lib', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Program Files\\QGIS 3.20.3', 'C:\\PROGRA~1\\QGIS32~1.3\\bin\\python39.zip', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\DLLs', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib', 'C:\\PROGRA~1\\QGIS32~1.3\\bin', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\Pythonwin']

Anaconda goes first, before QGIS. I’m not surprised that QGIS can’t find its modules.

I think I’ll uninstall QGIS, and reinstall from conda-forge.

From: Richard Duivenvoorde
Sent: Sunday, October 3, 2021 2:59 AM
To: qgis-user at lists.osgeo.org
Cc: Fred Perloff
Subject: Re: [Qgis-user] FW: Couldn't load SIP module - Windows 10

On 10/2/21 8:35 PM, Fred Perloff wrote:
> Thank you for your prompt and insightful replies!
> 
> I decided to clean the slate – I uninstalled Anaconda & OsGEO4w, and rebooted. The PATH was clear of any references to python(s) and there were no PYTHONPATH or PYTHONHOME variables.
> 
> I reinstalled Anaconda, and made sure that I did NOT add conda to PATH. I installed QGIS desktop 3.20 and started the program. I received a very similar error message to last time. Both QGIS and Anaconda write to “Python path,” though >QGIS entries are first in order.

Can you start/stop QGIS from the osgeo4w.bat terminal and check the values of PATH and PYTHONPATH there? Just to be sure that osgeo4w is ONLY pointing to the python versions of osgeo4w (and not tainted by conda's).

Also: not only check python but also available QT/sip related environment variables.

Another check: 
(mmm wanted to ask you to check sys.path in python console in QGIS... but THAT you do not have :-)
Then: for the osgeo4w.bat terminal start python and in that console:
import sys
print(sys.path)
and check which path's osgeo4w python is seeing/using?

(note: you could do the same in the conda environment)

Another work around: do not use the osgeo4w QGIS, but the conda QGIS?

Regards,

Richard Duivenvoorde

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211005/62520b51/attachment.html>


More information about the Qgis-user mailing list