Error with netCDF4 when using Pyinstaller to create an exe from a .py

158 views Asked by At

I made a small program in Jupyter that uses the following libraries:

import pandas as pd
import datetime
 #import pvlib forecast models
from pvlib.forecast import RAP

I made it on jupyter and it runs fine, but I want to have a .exe that will run on a console that outputs a CSV, very simple. The issue is:

when I converted it to .py (it runs very well) I then use pyinstaller to create an .EXE that I can run on CMD and get the resulting CSV file but, I get the following errors:

File "solar_FX_py.py", line 15, in
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "c:\users...\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.dict)
File "pvlib\forecast.py", line 5, in
from netCDF4 import num2date
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in load_unlocked
File "c:\users...\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.dict)
File "netCDF4_init.py", line 3, in
File "include\membuf.pyx", line 16, in init netCDF4._netCDF4
AttributeError: type object 'netCDF4._netCDF4._MemBuf' has no attribute 'reduce_cython'

I have spent many days trying to figure out a fix for this but without success, I installed pvlib using the (optional) recommendation for forecast, and as I said, the .py file runs perfectly, but when I create the .exe it does not.

IS there a way to fix this? Or is there a better way to create a standalone application?

Thanks!!

0

There are 0 answers