quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[FR] Unable to find command line tool python - extend binary checks

Open mastef opened this issue 4 years ago • 13 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.2.11f1
  • Firebase Unity SDK version: 7.1.0
  • Source you installed the SDK: This happened with both (.unitypackage and Unity Package Manager)
  • Problematic Firebase Component: Auth, Database, Analytics
  • Other Firebase Components in use: Auth, Database, Analytics
  • Additional SDKs you are using: AdMob,GoogleMobileAds,Facebook, ...
  • Platform you are using the Unity editor on: Ubuntu for CI builds
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[REQUIRED] Please describe the issue here:

This seems related to #835

I tried with having python and python3 symlinked. Moved to the folders, the editor folders, etc. To no avail.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? What's the issue repro rate? (eg 100%, 1/5 etc)

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

We even have an extra build step, to add python to many folders, to no avail. I mean we just put python everywhere where the script may look, but we have no idea where it's actually looking.

          which python
          ls -lsah /usr/bin/python
          sudo rm -rf /usr/bin/python
          sudo ln -s $(which python) /usr/bin/python
          sudo ln -s $(which python) $PWD/Assets/Firebase/Editor/python
          sudo ln -s $(which python) $PWD/python
          which python
          python --version

Note: I was most likely doing that above step in the wrong environment.

Relevant Error Message:

Unable to find command line tool python required for Firebase Android resource generation.
python is required to generate the Firebase Android resource file google-services.xml from Assets/Resources/GoogleService-Info.plist. Without Firebase Android resources, your app will fail to initialize.
python was distributed with each Firebase Unity SDK plugin, was it deleted?
2021-03-25T07:31:11.4431920Z 
System.ComponentModel.Win32Exception (0x80004005): ApplicationName='python', CommandLine='"/github/workspace/Library/PackageCache/[email protected]/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/Resources/GoogleService-Info.plist" -l --plist', CurrentDirectory='/github/workspace', Native error= Cannot find the specified file
  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <fb35542c49c94f4d9bf912c73e79fe13>:0 
  at System.Diagnostics.Process.Start () [0x0003a] in <fb35542c49c94f4d9bf912c73e79fe13>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler, System.Boolean useShellExecution, System.Boolean stdoutRedirectionInShellMode) [0x002e8] in /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/CommandLine.cs:631 
  at GooglePlayServices.CommandLine.Run (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) [0x00000] in /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/CommandLine.cs:510 
  at Firebase.Editor.PythonExecutor.Run (System.Collections.Generic.IEnumerable`1[T] arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) [0x00000] in Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\PythonExecutor.cs:180 
  at Firebase.Editor.GenerateXmlFromGoogleServicesJson.RunResourceGenerator (System.Collections.Generic.IEnumerable`1[T] arguments, System.String inputPath, System.Boolean showCommandLine) [0x0001b] in Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:521 
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:RunResourceGenerator(IEnumerable`1, String, Boolean) (at Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:525)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadBundleIds(String) (at Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:407)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateConfigFileDirectory() (at Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:295)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Z:\tmp\tmp.RemzflXQPx\firebase\app\client\unity\editor\src\GenerateXmlFromGoogleServicesJson.cs:705)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
UnityEditor.AssetPostprocessingInternal:InvokeMethod(MethodInfo, Object[]) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:662)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[]) (at /home/builduser/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:146)
 
(Filename: Z Line: 0)

mastef avatar Mar 25 '21 08:03 mastef

Hmm, what happened if you run the following command:

python /github/workspace/Library/PackageCache/[email protected]/Firebase/Editor/generate_xml_from_google_services_json.py -i "/github/workspace/Assets/Resources/GoogleService-Info.plist" -l --plist

According to the code, it looks like as long as python is in your PATH(and source it), it should be fine.

I would recommend you to make sure python is in your PATH, and perhaps restart your machine so that your Unity instance can catch that change.

chkuang-g avatar Mar 25 '21 20:03 chkuang-g

I would recommend you to make sure python is in your PATH, and perhaps restart your machine so that your Unity instance can catch that change.

So this issue was due to me being confused about the proper environment. The builder environment was closed off itself, and only had python3 available ( not python ).

This is not an issue with the quickstart-unity I think, unless python should have been installed automatically if it's not found on the host system.

mastef avatar Mar 26 '21 13:03 mastef

Hi @mastef,

Yes, that's correct. A Python installation is required on your machine ahead of time. Also I can confirm that the Firebase build scripts specifically look for the python binary executable, and not python3 as you've described. Also of note, we do recommend that python points to a python 3 binary.

I'm going to close this issue for now, but please feel free to reopen it if you have more questions. Thanks!

DellaBitta avatar Mar 30 '21 14:03 DellaBitta

Yes, that's correct. A Python installation is required on your machine ahead of time. Also I can confirm that the Firebase build scripts specifically look for the python binary executable, and not python3 as you've described. Also of note, we do recommend that python points to a python 3 binary.

I would recommend ( for the people coming after me ) to also look for a python3 binary if python is not present. As it doesn't seem to be a default that a python3 install also takes the python namespace.

mastef avatar Mar 30 '21 15:03 mastef

Hi mstef,

Yes, we believe that we either use /usr/bin/env python or attempt to run python3 first, and fall back to python if it cannot be resolved. I'll add this as an internal issue for us to work on. Thanks.

DellaBitta avatar Mar 30 '21 18:03 DellaBitta

Hi,

I had the same problem i just create a symbolic link to "python".

sudo ln -s /usr/bin/python3 /usr/bin/python

After this i restarted unity and the error was fix.

josemgmz avatar Oct 04 '21 12:10 josemgmz

@DellaBitta on systems with python3 present ( but python not symlinked ), this error still appears.

mastef avatar Jan 23 '22 14:01 mastef

Hi,

I had the same problem i just create a symbolic link to "python".

sudo ln -s /usr/bin/python3 /usr/bin/python

After this i restarted unity and the error was fix.

I tried to run this command in my terminal but it says Operation not permitted(i have given my terminal full disk access).

sakshams21 avatar Mar 22 '22 10:03 sakshams21

I tried to run this command in my terminal but it says Operation not permitted(i have given my terminal full disk access).

What system are you running on? On a unix system you can run apt install python

mastef avatar Mar 22 '22 17:03 mastef

Sorry my bad i should have included the details. I am using mac

sakshams21 avatar Mar 26 '22 06:03 sakshams21

Sorry my bad i should have included the details. I am using mac

so how did you deal with the problem?need your help

Tcyily avatar Jun 30 '22 09:06 Tcyily

https://github.com/firebase/quickstart-unity/issues/1232#issuecomment-1068886444 i used their files and it worked for me

sakshams21 avatar Jul 05 '22 09:07 sakshams21

Sorry my bad i should have included the details. I am using mac

For mac simply install any python 2 version on your system. E.g. through homebrew like here https://docs.python-guide.org/starting/install/osx/

mastef avatar Jul 05 '22 12:07 mastef