4

I've just updated to the current version (2.18.5 on Windows) of QGIS, in the hope of getting rid of the above error, without success. Some time ago I tried to install the QField Sync plugin, which I believe was the first time I saw this error.

One thing I notice is the weird file path apps/qgis/./python\qgis, it's got slashes going both ways and a dot in the middle! If you ignore the weirdness the path does exist though.

ImportError: cannot import name uic Traceback (most recent call last): File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 308, in loadPlugin __import__(packageName) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\__init__.py", line 29, in from processing.tools.general import * # NOQA File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\tools\general.py", line 31, in from processing.core.Processing import Processing File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\core\Processing.py", line 42, in from processing.script.ScriptUtils import ScriptUtils File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\script\ScriptUtils.py", line 30, in from processing.script.ScriptAlgorithm import ScriptAlgorithm File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\script\ScriptAlgorithm.py", line 34, in from processing.gui.Help2Html import getHtmlFromHelpFile File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\gui\__init__.py", line 1, in from qgis.PyQt import uic ImportError: cannot import name uic Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] QGIS version: 2.18.5 Las Palmas, 140a01f Python Path: C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python C:/Users/marcp/.qgis2/python C:/Users/marcp/.qgis2/python/plugins C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg C:\PROGRA~1\QGIS2~1.18\bin\python27.zip C:\PROGRA~1\QGIS2~1.18\apps\Python27\DLLs C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\plat-win C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\lib-tk C:\PROGRA~1\QGIS2~1.18\bin C:\PROGRA~1\QGIS2~1.18\apps\Python27 C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\PIL C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\win32 C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\win32\lib C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\Pythonwin C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\wx-2.8-msw-unicode C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg C:/Users/marcp/.qgis2//python 
0

4 Answers 4

9

Sometimes it is possible that some files from older installations aren't correctly replaced/deleted when updating to the newest QGIS version and you may get an error like the one that you reported.

For these cases, an option is trying to delete the .qgis2 folder, which should be placed (in Windows) at this location:

C:\Users\account_name 

where account_name is the name of your system account.

This folder will be automatically created at the next start of QGIS (remember to backup the custom scripts and models before deleting the .qgis folder, otherwise you will definitively lost them!).

1
  • 1
    After install QFieldSync and QGIS2compat in linux mint, then delete .qgis folder and restart QGIS, anything is OK. Commented Nov 18, 2017 at 20:46
4

I had a similar error message: "cannot import name QtWidgets" when I tried to install "QFieldSync" plugin on a fresh install of QGIS 2.18.9 (on Windows 10).

I followed @mgri's instructions and deleted the .qgis2 folder (which persisted after the install). I then installed the "QGIS2compat" plugin and then tried to install "QFieldSync" when I got the above error message.

I uninstalled "QFieldSync" and restarted QGIS (having looked at related question 219245). I tried to install the "QFieldSync" plugin again, and this time got no error messages.

1

Had the same issue installing QField in QGIS 2.18.10 I tried; restarting and deleting .qgs folder (suggested in another post) but the issue persisted. The issue resolved itself when I used the OSGeo Installer to remove pyQT5, reinstall pyQT4 and the QScintilla. I have not yet tried to reinstall pyQT5 yet but the plugin now installs and seems to be working.

1

I just had the same error on Ubuntu Desktop running QGIS 2.18.16. This error occurred after I attempted to install QField Sync, which required the installation of QGIS2compat. when opening QGIS, I received the same error "cannot import name uic...". To resolve the issue, I uninstalled QGIS2compat and restarted QGIS. Upon restart, the error did not appear and the Processing tool and all other plugins (e.g. Profile Tool) work once again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.