Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSGEO:QRAVE not installing with QGIS 3.28 - Can't find module lxml #86

Closed
bbelletti opened this issue Oct 25, 2022 · 13 comments
Closed
Assignees
Labels
🐛 bug Something isn't working 🌐 Viewer QGIS

Comments

@bbelletti
Copy link

Error message thrown:

Impossible de charger l'extension 'qrave_toolbar' provoque une erreur lors de l'appel à sa méthode classFactory() 

ModuleNotFoundError: No module named 'lxml' 
Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/belle/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qrave_toolbar\__init__.py", line 40, in classFactory
    from .src.qrave_toolbar import QRAVE
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/belle/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qrave_toolbar\src\qrave_toolbar.py", line 29, in 
    from .classes.basemaps import BaseMaps
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/belle/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qrave_toolbar\src\classes\basemaps.py", line 7, in 
    import lxml.etree
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'lxml'


Version de Python : 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] 
Version de QGIS : 3.28.0-Firenze Firenze, ed3ad0430f3 

Chemin Python :
C:/OSGeo4W/apps/qgis/./python
C:/Users/belle/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/belle/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/OSGeo4W/apps/qgis/./python/plugins
C:\Program Files\QGIS 3.4\apps\Python37\Scripts
@bbelletti
Copy link
Author

Same error with version 3.4.14

@MattReimer MattReimer self-assigned this Oct 25, 2022
@MattReimer MattReimer added the 🐛 bug Something isn't working label Oct 25, 2022
@MattReimer
Copy link
Member

I have not been able to reproduce this on any version of QGIS so far on windows 10 64-bit

Here are the versions I've tried:

QGIS version
3.28.0-Firenze

QGIS version
3.26.3-Buenos Aires

QGIS version
3.16.10-Hannover

Questions:

Is this a fresh install? Have you customized the python paths or modules in any way? I see a reference to C:\OSGeo4W/ which makes me think your python interpreter may be referencing the wrong modules folder or something like that.

when you type import lxml in the python console in QGIS do you see an error?

You can try the following (again, inside the QGIS python console) to see which paths are being used by python

import sys
print(sys.path)

@joewheaton
Copy link

Is this a fresh install? Have you customized the python paths or modules in any way? I see a reference to C:\OSGeo4W/ which makes me think your python interpreter may be referencing the wrong modules folder or something like that.

@MattReimer I was working with @bbelletti (you will meet her in November) and had her post this. The Q3.4.14 is an older install, but the Q 3.28.0 was a brand new install. This is a windows machine, but it is configured for French.

@bbelletti are you able to

when you type import lxml in the python console in QGIS do you see an error?

You can try the following (again, inside the QGIS python console) to see which paths are being used by python

@joewheaton
Copy link

@MattReimer, for what it is worth, when I type in my Q 3.26.3 Python prompt import lxml, I get:

Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS32~2.3\apps\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\PROGRA~1/QGIS32~2.3/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'lxlml'

But my system is also successfully running and has QRAVE installed?

My sys.path returns:

import sys
print(sys.path)
['C:/PROGRA~1/QGIS32~2.3/apps/qgis/./python', 'C:/Users/joemw/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python', 'C:/Users/joemw/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins', 'C:/PROGRA~1/QGIS32~2.3/apps/qgis/./python/plugins', 'C:\\Program Files\\QGIS 3.26.3\\bin\\python39.zip', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\DLLs', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\lib', 'C:\\Program Files\\QGIS 3.26.3\\bin', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\lib\\site-packages', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGIS32~2.3\\apps\\Python39\\lib\\site-packages\\Pythonwin', 'C:/Users/joemw/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python']

@MattReimer
Copy link
Member

MattReimer commented Oct 25, 2022

@joewheaton you have a typo. it's not lxlml. It's lxml

and if QRave is working for you I would not expect an error as we depend on this library heavily. I haven't seen any evidence that lxml has been removed from QGIS or anything drastic like that so I suspect that what we're dealing with here is a configuration issue on one machine.

@joewheaton
Copy link

Also, for completeness, we did troubleshoot trying to uninstall and download a zip of a previous release and that didn't work either.

@MattReimer
Copy link
Member

Yeah. I should probably refrain from making guesses without debugging thoroughly... but if I had to guess I'd say there's probably an environment variables set on the windows system or windows profile level that's setting PYTHONPATH to something it shouldn't be. This can cause QGIS to get confused about A) which modules to use and B) which version of python to use,.

@joewheaton
Copy link

So, for what its worth, on my system (which also has the lxml problem in its Python, when I go to System → About → Advanced System Settings → Advanced Tab → Environmental Variables, and reveal Path Settings, this is what I have:
image

I can try and help troubleshoot @bbelletti tomorrow if we need it. Thanks @MattReimer.

@MattReimer
Copy link
Member

MattReimer commented Oct 25, 2022

@joewheaton I don't think you have the same problem, you just mis-typed lxml

from the error you sent me: ModuleNotFoundError: No module named 'lxlml'

Note the extra l?

@joewheaton
Copy link

joewheaton commented Oct 27, 2022

Ha! Good catch @MattReimer. Moving to fast. The problem I have is typing.... accurately.

@MattReimer MattReimer changed the title QRAVE not installing with QGIS 3.28 - Can't find module lxml OSGEO:QRAVE not installing with QGIS 3.28 - Can't find module lxml Nov 2, 2022
@MattReimer
Copy link
Member

In the end this was not actually a problem. The OSGEO install makes you explicitly install python modules. Once we installed the correct ones (i.e. lxml, scipy and shapely) the plugin started working again.

@joewheaton
Copy link

joewheaton commented Nov 2, 2022

Thanks a ton @MattReimer for helping @bbelletti and I through this. We got both QRiS and QRAVE going. Just to clarify, QRAVE only needed the lxml, whereas QRiS needed scipy and shapely to work for 0.1.5.

FYI @philipbaileynar

@MattReimer
Copy link
Member

@joewheaton instead of having an individual checklist for each of our plugins (tedious) why not just have a "Recommended modules for Riverscapes tools" list that we maintain in one place?

Again, as far as we know this affects only OSGEO4W installs and only OSGEO4W installs that are non-default so it's a pretty thin slice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🌐 Viewer QGIS
Projects
None yet
Development

No branches or pull requests

3 participants