Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RuntimeError: Failed to create a .NET runtime (coreclr) using the parameters {}.#2513

Unanswered
dom-compusoft asked this question inQ&A
Discussion options

I'm running into an issue trying to download the CalcPad Python API, which requires Pythonnet. Specifically, I am encountering an error related to the missing .NET runtime (coreclr) when trying to load the coreclr runtime. Despite having the .NET SDK and Runtime installed, Pythonnet cannot find the required hostfxr library, resulting in the following error:

Traceback (most recent call last):  File "C:\path\to\project\.conda\Lib\site-packages\pythonnet\__init__.py", line 77, in _create_runtime_from_spec    return clr_loader.get_coreclr(**params)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\path\to\project\.conda\Lib\site-packages\clr_loader\__init__.py", line 142, in get_coreclr    impl = DotnetCoreRuntime(runtime_config=runtime_config, dotnet_root=dotnet_root)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\path\to\project\.conda\Lib\site-packages\clr_loader\hostfxr.py", line 22, in __init__        self._dll = load_hostfxr(self._dotnet_root)                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\path\to\project\.conda\Lib\site-packages\clr_loader\ffi\__init__.py", line 37, 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 C:\Program Files\dotnetThe above exception was the direct cause of the following exception:Traceback (most recent call last):  File "c:\path\to\project\.conda\Lib\site-packages\pycalcpad\PyCalcpadRun.py", line 3, in <module>     from PyCalcpadWrapper import Calculator, MathSettings  File "c:\path\to\project\.conda\Lib\site-packages\pycalcpad\PyCalcpadWrapper.py", line 6, in <module>    load("coreclr")  File "C:\path\to\project\.conda\Lib\site-packages\pythonnet\__init__.py", line 135, in load           set_runtime(runtime, **params)  File "C:\path\to\project\.conda\Lib\site-packages\pythonnet\__init__.py", line 29, in set_runtime     runtime = _create_runtime_from_spec(runtime, params)              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\path\to\project\.conda\Lib\site-packages\pythonnet\__init__.py", line 90, in _create_runtime_from_spec    raise RuntimeError(RuntimeError: Failed to create a .NET runtime (coreclr) using the                parameters {}.

Any help or guidance would be much appreciated :)

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

I think I'm running into this, too. Feels like it happened kind of out all of a sudden.

I'm in a build pipeline with just one agent and wondering if something happened to it because, for the same code, I had a run without error in the past but re-running for the same commit is giving the above error.

My versions of dependencies are as follows:

  • pythonnet: 3.0.3
  • clr-loader: 0.2.6

How can you verify the installation (and availability?) of the .NET SDK and Runtime? That is what I'm looking into next.

You must be logged in to vote
2 replies
@pb-413
Comment options

When I logged into my VM (agent), I saw a message like so:

1 updates could not be installed automatically. For more details,see /var/log/unattended-upgrades/unattended-upgrades.log

Reading that file, it seems some dotnet package was automatically uninstalled while another piece (?) was kept:

2025-03-12 06:58:19,735 INFO Starting unattended upgrades script2025-03-12 06:58:19,736 INFO Allowed origins are: o=Ubuntu,a=jammy, o=Ubuntu,a=jammy-security, o=UbuntuESMApps,a=jammy-apps-security, o=UbuntuESM,a=jammy-infra-security...2025-03-12 06:58:24,977 INFO Packages that will be upgraded: aspnetcore-runtime-8.0 aspnetcore-targeting-pack-8.0 dotnet-apphost-pack-8.0 dotnet-runtime-8.0 dotnet-targeting-pack-8.0 python3-jinja22025-03-12 06:58:24,977 INFO Writing dpkg log to /var/log/unattended-upgrades/unattended-upgrades-dpkg.log2025-03-12 06:59:39,880 INFO All upgrades installed2025-03-12 06:59:50,590 INFO Packages that were successfully auto-removed: dotnet-runtime-deps-8.02025-03-12 06:59:50,591 INFO Packages that are kept back:2025-03-12 06:59:50,849 INFO Package dotnet-hostfxr-8.0 is kept back because a related package is kept back or due to local apt_preferences(5).

This mention of hostfxr beingkept seems contradictory to our issue, but relevant.

Perhaps the item that was removed, dotnet-runtime-deps-8.0, helps pythonnet find and fulfil this dependency?

/var/log/unattended-upgrades/unattended-upgrades-dpkg.log didn't seem helpful.

I wonder how I could re-install dotnet-runtime-deps-8.0 to test the theory.

@pb-413
Comment options

dotnet --info reveals that I have no runtime.

$ dotnet --infoYou must install or update .NET to run this application.App: /usr/share/dotnet/sdk/8.0.405/dotnet.dll...No frameworks were found.Learn more:https://aka.ms/dotnet/app-launch-failedTo install missing framework, download:https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.12&arch=x64&rid=linux-x64&os=ubuntu.22.04....NET SDKs installed:  8.0.405 [/usr/share/dotnet/sdk].NET runtimes installed:  No runtimes were found.

That aligns with the "auto-removed: dotnet-runtime-deps-8.0" line I saw above, but might not align with this thread:

Despite having the .NET SDK and Runtime installed...

For others, my resolution steps (ubuntu):

  1. dotnet --list-runtimes, which initially returned empty
  2. sudo apt-get update, becauseinstall didn't seem to work without this first
  3. sudo apt-get install -y dotnet-runtime-8.0
  4. dotnet --list-runtimes, which showed that I got my 8.0 runtime

Source:https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?pivots=os-linux-ubuntu-2204&tabs=dotnet8#install-the-runtime

After executing the above resolution steps, I ran my pipeline and everything was back to normal!

Summary of my experience with resolution steps and troubleshooting:

$ dotnet --list-runtimes # no return$ sudo apt-get install -y dotnet-runtime-8.0[sudo] password for user:Reading package lists... DoneBuilding dependency tree... DoneReading state information... Donedotnet-runtime-8.0 is already the newest version (8.0.14-0ubuntu1~22.04.1).dotnet-runtime-8.0 set to manually installed.0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.$ dotnet --list-runtimes # no return$ sudo apt-get update$ sudo apt-get check # not sure if this is needed; I was just troubleshooting / exploring apt-getReading package lists... DoneBuilding dependency tree... DoneReading state information... Done$ sudo apt-get install -y dotnet-runtime-8.0Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following packages were automatically installed and are no longer required:  liblttng-ust-common1 liblttng-ust-ctl5 liblttng-ust1Use 'sudo apt autoremove' to remove them.The following additional packages will be installed:  dotnet-hostfxr-8.0 dotnet-runtime-deps-8.0The following NEW packages will be installed:  dotnet-runtime-deps-8.0The following packages will be upgraded:  dotnet-hostfxr-8.0 dotnet-runtime-8.02 upgraded, 1 newly installed, 0 to remove and 38 not upgraded.$ dotnet --list-runtimesMicrosoft.NETCore.App 8.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Strange that it mentions installing dotnet-hostfxr-8.0 even though the other log said that it would be kept around.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@dom-compusoft@pb-413

[8]ページ先頭

©2009-2025 Movatter.jp