-
Notifications
You must be signed in to change notification settings - Fork 228
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
SystemPlatformNotSupported when running test_tutorials.py using pythonnet #333
Comments
See issue #297 |
Hi Tminka, thank you for your answer. I don't think issue #297 is the same as this. The error message looks different, and here I am not using Mono, I am using instead a conda version which I used to install pythonnet via the command conda install pythonnet. Also, if I add the line engine.Compiler.CompilerChoice = CompilerChoice.CodeDom to the code of test_tutorials.py, I get a NameError exception (name "CompilerChoice" is not defined"). In any case, in that issue the user said the installation of pythonnet via conda solved the problem for him. To be sure we are on the same page, I think here what we have is something much more fundamental, in practice I am just trying to run your own Python example on a conda environment which has pythonnet installed. Also, if this helps, I have run the Python example on Windows. The tutorials in C# run perfectly. |
Pythonnet requires you to import user-defined types before you can use them. This includes CompilerChoice. It is in namespace Microsoft.ML.Probabilistic.Compiler. |
Ok fair point, thanks. However, this doesn't fix the issue unfortunately; if I make that addition to the code and set CompilerChoice to CodeDom, I get the same error with the new choice as the "unsupported one" on the platform: System.PlatformNotSupportedException: Current platform is not supported by the current compiler choice CodeDom. Try a different one. |
Okay, try CompilerChoice.Roslyn. |
Okay, Roslyn is apparently an available choice of the compiler, nonetheless seems that some component is still missing: now I get System.IO.FileNotFoundException: Could not load file or assemply System.Collections.Immutable , Version=1.2.3.0, PublicKeyToken=... or one of its dependencies. The system cannot find the file specified. |
test_tutorials.py has the line:
In that folder, you should find System.Collections.Immutable.dll and all other required libraries. If you see it there and it still doesn't work, try deleting that bin folder and regenerate by re-compiling Infer.NET. |
Hi, ok I think I am finding something interesting. The folder you mentioned is NOT generated at compilation -- instead of DebugFull, it generates Debug\netappcore3.1. I had already substituted the path to it. The thing is, in that folder there are just .dll s related to GraphicalModellingLib, .cs and .csproj files -- like .NETCoreapp,VErsion3.1,AssemplyAttributes.cs and other stuff but NOT the System.Collections dlls that you mentioned. To be more speficic, I am using Visual Studio 2019, .NETCore 3.1, and I installed Infer.NET via the Nuget manager in VS. Could you please specify on how you run test_tutorials.py? This might be also related to the way VS builds the solutions -- similar errors happened in dotnet/msbuild#1582 and NuGet/Home#4488 albeit with different packages and no different languages mentioned. |
You must build with the DebugFull configuration to generate the DebugFull folder. It will not work otherwise. I will add this note to test_tutorials.py. |
Hi, thanks, that would help, along with the Compiler choice. However, I still cannot reproduce what you illustrated. Briefly, with the Debug in Full configuration it does not create the folder DebugFull still. Inside the Debug folder instead, it does create the folders Net461 and NetStandard1.4, which are both empty. In the folder netappcore3.1, instead, a new folder is generated, "roslyn", which contains all the systems .dll included the System.Collections.Immutable that you mentioned. Notwithstanding, even if I append this other folder to the path, it still throws the same exception. By reading the error message, I suspect it's because what it looks for is a file or assembly that is really called "System.Collections.Immutable,version= Version=1.2.3.0,Culture=neutral,PublicKeyToken=...." and not just "System.Collections.Immutable". |
If you don't get the DebugFull folder then you haven't set the configuration to DebugFull. The configurations are defined in Infer.sln. |
Perhaps the underlying problem is that you are not building Infer.NET from source. If you are trying to create a brand new solution out of a subset of the Infer.NET source files, then you will have to do the work of ensuring that all of the dlls are available. Python.NET does not automatically resolve nuget references. It only works with dlls. |
It also occurred to me. Could be. Thanks for the suggestion, in the next days I'll try and I'll keep you posted. |
Hi everybody, I am trying to use Infer.NET in Python by copying your example file test_tutorials.py, which leverages pythonnet. However, I get the following error:
SystemPlatformNotSupportedException: Operation is not supported on this platform
After a list of functions that throw this error, I get:
The above exception was the direct cause of the following exception:
SystemPlatformNotSupportedError: Current platform is not supported by the current compiler choice Auto. Try a different one.
Does anybody now what is the root cause of this platform error? How do I change a compiler choice? Or is there a known workaround for this? My Python implementation is Cpython, might this be due to the fact that this is designed for IronPython only?
I am posting this here, because the code is in your repository but it does not run althought it would be expected to do so, therefore it could be an issue related to it.
The text was updated successfully, but these errors were encountered: