We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
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
Environment:
Details:
Trying to run some Python in a C# app. This is my code:
Runtime.PythonDLL = @"/usr/lib/x86_64-linux-gnu/libpython3.12.so"; string pathToVirtualEnv = @"/home/jadan/venvs/venv_mare"; string path = Environment.GetEnvironmentVariable("PATH")!.TrimEnd(Path.PathSeparator); path = string.IsNullOrEmpty(path) ? pathToVirtualEnv : path + Path.PathSeparator + pathToVirtualEnv; Environment.SetEnvironmentVariable("PATH", path, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("PYTHONHOME", pathToVirtualEnv, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("PYTHONPATH", $"{pathToVirtualEnv}/lib/site-packages{Path.PathSeparator}" + $"{pathToVirtualEnv}{Path.PathSeparator}", EnvironmentVariableTarget.Process); PythonEngine.PythonPath = PythonEngine.PythonPath + Path.PathSeparator + Environment.GetEnvironmentVariable("PYTHONPATH", EnvironmentVariableTarget.Process); PythonEngine.PythonHome = pathToVirtualEnv; PythonEngine.Initialize(); using (Py.GIL()) { dynamic np = Py.Import("numpy"); }
Unfortunately, this give the following error:
Python path configuration: PYTHONHOME = '/home/jadan/venvs/venv_mare' PYTHONPATH = (not set) program name = 'python3' isolated = 0 environment = 1 user site = 1 safe_path = 0 import site = 1 is in build tree = 0 stdlib dir = '' sys._base_executable = '/usr/bin/python3' sys.base_prefix = '' sys.base_exec_prefix = '' sys.platlibdir = 'lib' sys.executable = '/usr/bin/python3' sys.prefix = '' sys.exec_prefix = '' sys.path = [ '', '/home/jadan/venvs/venv_mare/lib/python3.12/site-packages', '/home/jadan/venvs/venv_mare', '', ] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings'
Can someone help me?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment:
Details:
Trying to run some Python in a C# app. This is my code:
Unfortunately, this give the following error:
Can someone help me?
The text was updated successfully, but these errors were encountered: