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

Couldn't load plugin 'gis4wrf' due to an error when calling its classFactory() method #105

Closed
xigrug opened this issue Dec 4, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@xigrug
Copy link

xigrug commented Dec 4, 2018

Couldn't load plugin 'gis4wrf' due to an error when calling its classFactory() method

> RuntimeError: GIS4WRF: Error installing Python packages Log: Added C:\Users\liuch\AppData\Local\gis4wrf\python37 as module search pathAdded C:\Users\liuch\AppData\Local\gis4wrf\python37\lib\site-packages as module search pathPackage directory: C:\Users\liuch\AppData\Local\gis4wrf\python37C:\OSGeo4W64\bin\python-qgis.bat -m pip install --prefix C:\Users\liuch\AppData\Local\gis4wrf\python37 f90nml==1.0.2 netCDF4==1.4.2 https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whlCollecting f90nml==1.0.2   Using cached https://files.pythonhosted.org/packages/e6/d8/2654f2dbb02562e3b7d98e0948c41cb84dfc866bf0fa9e679744e293292c/f90nml-1.0.2.tar.gz Collecting netCDF4==1.4.2   Using cached https://files.pythonhosted.org/packages/ba/fb/2a8fb99cf26554aecd513764533a4fff376d49b0e7a1c7a99826aa543d25/netCDF4-1.4.2-cp37-cp37m-win_amd64.whl Collecting wrf-python==1.1.2 from https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl   Downloading https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl (666kB) Collecting cftime (from netCDF4==1.4.2)   Using cached https://files.pythonhosted.org/packages/80/23/cd5513106c709f1faa3623bb34a5284b55ea7dad4229103b68c154d8e39f/cftime-1.0.3.tar.gz     Complete output from command python setup.py egg_info:     Traceback (most recent call last):       File "", line 1, in       File "C:\Users\liuch\AppData\Local\Temp\pip-install-6t1z5o72\cftime\setup.py", line 6, in         from Cython.Build import cythonize     ModuleNotFoundError: No module named 'Cython'         ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\liuch\AppData\Local\Temp\pip-install-6t1z5o72\cftime\ 
> Traceback (most recent call last):
>   File "C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\__init__.py", line 39, in bootstrap_with_ui
>     for msg_type, msg_val in bootstrap():
>   File "C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\bootstrap.py", line 215, in bootstrap
>     for line in run_subprocess(args, LOG_PATH):
>   File "C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\bootstrap.py", line 244, in run_subprocess
>     raise subprocess.CalledProcessError(process.returncode, args)
> subprocess.CalledProcessError: Command '['C:\\OSGeo4W64\\bin\\python-qgis.bat', '-m', 'pip', 'install', '--prefix', 'C:\\Users\\liuch\\AppData\\Local\\gis4wrf\\python37', 'f90nml==1.0.2', 'netCDF4==1.4.2', 'https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl']' returned non-zero exit status 1.
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 335, in startPlugin
>     plugins[packageName] = package.classFactory(iface)
>   File "C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\__init__.py", line 22, in classFactory
>     bootstrap_with_ui(iface)
>   File "C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gis4wrf\__init__.py", line 62, in bootstrap_with_ui
>     raise RuntimeError(PLUGIN_NAME + ': Error installing Python packages\nLog:\n' + log) from e
> RuntimeError: GIS4WRF: Error installing Python packages
> Log:
> Added C:\Users\liuch\AppData\Local\gis4wrf\python37 as module search pathAdded C:\Users\liuch\AppData\Local\gis4wrf\python37\lib\site-packages as module search pathPackage directory: C:\Users\liuch\AppData\Local\gis4wrf\python37C:\OSGeo4W64\bin\python-qgis.bat -m pip install --prefix C:\Users\liuch\AppData\Local\gis4wrf\python37 f90nml==1.0.2 netCDF4==1.4.2 https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whlCollecting f90nml==1.0.2
>   Using cached https://files.pythonhosted.org/packages/e6/d8/2654f2dbb02562e3b7d98e0948c41cb84dfc866bf0fa9e679744e293292c/f90nml-1.0.2.tar.gz
> Collecting netCDF4==1.4.2
>   Using cached https://files.pythonhosted.org/packages/ba/fb/2a8fb99cf26554aecd513764533a4fff376d49b0e7a1c7a99826aa543d25/netCDF4-1.4.2-cp37-cp37m-win_amd64.whl
> Collecting wrf-python==1.1.2 from https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl
>   Downloading https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl (666kB)
> Collecting cftime (from netCDF4==1.4.2)
>   Using cached https://files.pythonhosted.org/packages/80/23/cd5513106c709f1faa3623bb34a5284b55ea7dad4229103b68c154d8e39f/cftime-1.0.3.tar.gz
>     Complete output from command python setup.py egg_info:
>     Traceback (most recent call last):
>       File "", line 1, in 
>       File "C:\Users\liuch\AppData\Local\Temp\pip-install-6t1z5o72\cftime\setup.py", line 6, in 
>         from Cython.Build import cythonize
>     ModuleNotFoundError: No module named 'Cython'
>     
>     ----------------------------------------
> Command "python setup.py egg_info" failed with error code 1 in C:\Users\liuch\AppData\Local\Temp\pip-install-6t1z5o72\cftime\
> 
> 
> 
> Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
> QGIS version: 3.4.2-Madeira Madeira, 22034aa070 
> 
> Python Path:
> C:/OSGEO4~1/apps/qgis/./python
> C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python
> C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
> C:/OSGEO4~1/apps/qgis/./python/plugins
> C:\OSGeo4W64\bin\python37.zip
> C:\OSGEO4~1\apps\Python37\DLLs
> C:\OSGEO4~1\apps\Python37\lib
> C:\OSGeo4W64\bin
> C:\OSGEO4~1\apps\Python37
> C:\OSGEO4~1\apps\Python37\lib\site-packages
> C:\OSGEO4~1\apps\Python37\lib\site-packages\win32
> C:\OSGEO4~1\apps\Python37\lib\site-packages\win32\lib
> C:\OSGEO4~1\apps\Python37\lib\site-packages\Pythonwin
> C:/Users/liuch/AppData/Roaming/QGIS/QGIS3\profiles\default/python
> C:\Users\liuch\AppData\Local\gis4wrf\python37
> C:\Users\liuch\AppData\Local\gis4wrf\python37\lib\site-packages
> 

**Operating System Information (please complete the following information):**
 - OS:  WINDOW10
@letmaik
Copy link
Contributor

letmaik commented Dec 4, 2018

Thanks for reporting this. The issue here is:

  • gis4wrf tried to install the Python netCDF4 package, which is one of the packages it needs for it to function correctly
  • netCDF4 has a dependency to cftime which failed to install
  • cftime failed to install on Windows because a new version of it was released (1.0.3, on 1st of December) which however is missing the binary wheels, compared to the previous 1.0.2.1
  • Because the binary wheels are missing, pip tries to build cftime from scratch, and fails, since that would require a compiler and other dependencies

gis4wrf started the package update process likely after QGIS was updated from 3.2 to 3.4 (in detail, QGIS switched to Python 3.7 from 3.6 which means we need to reinstall package dependencies).

Ideally, cftime would not make such faulty releases, but ok, it may happen for various reasons. To prevent such issues we are installing specific known good versions of Python packages, but we don't force the same for the dependencies of these packages.

The solution is to pin the version numbers for all the transitive dependencies as well, if they are binary packages (since pure Python packages will not have such issues).

As a quick work-around to get you going before we implement a patch, please close QGIS and run the following from a command prompt window:

C:\OSGeo4W64\bin\python-qgis.bat -m pip install --prefix C:\Users\liuch\AppData\Local\gis4wrf\python37 f90nml==1.0.2 netCDF4==1.4.2 cftime==1.0.2.1 https://ci.appveyor.com/api/buildjobs/o3ow5itmyi8nhhk2/artifacts/wrf_python-1.1.2-cp37-cp37m-win_amd64.whl

Then re-open QGIS. gis4wrf should now be happy and not try to install any packages.

@letmaik letmaik added the bug Something isn't working label Dec 4, 2018
@letmaik
Copy link
Contributor

letmaik commented Dec 4, 2018

Note that cftime has now released Windows binary wheels, which resolves this issue and doesn't require the temporary work-around anymore that I mentioned. This means other Windows users won't be affected by this immediate issue for now, but we should still change gis4wrf to pin versions in order to eliminate future problems like that.

@xigrug
Copy link
Author

xigrug commented Dec 5, 2018

Thank you, the issue can be solved by this. This is a very powerful work, may be some output visualization can give a 3D view.

@dmey
Copy link
Contributor

dmey commented Dec 12, 2018

@letmaik do you want to keep this open?
@xigrug Thank you but there are no plans for enabling any kind of 3D visualisations in GIS4WRF. If you are looking to create 3D visualisations for WRF outputs, I would recommend using VAPOR.

@letmaik
Copy link
Contributor

letmaik commented Dec 12, 2018

@dmey No, let's create a separate issue that deals with improving dependency installation.

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

No branches or pull requests

3 participants