Open glenwrhodes opened 7 years ago
Hi, you need to get an 'embeddable 64bit zip version' (like this one https://www.python.org/ftp/python/3.6.1/python-3.6.1-embed-amd64.zip) of the same version of the one used to build the plugin (so if you have python 3.6.1 in the system, you need the embedded 64bit for 3.6.1). Once the project is built, just add the content of the python zip file at the same level of the .dll of the plugin in the resulting directory
Thanks for your fast reply.
Ok, I've done that. I've placed all the binaries from that zip, in the plugin directory: Plugins/UnrealEnginePython/Binaries/Win64
And it ran - BUT, just to make sure it wasn't using the system PATH, I temporarily renamed the directory of my system-wide python installation, and I got the error:
"The program can't start because python36.dll is missing from your computer. Try reinstalling the program to fix this problem."
So it's still trying to use the installation in my PATH. Do I have to uninstall my system python? How does it automagically know to use the embedded binaries? Do I have to build the game in a different way?
Double check you downloaded the 64bit version, i did this error dozens of time :) By the way can you paste the final directory structure of your project build ? Take in account that windows system searches for .dll files from the current working directory, this is why if you place a python36.dll along the .exe/.dll it should override the system one
I see what you mean. I'll try building with the 64 bit version installed on my system.
Ok, I rebuilt the game binary making sure that the installed python version I have on my computer was indeed the 64 bit version. It built fine in both Visual Studio and UE4 packager:
2> Performing full C++ include scan (building a new target) 2> Using Python at: C:/Users/grhod/AppData/Local/Programs/Python/Python36 2> Creating makefile for StanleyTestEditor (no existing makefile) 2> Performing full C++ include scan (no include cache file) 2> Using Python at: C:/Users/grhod/AppData/Local/Programs/Python/Python36
When I run the game, it works as well, but when I renamed the system install directory, I got the same "Program can't be started" error.
My final project directory structure looks like:
---Engine (and all the engine stuff - Not copying it here) ---StanleyTest (my game) +---Binaries | ---Win64 +---Content | +---Paks | ---Scripts <-- Where my PY scripts are | +---typings | ---pycache (Markup is making this bolded...) +---Plugins | ---UnrealEnginePython | ---Binaries | ---Win64 <- Where I've placed the embeddable files you linked above. ---Saved +---Config | ---WindowsNoEditor ---Logs
Try moving the python embedded files (like python36.dll) where the project .exe is
Ok, I did that. I copied all the binaries into same folder as the project EXE.
And it kind of worked - the error message came up, but after I clicked "OK", the game ran and launched correctly.
So it works - but, the error message is a bit misleading. Do you know what's generating that error message?
Is the error message the same ? "The program can't start because python36.dll is missing from your computer. Try reinstalling the program to fix this problem." ?
That's the popup.
But after I press OK, the popup closes, and the game starts properly. And the in-game python is functioning correctly.
There are a bunch of exe in the final build dir. I suspect one of them is trying to start but it fails as the dll is not available in its search path.
Okay, I also copied all the files into the Binaries/Win64 directory, and it worked, without any warning messages or errors.
I then removed them from my project root, and it also worked.
So, the steps to get it working seems to basically be -> Copy the redistributable binaries into your main game's EXE file folder - not where the small EXE is in "WindowsNoEditor", but the actual game EXE. So game FooGame would be where FooGame/Binaries/Win64/FooGame.exe is
I also completely removed the Python files from the FooBar/Plugins/UnrealEnginePython/Binaries/Win64 and it all still works properly.
Fantastic. :) Thank you for your help today.
Watching this issue for hints :) In this fork: https://github.com/getnamo/unrealenginepython I'm working my way through various parts of making the plugin fully embedded with inbuilt pip support, convenience multithreading as well as allowing other plugins to depend on UnrealEnginePython. This should enable making e.g. a tensorflow plugin with it's own self-contained script files and assets. Haven't tackled packaging yet, so your instructions are great and when the fork features mature maybe some of them can make it upstream.
@glenwrhodes Ran into the same issue, your solution worked great, thanks!
Hi there,
I'm trying to understand how to embed python with my game, the UnrealEnginePython game is built from source.
I really want to be able to make the game not require python installed on the user's computer. I'm not 100% sure how to follow this instruction on the readme page:
"Remember that unless you add an embedded python in your final build, the final users of your project will require python installed in his/her system."
More information:
I tried simply using the embedded python download from here: https://github.com/20tab/UnrealEnginePython/releases/download/20170424/UnrealEnginePython_20170424_4_14_python36_embedded_win64.zip and it failed to package the game with the error: UnrealBuildTool: ERROR: Couldn't find module rules file for module 'UnrealEnginePython'.
I'm trying to understand how to make UE4 actually make use of the binaries in a local/relative path that I can include with my game. Any clearer instructions, or a small walkthrough would be fantastically appreciated.
Thanks!