ecmwf / cfgrib

A Python interface to map GRIB files to the NetCDF Common Data Model following the CF Convention using ecCodes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cfgrib and pyinstaller

happymvd opened this issue · comments

What maintenance does this project need?

I am working on a Windows 11 computer with Python 3.11.9 installed as the only version of Python
I have created and activated a venv virtual environment for my project
I have installed ecmwflib and cfgrib into my virtual environment using pip install

My test script (Testing.py) only imports cfgrib and then it prints a message to the terminal
This works in python in the terminal window
I issue the following command "pyinstaller --onefile Testing.py" and it creates an exe file for me

When I try and run the exe I get the following error message
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Dell\AppData\Local\Temp\_MEI32242\gribapi\grib_api.h'
[1692] Failed to execute script 'Testing' due to unhandled exception!

Can anyone please suggest what I can do to solve this issue .... I am needing to distribute my project once it is complete

Organisation

self

RESOLVED -
The solution lies in how you call pyinstaller .... if cfgrib in imported into a script then you have to include "--collect-data gribapi" in the command line when you use pyinstaller

This sounds like useful information - thanks for sharing it!