Files
chia-blockchain/Install.ps1
T
Earle LoweandGitHub c32a4a7493 Add Python 3.14 support (#20195)
* First pass add 3.14

* Update bitarray

* Update markupsafe

* Update zstd

* Update tach to version with 3.14 support

* Changes for 3.14 related things

* Refactor shutdown handling in sync method

* Ignore unclosed database ResourceWarning

Added a new warning to ignore for unclosed database resources.

* Update pytest.ini to ignore additional warnings

* ignore resourcewarnings about tempdir cleanup

* Minor cleanup for tests running under python 3.14

* Reduce consensus tests for test_ban_for_mismatched_tx_cost_fee

* make sure to close RPC client at end of test

* different idea for TempFile

* oh, no cleanup function

* small fixes for tests detected by 3.14

* update pytest.ini

* ignore sqlite errors during closing in __del__

* add code to ignore deprecatewarnings for loop policy

* Pass in ClientSession to wschiaconnection for proper cleanup

* Some more resource cleanup

* Trying to find unclosed sessions

* One more time needing a close

* wait for harvesters to connect to the farmer

* properly teardown vdf_server using context manager

* Testing cleanup for simulator tests

* Add in a sleep to allow sockets time to cleanup

* Revert "Testing cleanup for simulator tests"

This reverts commit c5a4ef0cc3.

* Revert "properly teardown vdf_server using context manager"

This reverts commit 18b456a7b6.

* Revert "Revert "Testing cleanup for simulator tests""

This reverts commit 8c8efc2e03.

* vdf_server cleanup

* attempt 47 of timelord cleanup

* Some other cleanup fixes in tests

* yet another attempt at timelord shutdown

* Some more adjustments for 3.14

* ignore unclosed socket resource warnings

* some more adjustments and cleanup

* remove commented code

* correct poetry.lock file

* Address some review comments

* fix merge indentation

* fix install script print

* update requests

* fix problems with timelord tests on 3.14

* Make sure to close dummy session on any exception

* Use different cleanup pattern to help with flakes on Windows

* better shutdown handling

* hopefully better awaiting for cleanup

* yet more better timelord cleanup

* some test adjustments

* more time for cleanup
2026-05-13 09:32:01 -05:00

139 lines
3.9 KiB
PowerShell

param(
[Parameter(HelpMessage="install development dependencies")]
[switch]$d = $False,
[Parameter()]
[switch]$i = $False,
[Parameter()]
[switch]$p = $False
)
$ErrorActionPreference = "Stop"
$extras = @()
$extras += "upnp"
if ($d)
{
$extras += "dev"
}
if ([Environment]::Is64BitOperatingSystem -eq $false)
{
Write-Output "Chia requires a 64-bit Windows installation"
Exit 1
}
if (-not (Get-Item -ErrorAction SilentlyContinue "$env:windir\System32\msvcp140.dll").Exists)
{
Write-Output "Unable to find Visual C++ Runtime DLLs"
Write-Output ""
Write-Output "Download and install the Visual C++ Redistributable for Visual Studio 2019 package from:"
Write-Output "https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2019"
Exit 1
}
if ($null -eq (Get-Command git -ErrorAction SilentlyContinue))
{
Write-Output "Unable to find git"
Exit 1
}
if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
{
Write-Output "Unable to find py"
Write-Output "Note the check box during installation of Python to install the Python Launcher for Windows."
Write-Output ""
Write-Output "https://docs.python.org/3/using/windows.html#installation-steps"
Exit 1
}
$supportedPythonVersions = "3.14", "3.13", "3.12", "3.11", "3.10"
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
{
$pythonVersion = $env:INSTALL_PYTHON_VERSION
}
else
{
foreach ($version in $supportedPythonVersions)
{
try
{
py -$version --version 2>&1 >$null
$result = $?
}
catch
{
$result = $false
}
if ($result)
{
$pythonVersion = $version
break
}
}
if (-not $pythonVersion)
{
$reversedPythonVersions = $supportedPythonVersions.clone()
[array]::Reverse($reversedPythonVersions)
$reversedPythonVersions = $reversedPythonVersions -join ", "
Write-Output "No usable Python version found, supported versions are: $reversedPythonVersions"
Exit 1
}
}
$fullPythonVersion = (py -$pythonVersion --version).split(" ")[1]
Write-Output "Python version is: $fullPythonVersion"
$openSSLVersionStr = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION)')
$openSSLVersion = (py -$pythonVersion -c 'import ssl; print(ssl.OPENSSL_VERSION_NUMBER)')
if ($openSSLVersion -lt 269488367)
{
Write-Output "Found Python with OpenSSL version:" $openSSLVersionStr
Write-Output "Anything before 1.1.1n is vulnerable to CVE-2022-0778."
}
$SQLiteVersionStr = (py -$pythonVersion -c 'import sys; import sqlite3; print(sqlite3.sqlite_version)')
Write-Output "SQLite version is: $SQLiteVersionStr"
$extras_cli = @()
foreach ($extra in $extras)
{
$extras_cli += "--extras"
$extras_cli += $extra
}
./Setup-poetry.ps1 -pythonVersion "$pythonVersion"
.penv/Scripts/poetry env use $(py -"$pythonVersion" -c 'import sys; print(sys.executable)')
.penv/Scripts/poetry sync @extras_cli
if ($i)
{
Write-Output "Running 'pip install --no-deps .' for non-editable"
.venv/Scripts/python -m pip install --no-deps .
}
if ($p)
{
$PREV_VIRTUAL_ENV = "$env:VIRTUAL_ENV"
$env:VIRTUAL_ENV = ".venv"
.\Install-plotter.ps1 bladebit
.\Install-plotter.ps1 madmax
$env:VIRTUAL_ENV = "$PREV_VIRTUAL_ENV"
}
cmd /c mklink /j venv .venv
Write-Output ""
Write-Output "Chia blockchain .\Install.ps1 complete."
Write-Output "For assistance join us on Discord in the #support chat channel:"
Write-Output "https://discord.gg/chia"
Write-Output ""
Write-Output "Try the Quick Start Guide to running chia-blockchain:"
Write-Output "https://docs.chia.net/introduction"
Write-Output ""
Write-Output "To install the GUI run '.\.venv\scripts\Activate.ps1' then '.\Install-gui.ps1'."
Write-Output ""
Write-Output "Type '.\.venv\Scripts\Activate.ps1' and then 'chia init' to begin."