Opened 4 years ago
Closed 4 years ago
#649 closed defect (fixed)
Installing Fiona, Geopandas or rasterio using OSGeo4W breaks QGIS python
Reported by: | Christina Ratcliff | Owned by: | |
---|---|---|---|
Priority: | critical | Component: | Package |
Version: | Keywords: | fiona geopanda rasterio | |
Cc: |
Description
I am installing fiona, geopandas and rasterio for python 3 using OSGeo4w on Windows 10 for use with QGIS 3.14.1 and above.
After installing each of these independently, the python console in QGIS breaks and I am getting the following message
Failed to open Python console: Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\osgeo\osr.py", line 14, in swig_import_helper return importlib.import_module(mname) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 670, in _load_unlocked File "", line 583, in module_from_spec File "", line 1043, in create_module File "", line 219, in _call_with_frames_removed ImportError: DLL load failed: The specified procedure could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python/plugins\processing\__init__.py", line 35, in from processing.tools.raster import * # NOQA File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python/plugins\processing\tools\raster.py", line 26, in from osgeo import gdal File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\osgeo\gdal.py", line 1756, in import osgeo.ogr File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\osgeo\ogr.py", line 260, in import osgeo.osr File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\qgis\utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\osgeo\osr.py", line 17, in _osr = swig_import_helper() File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\osgeo\osr.py", line 16, in swig_import_helper return importlib.import_module('_osr') File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_osr' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 2, in File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console.py", line 47, in show_console _console = PythonConsole(parent) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console.py", line 83, in __init__ self.console = PythonConsoleWidget(self) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console.py", line 113, in __init__ self.shell = ShellScintilla(self) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console_sci.py", line 104, in __init__ self.runsource(line) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console_sci.py", line 679, in runsource return super(ShellScintilla, self).runsource(source, filename, symbol) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\code.py", line 74, in runsource self.runcode(code) File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\code.py", line 94, in runcode self.showtraceback() File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\code.py", line 148, in showtraceback sys.excepthook(ei[0], ei[1], last_tb) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console_sci.py", line 675, in excepthook self.write("".join(traceback.format_exception(etype, value, tb))) File "C:/PROGRA~1/QGIS3~1.14/apps/qgis/./python\console\console_sci.py", line 660, in write sys.stderr.write(txt) AttributeError: 'NoneType' object has no attribute 'write'
How do I fix this to be able to use QGIS and these packages.
Change History (6)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
python3-fiona / python3-rasterio updated to include empty .libs
comment:4 by , 4 years ago
Thanks for looking into this.
The quick workaround of creating the .libs folder works for QGIS 3.16
Is there an equivalent method for earlier version ie QGIS 3.14? Adding the .libs folder doesn't work. I tried using using 3.14.1 and 3.14.16.
comment:5 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:6 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Quick workaround: create an empty directory .libs in
%OSGEO4W_ROOT%\apps\Python37\lib\site-packages\fiona
and%OSGEO4W_ROOT%\apps\Python37\lib\site-packages\rasterio
or change%OSGEO4W_ROOT%/apps/qgis/python/qgis/utils.py
by addingand os.path.isdir(p)
: