TensorFlow-Unreal icon indicating copy to clipboard operation
TensorFlow-Unreal copied to clipboard

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

Open AgentArachnid66 opened this issue 5 years ago • 7 comments

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

AgentArachnid66 avatar Oct 25 '20 21:10 AgentArachnid66

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

getnamo avatar Oct 26 '20 18:10 getnamo

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

AgentArachnid66 avatar Oct 26 '20 19:10 AgentArachnid66

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?

getnamo avatar Oct 27 '20 16:10 getnamo

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

AgentArachnid66 avatar Nov 04 '20 19:11 AgentArachnid66

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

getnamo avatar Nov 04 '20 19:11 getnamo

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'

AgentArachnid66 avatar Nov 29 '20 13:11 AgentArachnid66

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)

getnamo avatar Nov 29 '20 16:11 getnamo