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

(Embedded Python dll Error) Project crashes on startup after installing plugins #42

Open
GilesPenfold opened this issue Jan 8, 2019 · 7 comments

Comments

@GilesPenfold
Copy link

GilesPenfold commented Jan 8, 2019

I'm pretty new to UE4, so I'm not sure if I'm being dumb or if there actually is a bug.

I've installed the Plugins following the instructions, then copied the Content folder from the examples into a clean project. Running the project the first time works. I then restart and can access things like the TensorflowComponent in Blueprint. However, when I build my Visual Studio project and then restart UE4, it fails to load UnrealEnginePython and UE4 crashes at 71%.

I've noticed a few things, which may or may not be useful:
When loading up the project for the second time, I can access TensorFlow in the Editor however, none of the plugins appear under the Edit>Plugins tab.

If I build the solution from Visual Studio and try to launch through the debugger there, it crashes when running PyEval_InitThreads on line 466 of UnrealEnginePython.cpp. When building the VS project, it seems to run through all the UnrealEnginePython cpp files and builds them.
The error for this is: Unhandled exception at 0x00007FFD9ECF5A4E (ucrtbase.dll) in UE4Editor.exe: Fatal program exit requested.

Removing the UnrealEnginePython folder allows UE4 to load.

The call stack of UE4 starting up leads to ucrtbase.dll (image attached)
1pemnyt

@getnamo
Copy link
Owner

getnamo commented Jan 8, 2019

Sounds like you didn't install the plugins into your new project make sure to click on https://github.com/getnamo/tensorflow-ue4/releases/tag/0.11.0 and e.g. tensorflow-ue4.21-v0.11.0-cpu.7z and drag that into your new project as well. The .7z is key as it contains all the dependent binaries whereas if you just use source it won't include them.

@GilesPenfold
Copy link
Author

I think I've understood and done as you said. Started new clean project, dragged in plugins from the .7z into project folder, loaded project and let them install properly. Reload project and they're in the Edit>Plugins list now, yay! However, whenever I create a C++ class, then restart UE4, I run into the same issue. Hits 71% and crashes.

Just to check I'm doing everything right, here is my project folder structure:
ymb07nw

Plugins folder:
yqpn1y1

@getnamo
Copy link
Owner

getnamo commented Jan 8, 2019

Folders look good.

So I just tried this:
download and extract example project, place on desktop, download plugins (cpu) extract and drag into project.

Then create new C++ class, close unreal editor, compile project from visual studio (making sure it didn't build the hotreloaded dlls, might need to hit compile again until it shows target up to date).

Once compiled, I start with the debugger and project runs as expected.

Can't seem to replicate your issue. Make sure you close the editor when you recompile your project once done hitting f5 should work. Also make sure you recompile from visual studio using the .sln. Make sure you use the cpu version before you use the gpu version to ensure everything works normally. Gpu setup requires additional steps (https://www.tensorflow.org/install/gpu).

@GilesPenfold
Copy link
Author

So I followed the method you took:
Downloaded example project, extracted to desktop, downloaded cpu plugins and extracted to the project folder. Opened project, let plugins install, created C++ class, compiled project in VS until up to date. Closed editor, compiled again. Ran from debugger, with a crash. Tried opening project file, also crashed. Very very strange. Never quite run into something like this before.

This is the folder structure, which seems okay:
1

Generic C++ Class, which also seems fine:
2

Building In VS, a fair few warnings but not sure if they're fully relevant:
3

@getnamo
Copy link
Owner

getnamo commented Jan 8, 2019

Those warning are normal and do not impact build.

The crash itself points to https://github.com/getnamo/UnrealEnginePython/blob/3099703c54f8c582a255aa3ea56f2e1a73df5bc3/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp#L466, which according to https://www.linuxjournal.com/article/3641 says

Calling PyEval_InitThreads turns on the runtime thread support

Silly suggestion but maybe restart the computer? Seems like the python36dll has issues on you computer

@getnamo
Copy link
Owner

getnamo commented Jan 8, 2019

You can maybe try to change from using the embedded python to one auto-located on your computer via changing https://github.com/getnamo/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython.Build.cs#L13

@GilesPenfold
Copy link
Author

Following your advice, I seem to have fixed it! It was a Python 3.6 problem - for some reason it wasn't enjoying the embedded Python version with the plugin. I still have no clue why, but it seems to be working now as far as I can tell.

To fix, I changed the https://github.com/getnamo/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython.Build.cs#L13 as you said:
10

Then added my local Python install location to the windowsKnownPaths string array, if not already there:
11

I found changing the PythonHome to be the location anywhere else but the windowsKnownPaths to cause errors finding the pyconfig.h file (assuming it wasn't finding the Python path correctly).

Thanks for helping fix the issue, it's greatly appreciated!

@getnamo getnamo changed the title Project crashes on startup after installing plugins (Embedded Python dll Error) Project crashes on startup after installing plugins Jan 9, 2019
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

2 participants