ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Unity UWP build error

Open keanudicap opened this issue 8 years ago • 20 comments

I trained a model with ML-agents and plan to run the trained model as internal brain in HoloLens. While building UWP, three errors are shown:

Assets\ML-Agents\Scripts\CoreBrainInternal.cs(12,7): error CS0246: The type or namespace name 'TensorFlow' could not be found (are you missing a using directive or an assembly reference?) Assets\ML-Agents\Scripts\CoreBrainInternal.cs(70,5): error CS0246: The type or namespace name 'TFGraph' could not be found (are you missing a using directive or an assembly reference?) Assets\ML-Agents\Scripts\CoreBrainInternal.cs(71,5): error CS0246: The type or namespace name 'TFSession' could not be found (are you missing a using directive or an assembly reference?)

I did follow the instruction to import TensorflowSharp package and define ENABLE_TENSORFLOW, and the project runs well in Unity editor.

keanudicap avatar Nov 02 '18 14:11 keanudicap

Also, an error was shown in the inspector when brain was switched to internal saying:

You cannot have ENABLE_TENSORFLOW without NET_4_6.

However, I have net 4.6 framework installed.

keanudicap avatar Nov 02 '18 14:11 keanudicap

This is the Setting->Player image

keanudicap avatar Nov 02 '18 15:11 keanudicap

Hi @keanudicap, we haven't tested this on hololens yet. Does this error happen on Windows also or it is only for hololens build?

xiaomaogy avatar Nov 02 '18 17:11 xiaomaogy

Hi @keanudicap, we haven't tested this on hololens yet. Does this error happen on Windows also or it is only for hololens build?

keanudicap avatar Nov 02 '18 23:11 keanudicap

It happened when switch the build platform to Universal Windows Platform (UWP). We didn't really include HoloLens toolkit (Mixed reality toolkit) in the project for testing.

keanudicap avatar Nov 02 '18 23:11 keanudicap

I guess the main problem would be failure in finding NET_4_6 which results in the disability of ENABLE_TENSORFLOW. However, as the image I showed above, I switched Api compatibility level to .NET 4.x.

keanudicap avatar Nov 02 '18 23:11 keanudicap

Not sure how this works on hololens.....

xiaomaogy avatar Nov 03 '18 00:11 xiaomaogy

It is easy to reproduce the error.

  1. Having any Unity project using ML-agents, for instance, we could use 3D ball example.
  2. Import Tensorflowshap.package, and do all the settings, e.g. create ENABLE_TENSORFLOW
  3. File->Build setting-> switch platform to UWP image
  4. When build, the error shall be shown.

keanudicap avatar Nov 03 '18 00:11 keanudicap

So we won't have any file within TensorFlowSharp.package to support UWP. We have someone actively working on supporting WinML, which can potentially support this. Hopefully that will solve your problem.

xiaomaogy avatar Nov 03 '18 00:11 xiaomaogy

Thanks for your quick reply. Could I say that ml-agents does not support UWP build for now?

keanudicap avatar Nov 03 '18 00:11 keanudicap

It does not support UWP for now, it only experimentally supports inference on mac, windows, linux, ios and android.

xiaomaogy avatar Nov 03 '18 00:11 xiaomaogy

Please consider about supporting this on UWP, or you can give me some hints, maybe it is not so hard.

cindychen0204 avatar Nov 21 '18 14:11 cindychen0204

You can contribute to https://github.com/migueldeicaza/TensorFlowSharp to help supporting it.

xiaomaogy avatar Dec 18 '18 01:12 xiaomaogy

@xiaomaogy

I have the same issue as described here and on few other posts:

image

and wherever I search issue was related to unsupported setup (which is not my case), or was not resolved at all. Could you point to what may be wrong?

When I remove "ENABLE_TENSORFLOW" from Scripting Runtime Symbols, error disappears - I assume it's due to #if ENABLE_TENSORFLOW line.

Brute force removing #if ENABLE_TENSORFLOW didn't help either.

I have Unity 2018.3.0f2 Tried it on both ML Agents 0.5 and ML Agents 0.6 no success in either case.

What am I missing?

oddEventHorizon avatar Dec 20 '18 01:12 oddEventHorizon

Hi @oddEventHorizon , as we discussed above, the UWP is not supported by our TFSharp solution right now....And I'm not able to help you on this issue...

xiaomaogy avatar Dec 20 '18 01:12 xiaomaogy

thanks for short, reply. I'm not using UWP yet I see the same error. Should I start a new issue then?

image

oddEventHorizon avatar Dec 20 '18 01:12 oddEventHorizon

@oddEventHorizon Yes you should start another issue if it is not related with this issue's title.

xiaomaogy avatar Dec 20 '18 01:12 xiaomaogy

你好@xiaomaogy ,我也遇到了相同的问题,请问它现在能支持UWP了吗?

lh784116211 avatar Sep 15 '19 08:09 lh784116211

你好 @lh784116211 , 目前我们已经不用tensorflowsharp,转为使用Barracuda了。理论上Barracuda应该支持UWP, 不过我们没有试过,你可以试一下,要是不行的话可以再post一个新的issue。

xiaomaogy avatar Sep 15 '19 16:09 xiaomaogy

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jan 29 '21 17:01 github-actions[bot]