Install & Compatibility
Where this runs
tested against v3.1.23 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.5s · import 0.000s · 96MB
93MB installed
● package 93MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
install
✓ import dotnetcore2
✗ from dotnetcore2 import install
This quickstart demonstrates how to use `dotnetcore2` to install the .NET Core 3.1 runtime into a specified local directory. It then retrieves the path to the installed runtime for subsequent use, such as executing .NET applications.
import os
from dotnetcore2.runtime import install, get_installed_dotnet_root
# Define a directory where .NET Core 3.1 will be installed
install_dir = os.path.join(os.path.dirname(__file__), "dotnet_runtime_31")
print(f"Attempting to install .NET Core 3.1 to: {install_dir}")
try:
# The 'install' function handles downloading and setting up .NET Core 3.1
install(install_dir)
print("Installation initiated. Checking installed root...")
# Get the actual path to the installed dotnet executable
dotnet_root = get_installed_dotnet_root(install_dir)
if dotnet_root:
print(f".NET Core 3.1.x installed at: {dotnet_root}")
print(f"You can now access 'dotnet' command at: {os.path.join(dotnet_root, 'dotnet')}")
else:
print("Failed to determine .NET Core 3.1 root after installation.")
except Exception as e:
print(f"An error occurred during installation: {e}")
print("Please check the console output above for more details from the dotnet-install script.")
Debug
Known issues
breakingThe `dotnetcore2` package is designed to install .NET Core 3.1, which reached End-of-Life (EOL) in December 2022. Using EOL software is highly discouraged due to lack of security updates, bug fixes, and support. This poses significant security risks for any application relying on it.fixFor new projects, migrate to a currently supported .NET version (e.g., .NET 8 LTS or newer) and use the official Microsoft installation methods. Avoid using `dotnetcore2` for production or new development.
affects: All versions (installs 3.1.x)
gotchaThis package is an *installer* wrapper, not a library for *interacting* with .NET APIs or running .NET code directly within Python. It simply automates the setup of the .NET Core 3.1 runtime environment on the host system. It does not provide any Python bindings for .NET libraries.fixUnderstand that after installation, you still need to use `subprocess` or similar methods to invoke the `dotnet` CLI or execute .NET applications. This package does not bridge Python and .NET APIs.
affects: All versions
deprecatedThe `dotnetcore2` package itself is no longer actively maintained by its author. The last release was in 2020, and the GitHub repository explicitly states it is no longer updated as .NET Core 3.1 is EOL. Future compatibility issues with newer operating systems or Python versions are likely.fixIf your project critically depends on .NET Core 3.1, consider vendoring the necessary installation scripts or maintaining your own forks of this package. The best solution is to upgrade to a supported .NET version.
affects: All versions
Upgrade
Version history
3.1.23latest on PyPI · released Apr 28, 2022
Audit
Dependencies
No dependency data recorded yet.