qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.29k stars 2.96k forks source link

Couldn't load SIP module. Python support will be disabled. QGIS 3.10 LTR Windows 10 64-bit #37783

Closed abhiinav-18 closed 4 years ago

abhiinav-18 commented 4 years ago

I used to work on QGIS 3.4 some months back but then started using Anaconda for python. Recently I got back on QGIS. I downloaded the QGIS 3.10 LTR (64-bit) but ran into an error saying "Couldn't load SIP module. Python support will be disabled". I am not able to install any plugins because of no python support.

**Error message on launch: Couldn't load SIP module. Python support will be disabled.

Traceback (most recent call last): File "", line 1, in File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis__init__.py", line 70, in from qgis.PyQt import QtCore File "C:/PROGRA~1/QGIS3~1.10/apps/qgis-ltr/./python\qgis\PyQt\QtCore.py", line 24, in from PyQt5.QtCore import * ImportError: DLL load failed: The specified procedure could not be found.

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]

QGIS version: 3.10.7-A Coruña 'A Coruña', 7b4ca4c8d0** New Text Document.txt

nyalldawson commented 4 years ago

Did you install qgis using anaconda? If so , this isn't the recommended approach, and there's many known issues like this

abhiinav-18 commented 4 years ago

Did you install qgis using anaconda? If so , this isn't the recommended approach, and there's many known issues like this

no, I downloaded it from the QGIS website. I also had QGIS 3.4 from before and I got the new verson today.

roya0045 commented 4 years ago

Seems like a syspath issue, though I never encountered any with anaconda and qgis. In you deinstall anaconda, does that fix the problem? I recall there was options to modify path variables when installing conda.

Also does your 3.4 install still works (assuming you didn't remove it)?

abhiinav-18 commented 4 years ago

I have not removed my anaconda yet. If I remove it then do I have to add a library like TensorFlow again? I don't want to lose all that also.

I had removed QGIS 3.4 when I got 3.10. Although I installed 3.4 again as I had the setup and it has the same error now. You are right regarding path variables can you tell more.

this link may help solve but I couldn't understand it: https://gis.stackexchange.com/questions/108458/couldnt-load-sip-module-qgis-doesnt-load-python

roya0045 commented 4 years ago

In your anaconda do you have pyqt installed? Your link made me curious if you have another qt lib that could intercept the one in qgis.

abhiinav-18 commented 4 years ago

Thanks for helping out. I did a 'conda list' in anaconda command prompt and found that I've got a PyQt library. I'll add the snap in the command.

interestingly I also found an old version of QGIS on my laptop i.e. QGIS 2.14 Essen. I installed it and found the same problem. Only the python version in error was Python 2.7 there. pyqt

gioman commented 4 years ago

@abhiinav-18 I think this is a local issue and I'm inclined to close this ticket.

abhiinav-18 commented 4 years ago

I think many people suffer from the same problem as I'm. Also, this is my first post on Github so I don't know the rules around here. All I can do is request you not to close the issue without a solution.

gioman commented 4 years ago

All I can do is request you not to close the issue without a solution.

@abhiinav-18 no valid general issue is closed without a solution, but this do not seems to be a general QGIS issue, but of course I'll leave to more informed persons to take the decision.

markjessell commented 4 years ago

I have the same problem (using qgis 3.14 but also running older versions). I also am running anaconda. I haven't found a solution yet.

markjessell commented 4 years ago

I have the same problem (using qgis 3.14 but also running older versions). I also am running anaconda. I haven't found a solution yet.

to be specific it is slightly different but probably related to the same cause:

Couldn't load SIP module. Python support will be disabled.

Traceback (most recent call last): File "", line 1, in File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis__init.py", line 78, in import qgis.gui File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\gui\init__.py", line 25, in from qgis._gui import * RuntimeError: the sip module implements API v12.0 to v12.4 but the qgis._gui module requires API v12.6

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]

QGIS version: 3.14.0-Pi 'Pi', 9f7028fd23

roya0045 commented 4 years ago

Out of curiousity, try removing pyqt from your packages

markjessell commented 4 years ago

thanks for the suggestion, but it didn't change anything (and neither did reinstalling it afterwards)

Desiree22 commented 4 years ago

I also had the same issue! not sure what caused it but I may have made an unintended change to one of the bat files.

Problem solved by deleting the python 3.7 folder. Folder python 3.7 is in the directory C:\Users\Admin\AppData\Roaming\Python

This may have other consequences but at least for now I am able to run my QGIS again without the python error. I also have anaconda installed and everything is working fine.

QGIS version: 3.14.1 Python Version: 3.7.4 Windows 10 Home Version 2004

markjessell commented 4 years ago

wow, thank you Desiree, that fixed it for me as well! I just renamed the python directory (just in case!!) in the equivalent path (my user name instead of Admin), so now all is right with the world!

gioman commented 4 years ago

Closing as a solution has been provided.

kikislater commented 4 years ago

Question remain why qgis is looking in this folder ... May be paths definition could be enhance in some .bat

rdejtiar commented 4 years ago

Captura de pantalla_2020-08-09_17-25-19 I have the same problem and I will try to fix it , but on my system the message is a bit different and refers to an undefined symbol at QtCore.so Running on Linux Mint 20 Ulyana base: Ubuntu 20.04 focal

CRTejaswi commented 3 years ago

I had the same problem. I use pip package manager. I got over this issue by removing all PyQt5 packages (I don't use them anyway). On Windows, this came in handy:

(pip list) -match 'qt'
python -m pip uninstall pyqt5 pyqt5-sip qtconsole
msecher commented 3 years ago

Hi,

I applied the solution of CRTejaswi of removing PyQt5 packages and it worked for qgis (I have a QGIS 3.14.1 and QGIS 3.10.9 on a debian 10).

My problem is that I have others softwares which need PyQt5 to work.

Is there any other solution to keep PyQt5 packages and still be able to run QGIS 3 ?

roya0045 commented 3 years ago

@msecher which version of pyqt5 did you have/need?

abhiinav-18 commented 3 years ago

@Desiree22 solution worked for me on QGIS version 3.10.10. I did not remove any PyQt packages and now I've python support in QGIS.

msecher commented 3 years ago

@roya0045 I need at least PyQt5 5.9.0 and I have PyQt5 5.15.1

@Desiree22 I tried to install QGIS 3.10.10 and it is still not working for me.

markjessell commented 3 years ago

In the end what worked for me was to write a small script that I run from Cygwin but a bat script would do too:

1) renames my anaconda python directory to python_temp 2) launches qgis 3) pauses for ten seconds until qgis is launched 4) renames the python_temp directory back to python

Stupid but effective, and once qgis has launched it has all the plugins and my other python code runs fine too.

Mark Jessell Professor/ Western Australian Fellow Centre for Exploration Targeting/ SES • M006, Perth WA 6009 Australia T +61 8 6488 5803 • E mark.jessell@uwa.edu.au


From: msecher notifications@github.com Sent: Saturday, October 17, 2020 6:41:06 AM To: qgis/QGIS QGIS@noreply.github.com Cc: Mark Jessell mark.jessell@uwa.edu.au; Comment comment@noreply.github.com Subject: Re: [qgis/QGIS] Couldn't load SIP module. Python support will be disabled. QGIS 3.10 LTR Windows 10 64-bit (#37783)

@roya0045https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Froya0045&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724880018&sdata=7fnlooGaCljL45RDlUUzQD5YZJsFnjsIr%2BJEo1DROXw%3D&reserved=0 I need at least PyQt5 5.9.0 and I have PyQt5 5.15.1

@Desiree22https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDesiree22&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724880018&sdata=YuBkxY541Y3ssKlFyUi46uU%2BFfFdWkC%2Bfw493yvsX0I%3D&reserved=0 I tried to install QGIS 3.10.10 and it is still not working for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqgis%2FQGIS%2Fissues%2F37783%23issuecomment-710683872&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724890019&sdata=4Z3WcgTlyDIoB5mfxMUguZbUearZspf%2FkGNBKae5Nv0%3D&reserved=0, or unsubscribehttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABUBSYFYC7FOIQZTTZXVD7DSLDDYFANCNFSM4OX7TTBA&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724890019&sdata=a%2F6RNBppjaL5DAc5cILJBmZRz7rQ%2FI%2FLRFxPxK3aVJA%3D&reserved=0.

markjessell commented 3 years ago

The actual script I use is:

!/bin/bash

mv /cygdrive/c/Users/00073294/AppData/Roaming/Python /cygdrive/c/Users/00073294/AppData/Roaming/Python_xx "/cygdrive/c/Program Files/QGIS 3.14/bin/qgis-bin.exe" & sleep 15 mv /cygdrive/c/Users/00073294/AppData/Roaming/Python_xx /cygdrive/c/Users/00073294/AppData/Roaming/Python

obviously paths will have to be changed to get this to work on anyone else computer...

From: Mark Jessell mark.jessell@uwa.edu.au Sent: Saturday, 17 October 2020 7:36 AM To: qgis/QGIS reply@reply.github.com; qgis/QGIS QGIS@noreply.github.com Cc: Comment comment@noreply.github.com Subject: Re: [qgis/QGIS] Couldn't load SIP module. Python support will be disabled. QGIS 3.10 LTR Windows 10 64-bit (#37783)

In the end what worked for me was to write a small script that I run from Cygwin but a bat script would do too:

1) renames my anaconda python directory to python_temp 2) launches qgis 3) pauses for ten seconds until qgis is launched 4) renames the python_temp directory back to python

Stupid but effective, and once qgis has launched it has all the plugins and my other python code runs fine too.

Mark Jessell Professor/ Western Australian Fellow Centre for Exploration Targeting/ SES M006, Perth WA 6009 Australia T +61 8 6488 5803 E mark.jessell@uwa.edu.aumailto:mark.jessell@uwa.edu.au


From: msecher notifications@github.com<mailto:notifications@github.com> Sent: Saturday, October 17, 2020 6:41:06 AM To: qgis/QGIS QGIS@noreply.github.com<mailto:QGIS@noreply.github.com> Cc: Mark Jessell mark.jessell@uwa.edu.au<mailto:mark.jessell@uwa.edu.au>; Comment comment@noreply.github.com<mailto:comment@noreply.github.com> Subject: Re: [qgis/QGIS] Couldn't load SIP module. Python support will be disabled. QGIS 3.10 LTR Windows 10 64-bit (#37783)

@roya0045https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Froya0045&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724880018&sdata=7fnlooGaCljL45RDlUUzQD5YZJsFnjsIr%2BJEo1DROXw%3D&reserved=0 I need at least PyQt5 5.9.0 and I have PyQt5 5.15.1

@Desiree22https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDesiree22&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724880018&sdata=YuBkxY541Y3ssKlFyUi46uU%2BFfFdWkC%2Bfw493yvsX0I%3D&reserved=0 I tried to install QGIS 3.10.10 and it is still not working for me.

- You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqgis%2FQGIS%2Fissues%2F37783%23issuecomment-710683872&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724890019&sdata=4Z3WcgTlyDIoB5mfxMUguZbUearZspf%2FkGNBKae5Nv0%3D&reserved=0, or unsubscribehttps://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABUBSYFYC7FOIQZTTZXVD7DSLDDYFANCNFSM4OX7TTBA&data=02%7C01%7Cmark.jessell%40uwa.edu.au%7Cb3f497385be745afd5b608d8722494e1%7C05894af0cb2846d8871674cdb46e2226%7C1%7C0%7C637384848724890019&sdata=a%2F6RNBppjaL5DAc5cILJBmZRz7rQ%2FI%2FLRFxPxK3aVJA%3D&reserved=0.

CRTejaswi commented 3 years ago

Hi,

I applied the solution of CRTejaswi of removing PyQt5 packages and it worked for qgis (I have a QGIS 3.14.1 and QGIS 3.10.9 on a debian 10).

My problem is that I have others softwares which need PyQt5 to work.

Is there any other solution to keep PyQt5 packages and still be able to run QGIS 3 ?

@msecher is there a system conflict if you install PyQt5 as a --user installation or in a virtual environment?

# User Installation
pip install --user PyQt5
# Virtual-Environment based Installation
python -m venv myProject/venv; cd myProject
source venv/bin/activate
pip install PyQt5
sean-44 commented 2 years ago

I ran into this problem today and didn't want to uninstall anything so searched around. In QGIS, Go to Settings > Options >System >Environment. I selected the 'Use custom variables' checkbox and for the Variable PYTHONPATH, I changed to the Python within OSGEO4W like so: VALUE = C:\OSGeo4W\apps\Python39\Lib\site-packages;C:\OSGeo4W\apps\Python39\Lib;C:\OSGeo4W\apps\Python39

Initially it was in my other Python folder on my root drive that I use Anaconda on. This fixed the issue for me and I didn't need to remove anything or create a batch file. Hope it helps.

fotisAnagnostopoulos commented 2 years ago

I ran into this problem today and didn't want to uninstall anything so searched around. In QGIS, Go to Settings > Options >System >Environment. I selected the 'Use custom variables' checkbox and for the Variable PYTHONPATH, I changed to the Python within OSGEO4W like so: VALUE = C:\OSGeo4W\apps\Python39\Lib\site-packages;C:\OSGeo4W\apps\Python39\Lib;C:\OSGeo4W\apps\Python39

Initially it was in my other Python folder on my root drive that I use Anaconda on. This fixed the issue for me and I didn't need to remove anything or create a batch file. Hope it helps.

In the spirit of this approach, i just added my miniconda path as value of variable PATH

pepeto commented 2 years ago

@fotisAnagnostopoulos I had no PYTHONPATH variable declared and I created it with the value c:\Program Files\Python39\ and it worked. THANK YOU for the idea!

Bookervsky commented 2 years ago

@Desiree22 It did work , appreciate it!

Cezembre commented 2 years ago

Hello All,

I face the same issue for me with QGis 3.18 on Linux Debian :

The SIP module could not be loaded. 
Python support will be disabled.

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 70, in 
    from qgis.PyQt import QtCore
  File "/usr/lib/python3/dist-packages/qgis/PyQt/QtCore.py", line 24, in 
    from PyQt5.QtCore import *
ImportError: /lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/johndoe/.local/lib/python3.7/site-packages/PyQt5/QtCore.abi3.so)

Python Version :
3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0]

Version de QGIS :
3.18.3-Zürich 'Zürich', 735cc85be9

Python path :
['/usr/share/qgis/python', '/home/johndoe/.local/share/QGIS/QGIS3/profiles/default/python', '/home/johndoe/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/johndoe/.local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']

Any help to fix it ? Thanks !

kikislater commented 2 years ago

Why do you need 3.18 ? 3.22 is released now

Cezembre commented 2 years ago

Just fixed !

I unistalled Qt and Qgis, then reinstalled Qgis. It seems to work for me.

Hope it will help other Linux user...

Philanoe commented 1 year ago

Hi, I had the same problem on Ubuntu 22. Using a conda virtual environment with sip did not solve the problem. Finally, I just used "sudo qgis" instead of "qgis" to launch the application from the terminal, and it worked.

do4sch commented 1 year ago

I have some kind of the same problem on Windows Server 2022 and QGIS Server 3.28.3

``14:19:01 WARNING Python error[10088]: An error occurred during execution of following code: os.environ['HOME']=os.environ['USERPROFILE']

Traceback (most recent call last): File "", line 1, in File "C:\OSGeo4W\apps\Python39\lib\os.py", line 679, in getitem raise KeyError(key) from None KeyError: 'USERPROFILE'

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]

QGIS version: 3.28.3-Firenze 'Firenze', c12bcb2f76c

