getnamo / TensorFlow-Unreal

TensorFlow plugin for the Unreal Engine.
Other
1.15k stars 211 forks source link

AttributeError: 'TensorFlowComponent' object has no attribute 'tfapi' #59

Open AgentArachnid66 opened 3 years ago

AgentArachnid66 commented 3 years ago

So I've built the project using a c++ project and have been using this plugin alongside the LeapMotion Plugin for UE4, both of which for UE4.23. I'm sending the frame data gathered from the leap motion to the python script, which works, but refuses to load it into the script. I gathered this from the callback which is below:

LogPython: JSON test script input passed: {"test":"testValue"}
LogPython: Error: Exception in thread Thread-3489:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\paulb\OneDrive\Documents\GitHub\FinalYearProject\Plugins\UnrealEnginePython\Content\Scripts\upythread.py", line 19, in backgroundAction
    result = action(actionArgs)
  File "C:\Users\paulb\OneDrive\Documents\GitHub\FinalYearProject\Plugins\tensorflow-ue4\Content\Scripts\TensorFlowComponent.py", line 114, in json_input_blocking
    resultJson = self.tfapi.onJsonInput(json.loads(args))
AttributeError: 'TensorFlowComponent' object has no attribute 'tfapi'

Not sure where I'm going wrong and would appreciate any help. Please let me know if there is anything else you need

getnamo commented 3 years ago

Which version of the plugin are you using? and did you download it from https://github.com/getnamo/tensorflow-ue4/releases using a .7z archive (not the source/zip)?

AgentArachnid66 commented 3 years ago

I'm using the release for 4.23 that I downloaded from that link. Also, thank you for the quick reply

getnamo commented 3 years ago

Do the examples https://github.com/getnamo/tensorflow-ue4-examples/releases/tag/0.7.0 (TensorFlowExamples-ue4.23-v0.7.0-noplugins.7z ) with https://github.com/getnamo/tensorflow-ue4/releases/tag/0.14.0 dragged in it (tensorflow-ue4.23-v0.14.0-cpu.7z ) work for you?

AgentArachnid66 commented 3 years ago

No, I just tried it by following the link you posted and then built it. The console just says:

LogPython: Error: No module named 'TensorFlowComponent'

Sorry for the late reply, I've been unexpectedly busy recently

getnamo commented 3 years ago

You shouldn't need to build it if you follow the above instructions, the .7z has the embedded python included, I suspect it's using your machine python instead of the locally embedded python that has links setup for the TensorFlowComponent or you're trying to use the master branch with 4.23, which is for 4.25 and with a very different setup expectation (locally networked). NB branch compatible with 4.23 is https://github.com/getnamo/tensorflow-ue4/tree/0.14.0

AgentArachnid66 commented 3 years ago

So I just spent the past few hours trying to get it to work. I can't seem to get it to work with the examples. I put in the right module and class names into the tensorflow component and it gives me:

LogPython: Error: No module named 'tensorflow' LogPython: Error: Traceback (most recent call last): LogPython: Error: File "TensorFlowExamples-ue4.23-v0.7.0-noplugins\tensorflow-ue4-examples\Content\Scripts\mnistSimple.py", line 5, in <module> from tensorflow.examples.tutorials.mnist import input_data LogPython: Error: ModuleNotFoundError: No module named 'tensorflow'

getnamo commented 3 years ago

That indicates the tensorflow module isn't installed, try manually installing the pop package in your site packages (inside unreal engine python plugin > binaries)

Normally that gets automatically installed on startup though (see quick setup section of readme)