I'd like to be able to install a C Compiler as some packages don't have the wheels I need. The exact tools that are needed from the massive list of visual studio build tools on windows is a lot to dig through and it takes a long time to install.
Some errors I've seen that cause this (Feel free to add others to this list!)
- libraries mkl_rt, openblas, lapack not found while...
- error: Microsoft Visual C 14.0 is required (Unable to find vcvarsall.bat)
CodePudding user response:
- First you'll need to download the visual studio build tools from https://visualstudio.microsoft.com/downloads#other
- Create a folder called win_docker_test
- Create a folder called bin in win_docker_test (win_docker_test/bin)
- Place the visual studio build tools in the bin/ directory, and rename the file to vs_buildtools.exe
- Copy this Docker file below
Dockerfile
# escape=`
# See https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile#:~:text=CMD reference.-,Escape character,-In many cases for explaining the above
from python:3.8.14-windowsservercore
# List here https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2022&preserve-view=true. We may be able to prune this list slightly!
RUN start-process -wait -filepath bin/vs_buildtools.exe -ArgumentList '--quiet --wait --norestart --nocache --installPath C:\BuildTools `
--add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
--add Microsoft.VisualStudio.Component.Windows10SDK `
--add Microsoft.VisualStudio.Component.VC.CoreIde `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.14.29.16.11.CLI.Support `
--add Microsoft.VisualStudio.ComponentGroup.UWP.VC.v142'
RUN python -m pip install --upgrade pip setuptools wheel
- Make any tweaks you'd like, run
docker build .