Skip to content

Commit

Permalink
Add nuget windows install instructions (#130)
Browse files Browse the repository at this point in the history
* update references to old python versions throughout the guide

* Add nuget windows install instructions

* add Scripts directory to the Path
  • Loading branch information
ngoldbaum authored Jan 24, 2025
1 parent c359820 commit e205066
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: custom python install script
shell: pwsh
run: |
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe"
Invoke-WebRequest $pythonInstallerUrl -OutFile setup-python.exe
Start-Process "setup-python.exe" -argumentlist "/quiet PrependPath=1 TargetDir=C:\Python313 Include_freethreaded=1" -wait
C:\Python313\python3.13t.exe -m pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ we recommend installing a debug instance. The easiest way to accomplish this
is via `pyenv`:

```bash
pyenv install --debug --keep 3.13.0
pyenv install --debug --keep 3.13.1
```

This command will not only install a debug distribution of CPython, but also
Expand Down
51 changes: 38 additions & 13 deletions docs/installing_cpython.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,50 @@ from the python.org installers to Linux distro and Conda package managers.
??? question "As a packager, what should I name the package and interpreter?"
Please see [this guidance from the Python Steering Council](https://github.com/python/steering-council/issues/221#issuecomment-1841593283)

### python.org installers
### python.org and nuget installers

The [python.org downloads page](https://www.python.org/download/pre-releases/)
provides macOS and Windows installers that have experimental support. Note
that you have to customize the install - e.g., for Windows there is a
_Download free-threaded binaries_ checkbox under "Advanced Options".
See also the [Using Python on Windows](https://docs.python.org/3.13/using/windows.html#installing-free-threaded-binaries)
provides macOS and Windows installers that have experimental support.

Note that you have to customize the install - e.g., for Windows there is a
_Download free-threaded binaries_ checkbox under "Advanced Options". See also
the [Using Python on
Windows](https://docs.python.org/3.13/using/windows.html#installing-free-threaded-binaries)
section of the Python 3.13 docs.

Automating the process of downloading the official installers
and installing the free-threaded binaries is also possible:

=== "Windows"
On Windows, you can invoke the installer from the command-line prompt:
Due to limitations of the Windows Python.org installer, using free-threaded Python
installed from the Python.org installer may lead to trouble. In particular, if you
install both a free-threaded and gil-enabled build of Python 3.13 using the Python.org
installer, both installs will share a `site-packages` folder. This can very quickly
lead to broken environments if packages for both versions are simultaneously installed.

For that reason, we suggest using the `nuget` installer, which provides a
separate `python-freethreaded` package that does not share an installation
with the `python` package.

```powershell
$url = 'https://www.nuget.org/api/v2/package/python-freethreaded/3.13.1'
Invoke-WebRequest -Uri $url -OutFile 'python-freethreaded.3.13.1.nupkg'
Install-Package python-freethreaded -Scope CurrentUser -Source $pwd
$python_dir = (Get-Item((Get-Package -Name python-freethreaded).Source)).DirectoryName
$env:path = $python_dir + "\tools;" + $python_dir + "\tools\Scripts;" + $env:Path
```

This will only modify your Path for the current Powershell session, so you
will also need to permanently add the nuget package location to your Path to
use it after closing the current session.

If for some reason you *need* to use the Python.org installer, despite the problems
described above, you can install it like so:

```powershell
$url = 'https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe'
Invoke-WebRequest -Uri $url -OutFile 'python-3.13.0-amd64.exe'
.\python-3.13.0-amd64.exe /quiet Include_freethreaded=1
$url = 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe'
Invoke-WebRequest -Uri $url -OutFile 'python-3.13.1-amd64.exe'
.\python-3.13.1-amd64.exe /quiet Include_freethreaded=1
```

If you are running this script without administrator privileges,
Expand All @@ -53,7 +78,7 @@ and installing the free-threaded binaries is also possible:
downloaded:

```bash
curl -O https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg
curl -O https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg

# create installer choice changes to customize the install:
# enable the PythonTFramework-3.13 package
Expand All @@ -75,10 +100,10 @@ and installing the free-threaded binaries is also possible:
</plist>
EOF

sudo installer -pkg ./python-3.13.0-macos11.pkg \
sudo installer -pkg ./python-3.13.1-macos11.pkg \
-applyChoiceChangesXML ./choicechanges.plist \
-target /
rm -f python-3.13.0-macos11.pkg
rm -f python-3.13.1-macos11.pkg
```

See also [this Github issue](https://github.com/python/cpython/issues/120098)
Expand Down Expand Up @@ -207,5 +232,5 @@ build CPython using [pyenv](https://github.com/pyenv/pyenv). In order to
do that, you can use the following:

```bash
pyenv install --debug --keep 3.13.0
pyenv install --debug --keep 3.13.1
```
2 changes: 1 addition & 1 deletion docs/running-gil-disabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ python -VV
If you are using Python 3.13b1 or newer, you should see a message like:

```bash
Python 3.13.0b1+ experimental free-threading build (heads/3.13:d93c4f9, May 21 2024, 10:54:14) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Python 3.13.1 experimental free-threading build (main, Dec 10 2024, 14:07:41) [Clang 16.0.0 (clang-1600.0.26.4)]
```

To verify whether the GIL is disabled at runtime or not, you can use this in
Expand Down

0 comments on commit e205066

Please sign in to comment.