losttech / Gradient

This repository serves as a public issue tracker and documentation host for Gradient, full TensorFlow binding for .NET
Other
86 stars 4 forks source link

Can not find Python 3.7 #34

Closed bine0josi closed 3 years ago

bine0josi commented 3 years ago

Hey, I am currently trying to get the whole set up done and somehow (I think I followed all the steps in the docu correctly) the installed python can not be found when I try to run the example from git (FashionMnistClassification). I always get this exception: LostTech.Gradient.GradientInitializationException: 'Python 3.6+ not found. Install it globally, or use GradientEngine to configure Python home to use a different environment.'

I am using Visual Studio 19 Community. First I got Python over the VS Installer, but it did not work. Now I installed it manually (but also v3.7), also I ran the pip to install tensorflow and there I got this message when trying to import it to python: grafik

I think this message is "fine" because I installed the cpu and not the gpu version. Then I added the NuGet package for losttech and this seems to be fine because I do not have any errors in the example code. Am I still missing something?

Kind regards and sorry for the maybe stupid question, Philippine

lostmsu commented 3 years ago

@bine0josi you can always use GradientEngine.UseEnvironment(env) (as suggested in the error message) to explicitly specify which Python should be used.

You did not mention the TensorFlow version you installed. Latest release requires 1.15.*, and will simply ignore Python environments with TensorFlow 2.0+. We are expecting the first alpha working with 2.4 in a week or two.

We use WhichPython to find environments. Its repository has a trivial console app, that you can run to see how it searches for Python installations and what it finds.

lostmsu commented 3 years ago

Specifically, since you are not using Conda, I recommend using PythonEnvironment.FromInterpreterChecked(path_to_python_exe).

bine0josi commented 3 years ago

Thank you, now python was found. Now I get this error message: grafik The inner exception is: Win32Exception: %1 is not a valid Win32Application Any idea how I can fix that? I checked the data in env and there it seems that the python37.dll was fund correctly. grafik

Thank you in advance. By the way, I installed Tensorflow 1.15

lostmsu commented 3 years ago

@bine0josi looks like your C# app starts as 32 bit. It needs to be 64 bit. You can check bitness as 8 * IntPtr.Size.

To get 64 bit, this setting in project properties must be off. And you must be running .NET Framework or 64 bit .NET Core 32 bit

bine0josi commented 3 years ago

Thank you so much, now everything works fine.