firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Error with firebase init functions during dependencies installition step

Open aqibnawazdev opened this issue 8 months ago • 3 comments

I am getting this error every time I initiate firebase functions with python

python --version: Python 3.13.3

OS: window 11

pip --version: pip 25.1.1 from C:\Python313\Lib\site-packages\pip (python 3.13)

Image

firebase-debug.log shows

[info] Functions can be deployed with firebase deploy.

[info] +  Wrote functions/requirements.txt 
[info] +  Wrote functions/.gitignore 
[info] +  Wrote functions/main.py 
[debug] [2025-05-12T11:12:15.017Z] Running command with virtualenv: command="C:\Users\lenovo\Downloads\python-cloud-functions\functions\venv\Scripts\activate.bat", args=["","&&","pip3","install","--upgrade","pip"]
[debug] [2025-05-12T11:12:22.496Z] Error: spawn "C:\Users\lenovo\Downloads\python-cloud-functions\functions\venv\Scripts\activate.bat" ENOENT
    at notFoundError (C:\Users\lenovo\AppData\Roaming\nvm\v22.14.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\lenovo\AppData\Roaming\nvm\v22.14.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:40:16)
    at cp.emit (C:\Users\lenovo\AppData\Roaming\nvm\v22.14.0\node_modules\firebase-tools\node_modules\cross-spawn\lib\enoent.js:27:25)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)
    at Process.callbackTrampoline (node:internal/async_hooks:130:17)
[error] 
[error] Error: An unexpected error has occurred.

aqibnawazdev avatar May 12 '25 10:05 aqibnawazdev

Hi @aqibnawazdev

I believe I've seen this issue before. I imagine this would be a firebase-tools problem, but I'll have a look.

I fixed this issue by installing dependencies after initialization.

CorieW avatar May 13 '25 12:05 CorieW

I can confirm, using the latest version of firebase-tools, I also receive this error on Windows. On Mac, I don't seem to have any issues.

I know there have been a lot of issues in the past with Windows, so perhaps this is just another one. Are you also using Windows?

For now, I will move this issue to firebase-tools, as I believe this is an issue there.

CorieW avatar May 14 '25 01:05 CorieW

I can confirm, using the latest version of firebase-tools, I also receive this error on Windows. On Mac, I don't seem to have any issues.

I know there have been a lot of issues in the past with Windows, so perhaps this is just another one. Are you also using Windows?

For now, I will move this issue to firebase-tools, as I believe this is an issue there.

Yes, I am using window 11

aqibnawazdev avatar May 16 '25 15:05 aqibnawazdev

I think its a problem with firebase-tools/lib/functions/python.js as venv activate.bat doesn't work in powershell anymore. Probably needs to be replaced with Activate.ps1. If you manually replace, the firebase init functions command does run, but it opens an editor with Activate.ps1 (so you'll need to check how the command is launched as well.)

dklenowski avatar Aug 30 '25 11:08 dklenowski

Any solution for this?

Just figured out the issue, check the pyvenv.cfg file in the venv folder. Ensure it points to your main system Python. If not remove the the wrong path or reorder the path in the Environment Variables. This seems to fix the issue for me (mine was pointing to Inkscape python.exe)

josh4500 avatar Oct 11 '25 23:10 josh4500