Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Can I set the CoreCLR version? #2464

New issue

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

Closed
Jason5Lee opened this issue Sep 27, 2024 · 3 comments
Closed

Can I set the CoreCLR version? #2464

Jason5Lee opened this issue Sep 27, 2024 · 3 comments

Comments

@Jason5Lee
Copy link

I'm trying to use pythonnet with .NET 9 RC. When I tried pythonnet.load("coreclr"), the following error message from .NET was shown.

You must install or update .NET to run this application.

App: <python path>
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '9.0.0' (x64)
.NET location: <dotnet path>

The following frameworks were found:
  6.0.33 at [<path>]
  8.0.8 at [<path>]
  9.0.0-rc-1.24431.7 at [<path>]

...

It seems that .NET cannot resolve 9.0.0 with 9.0.0-rc. For my usecase 8.0.8 is OK. Can I make pythonnet to use this version of .NET?

@filmor
Copy link
Member

filmor commented Sep 27, 2024

The function this is failing in is https://github.com/pythonnet/clr-loader/blob/master/clr_loader/__init__.py#L89

Is this really the only output you are seeing? There should at least be an exception message after this...

@PawelOHV
Copy link

PawelOHV commented Oct 2, 2024

I have the similar issue on two Windows 11 machines (In my case it's .net8 solution but requested by pythonnet is .net9):
'python.exe' (Win32): Loaded 'C:\Python311\python.exe'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'.
'python.exe' (Win32): Loaded 'C:\Python311\vcruntime140.dll'.
'python.exe' (Win32): Loaded 'C:\Python311\python311.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'.
'python.exe' (Win32): Loaded 'C:\Program Files\Avecto\Privilege Guard Client\PGHook.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'.
'python.exe' (Win32): Loaded 'C:\Python311\python3.dll'.
'python.exe' (Win32): Loaded 'C:\Python311\DLLs_bz2.pyd'.
'python.exe' (Win32): Loaded 'C:\Python311\DLLs_lzma.pyd'.
'python.exe' (Win32): Loaded 'C:\Python311\Lib\site-packages_cffi_backend.cp311-win_amd64.pyd'. Module was built without symbols.
'python.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'.
'python.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'.
'python.exe' (Win32): Loaded 'C:\Program Files\dotnet\host\fxr\8.0.8\hostfxr.dll'.
You must install or update .NET to run this application.

App: C:\Python311\python.exe
Architecture: x64Framework: 'Microsoft.NETCore.App', version '9.0.0' (x64).NET location: C:\Program Files\dotnet
The following frameworks were found: 3.1.24 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.33 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 7.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 7.0.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 8.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 8.0.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 9.0.0-preview.7.24405.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 9.0.0-rc.1.24431.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=9.0.0&arch=x64&rid=win-x64&os=win10'python.exe' (Win32): Unloaded 'C:\Program Files\dotnet\host\fxr\8.0.8\hostfxr.dll'

@PawelOHV
Copy link

PawelOHV commented Oct 7, 2024

Please do not use the load("coreclr") and try:
from clr_loader import get_coreclr
from pythonnet import set_runtime

rt = get_coreclr(runtime_config="runtimeconfig.json")
set_runtime(rt)

In the runtimeconfig.json replace with your framework
{
"runtimeOptions": {
"tfm": "net8.0",
"framework":
{
"name": "Microsoft.NETCore.App",
"version": "8.0.8"
}
}
}

@pythonnet pythonnet locked and limited conversation to collaborators Apr 11, 2025
@lostmsu lostmsu converted this issue into discussion #2581 Apr 11, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants