I can see you having a problem with openpyxl not being present while reading an Excel file from a Google Cloud Storage bucket after moving from Cloud Functions to Cloud Run. This appears to be related to the base images used in the deployment environment and its recent modifications.
You may fix this by taking these steps:
Check your requirements.txt file - Make sure that openpyxl exists by adding the line on the nginx: openpyxl
Save changes and deploy - Once openpyxl is added and requirements.txt is updated, redeploy the Cloud Run function to make sure all packages are installed.
The dependencies are not always bundled as in previous Cloud Functions superlite runner, they have to be defined within the new requirements.txt parameters so that those dependencies can be added in the build.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
Hey Greb, I have added openpyxl on my requirements.txt but I am still getting the error:
requirements.txt:
openpyxl==3.1.2
main.py:
pd.read_excel(fh, engine=‘openpyxl’)
The error:
raise ImportError( ImportError: No module named expat; use SimpleXMLTreeBuilder instead
ImportError: Missing optional dependency ‘openpyxl’. Use pip or conda to install openpyxl.