Closed jaroslavknotek closed 1 year ago
Just ran into the same problem! I am trying to use Python's protobuf.
As the Azure Functions Core Tools
contains an older version from protobuf, my function fails because it tries to load it from there, not from the .venv with the proper requirements.txt
func host start
sys path:
['C:\\Program Files\\Microsoft\\Azure Functions Core Tools\\workers\\python\\3.10/WINDOWS/X64',
'C:\\Program Files\\Microsoft\\Azure Functions Core Tools\\workers\\python\\3.10\\WINDOWS\\X64',
'C:\\Users\\user\\miniconda3\\python310.zip',
'C:\\Users\\user\\miniconda3\\DLLs',
'C:\\Users\\user\\miniconda3\\lib',
'C:\\Users\\user\\miniconda3',
'c:\\dev\\function\\.venv',
'c:\\dev\\function\\.venv\\lib\\site-packages',
'C:\\dev\\function']
Exception: ImportError: cannot import name 'builder' from 'google.protobuf.internal' (C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10/WINDOWS/X64\google\protobuf\internal\__init__.py)
I found a workaround (and added to the issue's description). Set env var PYTHON_ISOLATE_WORKER_DEPENDENCIES=1
before running. It work's for the local runner. However, it doesn't solve the issue with protobuf.
thanks for informing will check and update you
use this protobuf~=3.19.3 in requirements.txt file as its working fine .We are investigating for latest version why its failing. Thanks
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
Create new function and add import:
Just as a sanity check, I run
Expected behavior
Provide a description of the expected behavior.
I expect to run
func start
and not see any error.Actual behavior
Provide a description of the actual behavior observed.
Running
func start
The
func starts
fails even though it's run from within the same virtual environment, with the same pytohon. For some reason, it looks for protobuf's builder inand not
I checked your guide and found protobuf wheels in
even running
works fine.
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.
Just default:
Related information
Provide any related information
Summary:
python
3.9.16 (python3).func
Core Tools Version: 4.0.5095 Commit hash: N/A (64-bit)func
Function Runtime Version: 4.16.5.20396tensorflow
= 2.12.0protobuf
=4.22.3/4.22.1 both failarchlinux 6.2.1-arch1-1
What can I do to resolve this problem? Searching for solution leads nowhere as I went throght
EDIT:
There is a workaround that works for me - isolate dependencies with
PYTHON_ISOLATE_WORKER_DEPENDENCIES=1