You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK:
Missing virtual environment at venv directory. Did you forget to run 'python3.12 -m venv venv'?
... or, if I run cd ./functions && python3 -m venv venv...
Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK.
Did you forget to run '. "./functions/venv/bin/activate" && python3.12 -m pip install -r requirements.txt'?
I don't see that logged step documented anywhere.
Apparently you have to run the equivalent of:
...
[info] i functions: Watching "/Users/pv/Dev/GitHub/swooby/swoo.by/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/pv/Dev/GitHub/swooby/swoo.by/functions\" for Cloud Functions..."}}
[debug] [2025-03-18T21:38:02.543Z] Customer code is not Node
[debug] [2025-03-18T21:38:02.543Z] Validating python source
[debug] [2025-03-18T21:38:02.543Z] Building python source
[debug] [2025-03-18T21:38:02.543Z] Could not find functions.yaml. Must use http discovery
*****
[debug] [2025-03-18T21:38:02.545Z] Running command with virtualenv: command=., args=["\"/Users/pv/Dev/GitHub/swooby/swoo.by/functions/venv/bin/activate\"","&&","python3.12","-c","\"import firebase_functions; import os; print(os.path.dirname(firebase_functions.__file__))\""]
[debug] [2025-03-18T21:38:02.553Z] stderr: /bin/sh: python3.12: command not found
*****
[error] ⬢ functions: Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Did you forget to run '. "/Users/pv/Dev/GitHub/swooby/swoo.by/functions/venv/bin/activate" && python3.12 -m pip install -r requirements.txt'? {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Did you forget to run '. \"/Users/pv/Dev/GitHub/swooby/swoo.by/functions/venv/bin/activate\" && python3.12 -m pip install -r requirements.txt'?"}}
[debug] [2025-03-18T21:38:02.555Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
...
The root cause is that python3.12 is trying to be used.
Again, I have Python 3.13.
I tried setting firebase.json...
"functions": [
{
"runtime": "python313",
...
...but firebase emulators:start fails with:
% firebase emulators:start
(node:78311) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
i emulators: Starting emulators: functions, hosting, extensions
⚠ hosting: Port 6000 is restricted by some web browsers, including Chrome. You may want to choose a different port such as 6001.
i emulators: Shutting down emulators.
i hub: Stopping emulator hub
Error: Cannot load functions from ./functions because it has invalid runtime python313
export function getPythonBinary(
runtime: supported.Runtime & supported.RuntimeOf<"python">,
): string {
if (process.platform === "win32") {
// There is no easy way to get specific version of python executable in Windows.
return "python.exe";
}
if (runtime === "python310") {
return "python3.10";
} else if (runtime === "python311") {
return "python3.11";
} else if (runtime === "python312") {
return "python3.12";
}
assertExhaustive(runtime, `Unhandled python runtime ${runtime as string}`);
}
This code tells me that Python 3.13 (python313) released 2024-10-07 is not supported?!?!
Where is/are the required/supported python version numbers listed?
Why does specifying an existing valid "runtime": "python313" fail?
Why does defaulting to or specifying a not existing "runtime": "python312" not fail?
Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Did you forget to run '. "./functions/venv/bin/activate" && python3.12 -m pip install -r requirements.txt'?
WORKAROUND
Install Python 3.12, but that is a pretty sad/weak workaround.
The text was updated successfully, but these errors were encountered:
paulpv
changed the title
Effectively/Logically hard coded max python version; exceeding results in silent failure and false pseudo-success
Functions: Effectively/Logically hard coded max python version; exceeding results in silent failure and false pseudo-success
Mar 18, 2025
Hey @paulpv, sorry to hear you encountered this issue, and thanks for sharing your observations as well as for creating a detailed report. I'll check this with our engineering team to see what we can do to improve this behavior and to add support for python3.13 runtime.
Regarding step 4, I think this occurred since python313 isn't yet listed in runtime versions. Usually, these steps(creating venv and installing dependencies) are handled by the Firebase CLI during initialization.
Why does defaulting to or specifying a not existing "runtime": "python312" not fail?
firebase emulators:start starts running and I would expect it to fail.
Understood about the supported versions lagging a little.
That same link shows Node is supported only up to v22, even though v23 released 2024/10/16.
But that is a major version that is even more understandable to take a little while to support.
Python 3.12->3.13 should be a pretty minor change that is relatively much easier to confirm support.
I have Python 3.13 installed.
I am trying to follow the guide at https://firebase.google.com/docs/functions/get-started?gen=2nd and run firebase functions with:
The emulator says either...
... or, if I run
cd ./functions && python3 -m venv venv
...I don't see that logged step documented anywhere.
Apparently you have to run the equivalent of:
But that is all moot because it still fails!
Looking at
firebase-debug.log
: EMPHASIS MINEThe root cause is that
python3.12
is trying to be used.Again, I have Python 3.13.
I tried setting
firebase.json
......but
firebase emulators:start
fails with:Looking at https://github.com/firebase/firebase-tools/blob/master/src/deploy/functions/runtimes/python/index.ts
This code tells me that Python 3.13 (
python313
) released 2024-10-07 is not supported?!?!Where is/are the required/supported python version numbers listed?
Why does specifying an existing valid
"runtime": "python313"
fail?Why does defaulting to or specifying a not existing
"runtime": "python312"
not fail?This is all a pretty big cluster F.
Wasn't this supposed to be fixed by #6866 ?
[REQUIRED] Environment info
firebase-tools: 13.34.0
Platform: macOS (I do not think this is macOS specific)
[REQUIRED] Test case
?
[REQUIRED] Steps to reproduce
firebase emulators:start
[REQUIRED] Expected behavior
[REQUIRED] Actual behavior
WORKAROUND
Install Python 3.12, but that is a pretty sad/weak workaround.
The text was updated successfully, but these errors were encountered: