godot-python icon indicating copy to clipboard operation
godot-python copied to clipboard

./pythonscript/bin/pip complains about python3 not being an executable

Open touilleMan opened this issue 5 years ago • 2 comments

tl;dr: use ./pythonscript/bin/python3 -m pip instead

see #153

$ cd examples/pong
$ ./pythonscript/bin/pip
Failed to execute process './pythonscript/bin/pip'. Reason:
The file './pythonscript/bin/pip' specified the interpreter '/build/out/python/install/bin/python3', which is not an executable command.

touilleMan avatar Mar 06 '20 19:03 touilleMan

Situation as of version 0.40.0 is all scripts commands (pip, easy_install, 2to3 etc.) are still broken

On linux&macOS those commands have an invalid shabang (e.g. #!/install/bin/python3.8 on linux) that refers to the prefix configuration provided during Python interpreter build. A simple solution would be to do a sed in the scripts to change this path, but shabang path must be absolute (and a Godot project using godot-python can be located anywhere !). It seems there is some hacky ways to achieve relative shabang so we may try this in the future.

On Windows the scripts come as .exe files so editing them is even harder :(

For the moment I've left those broken scripts as part of the release. The reason is there are simple to fix on linux&macOS for the final user (just edit the shabang), and they might be needed by 3rd party (especially python3.8-config this is often use to retrieve the compile/link flags needed to build native modules)

It would be greate to add a README in the folder though to explain this mess ;-)

touilleMan avatar Jun 05 '20 08:06 touilleMan

@touilleMan I'd like to update the shebang to be valid on mac to use pip, can you dumb it down for me a bit more on what the simple fix is?

  • what file to edit the shebang in?
  • what file to put the absolute path to in the shebang?

When I try executing the file (sudo ./pythonscript/osx-64/bin/python3 -m pip) it replies "command not found" I looked inside pythonscript/osx-64/bin/python3 but there's no shebang inside, just "python3.8" in the file.

PS: many thanks for this incredible project, really enabling some super cool stuff.

Edit: adding another possible workaround: Using pip from within a pythonscript once it's already running: https://stackoverflow.com/questions/12332975/installing-python-module-within-code Edit edit: nope, that workaround won't work - the executable is godot itself so can't call -m pip on that.

whogben avatar Dec 26 '20 01:12 whogben