Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mastef opened this issue Mar 25, 2021 · 13 comments
Open

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

mastef opened this issue Mar 25, 2021 · 13 comments

Comments

@mastef
Copy link

mastef commented Mar 25, 2021

[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)
@chkuang-g
Copy link
Contributor

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 chkuang-g added the needs-info Need information for the developer label Mar 25, 2021
@mastef
Copy link
Author

mastef commented Mar 26, 2021

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.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Mar 26, 2021
@DellaBitta
Copy link
Contributor

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 DellaBitta removed the needs-attention Need Googler's attention label Mar 30, 2021
@mastef
Copy link
Author

mastef commented Mar 30, 2021

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.

@DellaBitta
Copy link
Contributor

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 DellaBitta reopened this Mar 30, 2021
@DellaBitta DellaBitta changed the title [Bug] Unable to find command line tool python required [FR] Unable to find command line tool python - extend binary checks Mar 30, 2021
@josemgmz
Copy link

josemgmz commented Oct 4, 2021

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.

@mastef
Copy link
Author

mastef commented Jan 23, 2022

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

@sakshams21
Copy link

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).

@mastef
Copy link
Author

mastef commented Mar 22, 2022

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

@sakshams21
Copy link

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

@Tcyily
Copy link

Tcyily commented Jun 30, 2022

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

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

@sakshams21
Copy link

#1232 (comment)
i used their files and it worked for me

@mastef
Copy link
Author

mastef commented Jul 5, 2022

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants