Skip to content

Could not find a suitable hostfxr library #40

@gabloe

Description

@gabloe

Environment

  • Pythonnet version: 3.0.0.post1
  • Python version: 3.8
  • Operating System: macOS 12.6
  • .NET Runtime: .NETCore 6
  • Architecture: arm64 (Apple M1)

Details

import os
import sys
from clr_loader import get_coreclr
from pythonnet import set_runtime

runtime_config = os.path.join("/Users/gabloe/dotnetconfig", "pythonnettest.runtimeconfig.json")
rt = get_coreclr(runtime_config=runtime_config)
set_runtime(rt)

import clr

Traceback

Traceback (most recent call last):
...
    rt = get_coreclr(runtime_config=runtime_config)
  File "/Users/gabloe/Library/Caches/pypoetry/virtualenvs/test-lQu4lGUY-py3.8/lib/python3.8/site-packages/clr_loader/__init__.py", line 122, in get_coreclr
    impl = DotnetCoreRuntime(runtime_config=runtime_config, dotnet_root=dotnet_root)
  File "/Users/gabloe/Library/Caches/pypoetry/virtualenvs/test-lQu4lGUY-py3.8/lib/python3.8/site-packages/clr_loader/hostfxr.py", line 20, in __init__
    self._dll = load_hostfxr(self._dotnet_root)
  File "/Users/gabloe/Library/Caches/pypoetry/virtualenvs/test-lQu4lGUY-py3.8/lib/python3.8/site-packages/clr_loader/ffi/__init__.py", line 31, in load_hostfxr
    raise RuntimeError(f"Could not find a suitable hostfxr library in {dotnet_root}")
RuntimeError: Could not find a suitable hostfxr library in /usr/local/share/dotnet
Exception ignored in: <function Runtime.__del__ at 0x7f8609306820>
Traceback (most recent call last):
  File "/Users/gabloe/Library/Caches/pypoetry/virtualenvs/test-lQu4lGUY-py3.8/lib/python3.8/site-packages/clr_loader/types.py", line 137, in __del__
    self.shutdown()
  File "/Users/gabloe/Library/Caches/pypoetry/virtualenvs/test-lQu4lGUY-py3.8/lib/python3.8/site-packages/clr_loader/hostfxr.py", line 111, in shutdown
    if self._handle is not None:
AttributeError: 'DotnetCoreRuntime' object has no attribute '_handle'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions