After hours of searching and trial and error, I finally decided to ask you guys for help. As I'm trying to call some functions from a .NET 6 open source project from python, I installed python3.8.4 on my raspberry pi and managed to install the pythonnet 3.0.0 module.
my app.runtime.json is the following:
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.102"
}
}
}
and when I try to load the CLR like this:
from clr_loader import get_coreclr
from pythonnet import set_runtime
rt = get_coreclr("app.runtime.json")
set_runtime(rt)
import sys
I get the following error message:
RuntimeError Traceback (most recent call last) Input In [11], in 1 from clr_loader import get_coreclr 2 from pythonnet import set_runtime ----> 4 rt = get_coreclr("app.runtime.json") 5 set_runtime(rt) 6 import sys
File ~/.local/lib/python3.8/site-packages/clr_loader/init.py:42, in get_coreclr(runtime_config, dotnet_root, properties) 39 from .hostfxr import DotnetCoreRuntime 41 if dotnet_root is None: ---> 42 dotnet_root = find_dotnet_root() 44 impl = DotnetCoreRuntime(runtime_config=runtime_config, dotnet_root=dotnet_root) 45 if properties:
File ~/.local/lib/python3.8/site-packages/clr_loader/util/find.py:22, in find_dotnet_root() 20 dotnet_path = shutil.which("dotnet") 21 if not dotnet_path: ---> 22 raise RuntimeError("Can not determine dotnet root") 24 try: 25 # Pypy does not provide os.readlink right now 26 if hasattr(os, "readlink"):
RuntimeError: Can not determine dotnet root
I exported the path to my dotnet 6.0 sdk to PATH and when I use "dotnet --version" it prints out 6.0.102.
What can I possibly have done wrong?
Thanks in advance,
Epi