2023-10-27: Updated to use pipx and now manual PATH fiddling.
I was trying to set up a Windows-native Python development environment with Poetry. Since Microsoft is doing a lot of Python extensions for VSCode I expected this to be a breeze. Well… there are some stumbling blocks along the way. Anyway, here’s how I got everything up and running.
Install Python itself
Open Windows Terminal and enter:
winget install -e --id Python.Python.3.12 --scope machine
Now it’s time to install
pipx installs Python applications into separate environments and keeps your global Python environment clean.
In the terminal enter:
python -m pip install --user pipx
During the installation you most probably will see warnings like this:
WARNING: The script pipx.exe is installed in `C:\Users\YOUR_USERNAME\AppData\Roaming\Python\Python312\Scripts` which is not on PATH
To fix this go into this folder and execute
pipx directly in order for
pipx to add this folder automatically to the PATH:
On ARM64 I encountered a problem when I tried to install Poetry. Apparently there are no binary versions von msgpack for ARM64, which is a dependency of Poetry. So pip tried to build msgpack from source. This failed because there was no C++ compiler installed. Fortunately the error message told me how to install one.
Get Microsoft C++ Build Tools at https://visualstudio.microsoft.com/visual-cpp-build-tools/ and install.
Select Desktop development with C++. Then click on individual components at the top and search for MSVC and select VS 2022 C++ ARM64/ARM64EC Spectre mitigated libraries (newest version). Then click install.
Now it’s finally time to install Poetry. In the terminal enter:
pipx install poetry
The installation should run without any errors now. After the installation you should be able to just enter
poetry and get this help message: