dotnet / infer

Infer.NET is a framework for running Bayesian inference in graphical models
https://dotnet.github.io/infer/
MIT License
1.56k stars 228 forks source link

Unable to install package Microsoft.ML.Probabilistic in my Unity3d Project using .net version 4.6 #63

Closed vipin8169 closed 6 years ago

vipin8169 commented 6 years ago

I am Unable to install package Microsoft.ML.Probabilistic for the Infer.NET framework in my Unity project. I am trying to install it by using Project > Manage Nuget Packages option in my visual studio. Both .net and the infer.net package are Microsoft products, and yet they have not released a compatible version. When I click on install I get the following error stating that the package is not compatible with .net version 4.6:

Could not install package 'Microsoft.ML.Probabilistic 0.3.1810.501'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

enter image description here

Below is a screenshot of my Unity3d Edit > Project Settings > Player inspector screen: enter image description here

tminka commented 6 years ago

Infer.NET targets .NET Standard 2.0, which requires .NET framework version 4.6.1 or .NET Core 2.1, and Unity 2018.1, as explained at .NET implementation support.

vipin8169 commented 6 years ago

I am using Unity Unity 2018.1.8f1 (64-bit) and .NET 4.x, but not the .NET standard 2.0

image

I tried switching to .NET Standard 2.0, and everything fell apart although the game is working as expected :( image

tminka commented 6 years ago

That looks like a Unity problem, not an Infer.NET problem.

vipin8169 commented 6 years ago

I think it is a problem with Visual Studio, as the game is still working fine :(

tminka commented 6 years ago

Either way, it sounds like the issue is closed on our end.

vipin8169 commented 6 years ago

I changed the config as per the requirements for infer.net but still getting the same error: Screenshot of unity config: image Screenshot of error in VS: image

tminka commented 6 years ago

That error message is correct. There is no problem with the Infer.NET package, so it is not an Infer.NET issue.

vipin8169 commented 6 years ago

ok, but how do I make it work?

a-vishar commented 6 years ago

You need to run in >= .NET 4.6.2. If you want to work out how to do that, I suggest you open a ticket with Unity3D.

vipin8169 commented 6 years ago

But my project is clearly using version > .net 4.6. attached is the screenshot for proof. image

a-vishar commented 6 years ago

Please upload your project or a simple repro and I will take a look.

Also, I would suggest you check the project properties of your project in Visual Studio, your screenshot only shows what .NET version is installed to the system, not what you are directing your project to use.

vipin8169 commented 6 years ago

the repo is 163MB in size (after compressing), I am unable to attach here.

a-vishar commented 6 years ago

Please upload to OneDrive or similar and share a link. Also, have you checked your project properties?

vipin8169 commented 6 years ago

Here is the project repo - https://github.com/vipin8169/chem-o-crypt

vipin8169 commented 6 years ago

Yes, I have checked my project properties both in Unity as well as VS. Did you mean to ask something specific in there?

tminka commented 6 years ago

See How to: Target a version of the .NET Framework

vipin8169 commented 6 years ago

See How to: Target a version of the .NET Framework

I do not see the Application tab when I go to my project properties :( image

a-vishar commented 6 years ago

That's your solution properties, you need to go to the properties of each project.

vipin8169 commented 6 years ago

That's your solution properties, you need to go to the properties of each project.

When I go to right click on project and go to properties, nothing happens except a blink and then a message appears at the bottom saying that this item doesn't support previewing: image

Found the fix: https://answers.unity.com/questions/1140063/cant-open-project-property-in-visual-studio-2015-w.html

it opened, but one error fix lead to another. extremely annoying: image

a-vishar commented 6 years ago

I'm not familiar with Unity3D, what I did was open the Unity3D project, open the C# project from the menu in Unity3D and then add the NuGet reference.

I installed this version of Unity3D: 2018.3b.

As you can see from the output below, the NuGet package installed correctly. I would naively guess that the issue is the version of Unity3D you are using. Can you try with the version I linked to and report back?

Attempting to gather dependency information for package 'Microsoft.ML.Probabilistic.0.3.1810.501' with respect to project 'Assembly-CSharp-firstpass', targeting '.NETFramework,Version=v4.7.1'
Gathering dependency information took 52.55 ms
Attempting to resolve dependencies for package 'Microsoft.ML.Probabilistic.0.3.1810.501' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.ML.Probabilistic.0.3.1810.501'
Resolved actions to install package 'Microsoft.ML.Probabilistic.0.3.1810.501'
Retrieving package 'Microsoft.ML.Probabilistic 0.3.1810.501' from 'nuget.org'.
  GET https://api.nuget.org/v3-flatcontainer/microsoft.ml.probabilistic/0.3.1810.501/microsoft.ml.probabilistic.0.3.1810.501.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.ml.probabilistic/0.3.1810.501/microsoft.ml.probabilistic.0.3.1810.501.nupkg 1241ms
Installing Microsoft.ML.Probabilistic 0.3.1810.501.
Adding package 'Microsoft.ML.Probabilistic.0.3.1810.501' to folder 'C:\Users\Home\Downloads\chem-o-crypt-master\packages'
Added package 'Microsoft.ML.Probabilistic.0.3.1810.501' to folder 'C:\Users\Home\Downloads\chem-o-crypt-master\packages'
Added package 'Microsoft.ML.Probabilistic.0.3.1810.501' to 'packages.config'
Successfully installed 'Microsoft.ML.Probabilistic 0.3.1810.501' to Assembly-CSharp-firstpass
Executing nuget actions took 4.74 sec
Time Elapsed: 00:00:04.9116524
========== Finished ==========
vipin8169 commented 6 years ago

I'm not familiar with Unity3D, what I did was open the Unity3D project, open the C# project from the menu in Unity3D and then add the NuGet reference.

I installed this version of Unity3D: 2018.3b.

As you can see from the output below, the NuGet package installed correctly. I would naively guess that the issue is the version of Unity3D you are using. Can you try with the version I linked to and report back?

Attempting to gather dependency information for package 'Microsoft.ML.Probabilistic.0.3.1810.501' with respect to project 'Assembly-CSharp-firstpass', targeting '.NETFramework,Version=v4.7.1'
Gathering dependency information took 52.55 ms
Attempting to resolve dependencies for package 'Microsoft.ML.Probabilistic.0.3.1810.501' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.ML.Probabilistic.0.3.1810.501'
Resolved actions to install package 'Microsoft.ML.Probabilistic.0.3.1810.501'
Retrieving package 'Microsoft.ML.Probabilistic 0.3.1810.501' from 'nuget.org'.
  GET https://api.nuget.org/v3-flatcontainer/microsoft.ml.probabilistic/0.3.1810.501/microsoft.ml.probabilistic.0.3.1810.501.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.ml.probabilistic/0.3.1810.501/microsoft.ml.probabilistic.0.3.1810.501.nupkg 1241ms
Installing Microsoft.ML.Probabilistic 0.3.1810.501.
Adding package 'Microsoft.ML.Probabilistic.0.3.1810.501' to folder 'C:\Users\Home\Downloads\chem-o-crypt-master\packages'
Added package 'Microsoft.ML.Probabilistic.0.3.1810.501' to folder 'C:\Users\Home\Downloads\chem-o-crypt-master\packages'
Added package 'Microsoft.ML.Probabilistic.0.3.1810.501' to 'packages.config'
Successfully installed 'Microsoft.ML.Probabilistic 0.3.1810.501' to Assembly-CSharp-firstpass
Executing nuget actions took 4.74 sec
Time Elapsed: 00:00:04.9116524
========== Finished ==========

did you change any of these settings in the unity project? image

a-vishar commented 6 years ago

I did not, the steps I followed were:

  1. Install Unity3D version listed above
  2. Open Unity3D project
  3. Open C# project via Unity menu
  4. Install NuGet package

I believe the version of Unity3D you are using only allows you to target 4.6 and not higher. Please upgrade your version of Unity3D and report back.

vipin8169 commented 6 years ago

I am trying, the only concern that I have is if it will break anything in my existing project :( How did you check what version of .net does the unity allow, as it just says 4.x in the project settings

tminka commented 6 years ago

You should not need to upgrade Unity. The page I linked earlier clearly says that 2018.1 supports .NET Standard 2.0, and the unity documentation says the same thing. I think it is just the unity configuration. Vijay, can you send your configuration screen?

a-vishar commented 6 years ago

Here is a screenshot of my Configuration:

image

Another thought I had was that the targeting/developer pack for > 4.6 might not be installed? From what I have read, Unity3D doesn't appear to rely on an exact version of the framework, but only what you have available. So when you installed a version of Unity2D which was compatible with a newer framework version it may not have installed it for you.

I believe it may be beneficial to install the targeting/developer pack for the .net framework (> 4.6) you wish to run on. You can find all the installers under the .NET Framework Version. At this point we're trying to diagnose why the project I downloaded from your repo and opened as-is is working on my machine and not yours, which leads me to believe it's a targetting issue.

vipin8169 commented 6 years ago

I have the same config on my system as well :/ image

my target version is also 4.7, which is >4.6 image

a-vishar commented 6 years ago

Can you copy the full text from the output pane when you try to install the NuGet package?

vipin8169 commented 6 years ago

wow, I don't know what changed but now I went to install it and viola, it worked. lol banging my head on the wall....!

only changes I did were to fix the right click project properties to appear in my VS, which were earlier giving errors and I solved using this post https://www.reddit.com/r/Unity3D/comments/935n03/an_error_occurred_trying_to_load_the_page_issue/

a-vishar commented 6 years ago

Issue appears to be solved.