Python path: ['C:\OSGeo4W\apps\Python39', 'C:\OSGeo4W\apps\Python39\Scripts', 'C:\OSGeo4W\bin\python39.zip', 'C:\OSGeo4W\apps\Python39\DLLs', 'C:\OSGeo4W\apps\Python39\lib', 'C:\OSGeo4W\apps\qgis\bin', 'C:\OSGeo4W\apps\Python39\lib\site-packages', 'C:\OSGeo4W\apps\Python39\lib\site-packages\win32', 'C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib', 'C:\OSGeo4W\apps\Python39\lib\site-packages\Pythonwin'] 14:19:01 WARNING Python error[10088]: Couldn't load SIP module. Python support will be disabled.``

BinoyKadakkal commented 1 year ago

I had the same problem. I use pip package manager. I got over this issue by removing all PyQt5 packages (I don't use them anyway). On Windows, this came in handy:

(pip list) -match 'qt'
python -m pip uninstall pyqt5 pyqt5-sip qtconsole

This worked for me.

filchos commented 1 year ago

The approach of sean-44 worked for me as well. I'm on Linux (Ubuntu)

I retrieved the value for PYTHONPATH from

which python3

and added it in QGIS to Settings > Options … > System > Environment.

After a restart the error did not pop up again.

GregDeakin commented 1 year ago

Same problem here.

I have Ubuntu on Windows WSL2. Anaconda install of Python 3.9 and apt install of Python 3.8.

I've fixed by purging 3.9 and QGIS. Then reinstalling QGIS and removing PyQt5* from ~/.local/lib/Python3.8/site-packages.

I suspect just removing the the the PyQt5 stuff from site-packages would have been sufficient

Inna949Festchuk commented 11 months ago
  1. узнаю путь which python
  2. в настройках QGIS (как было выше) > переменные среды > добавить его в начало PATH
  3. Всем спасибо!
arturitorv commented 9 months ago

I ran into this problem today and didn't want to uninstall anything so searched around. In QGIS, Go to Settings > Options >System >Environment. I selected the 'Use custom variables' checkbox and for the Variable PYTHONPATH, I changed to the Python within OSGEO4W like so: VALUE = C:\OSGeo4W\apps\Python39\Lib\site-packages;C:\OSGeo4W\apps\Python39\Lib;C:\OSGeo4W\apps\Python39

Initially it was in my other Python folder on my root drive that I use Anaconda on. This fixed the issue for me and I didn't need to remove anything or create a batch file. Hope it helps.

It worked for me, Thank U!! Instead of using C:\OSGeo4W\apps\Python39\Lib\site-packages;C:\OSGeo4W\apps\Python39\Lib;C:\OSGeo4W\apps\Python39, I used Variable = PYTHONPATH, Value = E:\Program Files\QGIS 3.34.0\apps\Python39\lib\site-packages;E:\Program Files\QGIS 3.34.0\apps\Python39\lib;E:\Program Files\QGIS 3.34.0\apps\Python39

stibinator commented 9 months ago

On Ubuntu Jammy, adding the PYTHONPATH to the environment variables didn't work, what did work was pip uninstall pyqt5. Before this not only was I getting the error at startup I was also unable to load any plugins.

anisometropie commented 6 months ago

To document this case on linux, this error happened when I tried to start qgis from a shell (which I didn’t see) was a poetry shell. it works ok when I start qgis from a normal shell.

Couldn't load SIP module.
Python support will be disabled.


Traceback (most recent call last):
  File \"\", line 1, in
ModuleNotFoundError: No module named 'qgis'

Python version:
3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0]

QGIS version:
3.28.14-Firenze 'Firenze', exported

Python path:
['/usr/share/qgis/python', '/home/ut/.local/share/QGIS/QGIS3/profiles/default/python', '/home/ut/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python311.zip', '/usr/lib/python3.11', '/usr/lib/python3.11/lib-dynload']

davidoclubb commented 2 months ago

Hi, I had the same problem on Ubuntu 22. Using a conda virtual environment with sip did not solve the problem. Finally, I just used "sudo qgis" instead of "qgis" to launch the application from the terminal, and it worked.

This also worked for me on Fedora, thanks!