Open muddi900 opened 1 year ago
Having the same issue, would appreciate a workaround!
I ran into the same problem. I used python 3.9, but the firebase package requires python >3.10. Upgrading and updating the path variables solved the issue.
If it still doesn't work:
The problem comes from the "python.js" file, located under
AppData\Roaming\npm\node_modules\firebase-tools\lib\functions
Line 29 onwards:
const install = await (0, prompt_1.promptOnce)({
name: "install",
type: "confirm",
message: "Do you want to install dependencies now?",
default: true,
});
if (install) {
const upgradeProcess = (0, python_2.runWithVirtualEnv)(["pip3", "install", "--upgrade", "pip"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] });
await new Promise((resolve, reject) => {
upgradeProcess.on("exit", resolve);
upgradeProcess.on("error", reject);
});
const installProcess = (0, python_2.runWithVirtualEnv)([(0, python_1.getPythonBinary)(python_1.LATEST_VERSION), "-m", "pip", "install", "-r", "requirements.txt"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] });
await new Promise((resolve, reject) => {
installProcess.on("exit", resolve);
installProcess.on("error", reject);
});
}
}
It seems that after you hit "yes" to installing dependencies, the script tries to upgrade pip, and then install the packages specified under "requirements.txt". It is the upgrade pip command that fails.
If you simply hit "no", the setup completes. You can then go ahead and pip install requirements.txt on your own. (This is how I found out my python version was too old - it gave me a more helpful error message when I did it manually. After upgrading python I tried to go through the setup again and this time it completed.)
My environment is 3.10 on Windows.
Thank you
On Wed, Jun 14, 2023 at 2:42 PM Jackilion @.***> wrote:
I ran into the same problem. I used python 3.9, but the firebase package requires python >3.10. Upgrading and updating the path variables solved the issue.
If it still doesn't work: The problem comes from the "python.js" file, located under AppData\Roaming\npm\node_modules\firebase-tools\lib\functions
Line 29 onwards:
const install = await (0, prompt_1.promptOnce)({ name: "install", type: "confirm", message: "Do you want to install dependencies now?", default: true, }); if (install) { const upgradeProcess = (0, python_2.runWithVirtualEnv)(["pip3", "install", "--upgrade", "pip"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] }); await new Promise((resolve, reject) => { upgradeProcess.on("exit", resolve); upgradeProcess.on("error", reject); }); const installProcess = (0, python_2.runWithVirtualEnv)([(0, python_1.getPythonBinary)(python_1.LATEST_VERSION), "-m", "pip", "install", "-r", "requirements.txt"], config.path(setup.functions.source), {}, { stdio: ["inherit", "inherit", "inherit"] }); await new Promise((resolve, reject) => { installProcess.on("exit", resolve); installProcess.on("error", reject); }); }
}
It seems that after you hit "yes" to installing dependencies, the script tries to upgrade pip, and then install the packages specified under "requirements.txt". It is the upgrade pip command that fails.
If you simply hit "no", the setup completes. You can then go ahead and pip install requirements.txt on your own. (This is how I found out my python version was too old - it gave me a more helpful error message when I did it manually. After upgrading python I tried to go through the setup again and this time it completed.)
— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/6625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI2VVZW7TFPADEQ7KDF3JUTXLIHZFANCNFSM6AAAAAAZFLHTII . You are receiving this because you authored the thread.Message ID: @.***>
Same issue. I have tried numerous times, here are some logs from the firebase-debug.log
file.
[info] i Skipping write of functions/requirements.txt
[info] i Skipping write of functions/.gitignore
[info] i Skipping write of functions/main.py
[debug] [2023-06-15T02:14:56.546Z] Running command with virtualenv: command="C:\Users\stacho\Documents\custominstallations\action_items_ai\functions\venv\Scripts\activate.bat", args=["","&&","pip3","install","--upgrade","pip"]
[debug] [2023-06-15T02:14:57.427Z] Error: spawn "C:\Users\stacho\Documents\custominstallations\action_items_ai\functions\venv\Scripts\activate.bat" ENOENT
at notFoundError (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16)
at cp.emit (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
[error]
[error] Error: An unexpected error has occurred.
^^ the above fails just to activate the environment
Then when I actually activate the environment by just doing source venv/Scripts/activate
I get the below
[info] i Skipping write of functions/requirements.txt
[info] i Skipping write of functions/.gitignore
[info] i Skipping write of functions/main.py
[debug] [2023-06-15T02:19:23.096Z] Error: spawn python.exe ENOENT
at notFoundError (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16)
at cp.emit (C:\Users\stacho\AppData\Roaming\nvm\v18.13.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
[error]
[error] Error: An unexpected error has occurred.
Here is some other info, hopefully it helps
[debug] [2023-06-15T02:19:12.209Z] ----------------------------------------------------------------------
[debug] [2023-06-15T02:19:12.210Z] Command: C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\firebase-tools\lib\bin\firebase.js init
[debug] [2023-06-15T02:19:12.211Z] CLI Version: 12.3.1
[debug] [2023-06-15T02:19:12.211Z] Platform: win32
[debug] [2023-06-15T02:19:12.211Z] Node Version: v18.13.0
[debug] [2023-06-15T02:19:12.212Z] Time: Wed Jun 14 2023 21:19:12 GMT-0500 (Central Daylight Time)
[debug] [2023-06-15T02:19:12.212Z] ----------------------------------------------------------------------
[debug]
[debug] [2023-06-15T02:19:12.269Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
A fresh install of python fixed it for me.
activiate.bat should now be in /functions/venv/Scripts
Same spawn "C:\src\maiker\functions\venv\Scripts\activate.bat" ENOENT
issue. Fix was to reinit the Firebase project. I suspect this worked because Firebase then created the venv
directory as it wanted.
Odd part was that I had a working environment as of a week or two ago and had previously deployed the functions.
I got the same error , any solution for that?
Yep. Switched to google cloud run. Basically the same thing but I can control the binaries available and environment variables
On Thu, Aug 17, 2023 at 9:29 AM sieutruc @.***> wrote:
I got the same error , any solution for that?
— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/6625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF756PDC3E7Q6O6PCRVCR6DXVYTDVANCNFSM6AAAAAAZFLHTII . You are receiving this because you commented.Message ID: @.***>
I have the same error, is there still no solution?
@Anquuni a workaround is to reinstall the Python that fixed for me.
Instal python >3.10 , and restart system
I ran into a similar. The problem occurs in this firebase init functions
step if I choose to install dependencies:
Do you want to install dependencies now? Yes
The system cannot find the path specified.
Error: An unexpected error has occurred.
Inspecting firebase-debug.log
shows this:
[debug] [2023-12-07T17:48:47.757Z] Running command with virtualenv: command="C:\Users\{path redacted}\venv\Scripts\activate.bat", args=["","&&","pip3","install","--upgrade","pip"]
[debug] [2023-12-07T17:48:48.472Z] Error: spawn "C:\Users\{path redacted}\venv\Scripts\activate.bat" ENOENT
at notFoundError (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
[error]
[error] Error: An unexpected error has occurred.
This error occurs whether I create the venv
virtual environment in advance or not. I got around this by selecting No
when firebase init
asks me whether I want to install dependencies:
Do you want to install dependencies now? No
I then install dependencies manually inside the virtual environment with:
pip install -r requirements.txt
I was facing some problems, I created a video. Maybe it can help some of you https://www.youtube.com/watch?v=q_sayYt50oM
I manually installed the packages using Python on my machine, instead of the binaries that Firebase downloads:
python -m pip install -r requirements.txt -t ./venv/Lib/site-packages/
This command must be run within the directory where the requirements.txt
Hello. Sorry for all the issues. It looks like the Firebase CLI isn't a reporting a clear error message when some of the necessary tools, like python.exe, pip3, venv/scripts/activate.bat, can't be access by the CLI. That would explain some of the reports where a fresh install of python helps resolve the issue.
We are going to foucs on making the error messages more clear so that your system has all the necessary program it needs to run the emulator. Thanks for your patience as we try to improve the error messaging.
I was facing some problems, I created a video. Maybe it can help some of you https://www.youtube.com/watch?v=q_sayYt50oM
thanks for this, this fixed it for me.
I ran into a similar. The problem occurs in this
firebase init functions
step if I choose to install dependencies:Do you want to install dependencies now? Yes The system cannot find the path specified. Error: An unexpected error has occurred.
Inspecting
firebase-debug.log
shows this:[debug] [2023-12-07T17:48:47.757Z] Running command with virtualenv: command="C:\Users\{path redacted}\venv\Scripts\activate.bat", args=["","&&","pip3","install","--upgrade","pip"] [debug] [2023-12-07T17:48:48.472Z] Error: spawn "C:\Users\{path redacted}\venv\Scripts\activate.bat" ENOENT at notFoundError (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16) at ChildProcess.cp.emit (C:\Users\{path redacted}\AppData\Roaming\nvm\v16.13.2\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) [error] [error] Error: An unexpected error has occurred.
This error occurs whether I create the
venv
virtual environment in advance or not. I got around this by selectingNo
whenfirebase init
asks me whether I want to install dependencies:Do you want to install dependencies now? No
I then install dependencies manually inside the virtual environment with:
pip install -r requirements.txt
Appreciate, this works.
[REQUIRED] Environment info
firebase-tools: 12.3.0
Platform: Windows 11
[REQUIRED] Test case
Run
firebase init
on Windows.[REQUIRED] Steps to reproduce
firebase init
Functions
Python
Yes
on install dependencies[REQUIRED] Expected behavior
It should install.
[REQUIRED] Actual behavior
Powershell is running as admin