Closed alexhiggins732 closed 3 years ago
I solved this issue. It was due to bad Python.Net wiki documentation showing how to use Python.Net in a virtual environment.
The fix, for others facing this or very similar issues, is to not use the code in the Wiki:
var pathToVirtualEnv = @"path\to\env";
Environment.SetEnvironmentVariable("PATH", pathToVirtualEnv, EnvironmentVariableTarget.Process);
Doing so will overwrite your PATH
environmental variable.
Instead, append the path to your python virtual environment to your existing PATH
environmental variable.
Instead, append the path to your virtual environment to your PATH
environmental variable.
string pathToVirtualEnv = @"path\to\env";
var path = Environment.GetEnvironmentVariable("PATH");
Environment.SetEnvironmentVariable("PATH", path + ";" + pathToVirtualEnv, EnvironmentVariableTarget.Process);
Environment
Details
I am current working on using Python.NET to build C# environments for interaction TensorFlow Agents and am receiving a TensorFlow error attempting to load Cuda DLLs.
When I run pure python examples Tensor flow loads the CUDA DLLs without issue:
However, when I run an environment that uses a Python environment that is essentially a wrapper for an environment written in C# using Python.Net is recieve errors the Cuda DLLs were not found:
Minimal code to reproduce the issue:
With TicTacToeSharpEnvironmentWrapper.py
TicTacToeSharpEnvironment is a c# class libary compiled as 64bit dll
And PythonInitiliazer is used to initalize Python.Net
The full code works. The Python Wrapper of the C# environment passes the Tensorflow Agents unit tests for the Tic Tac Toe environment. The C# environment can be wrapped as Python or a Tensor flow environment and the various agents can train against the environment.
I don't think this is a compatibility issue using the x64 .Net DLL because I am using 64 bit python, but I a can't be certain.