2

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)
visch
  • 707
  • 5
  • 23
  • That same problem comes up again every now and then. Please research! Solving it also boils down to reading the documentation, I believe, even if that documentation is a bit on the larger side. Also, btw, you're actually not asking any question! – Ulrich Eckhardt Oct 10 '22 at 19:14
  • Does this answer your question? [Error "Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)"](https://stackoverflow.com/questions/29846087/error-microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat) – Ulrich Eckhardt Oct 10 '22 at 19:16
  • @UlrichEckhardt I' not sure how to word the question to help out people like myself. I answered my own question below, there's a lot of ways to make this work but not on Docker on Windows, and there's not many sites who give you the exact component of the vsbuild tool installs that you need exactly. What do you think I should use as the question instead, sorry it's so confusing! – visch Oct 10 '22 at 19:30

1 Answers1

5
  1. First you'll need to download the visual studio build tools from https://visualstudio.microsoft.com/downloads#other
  2. Create a folder called win_docker_test
  3. Create a folder called bin in win_docker_test (win_docker_test/bin)
  4. Place the visual studio build tools in the bin/ directory, and rename the file to vs_buildtools.exe
  5. Copy this Docker file below

Dockerfile

# escape=`
# See https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile#:~:text=CMD%20reference.-,Escape%20character,-In%20many%20cases 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!

COPY bin bin

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
  1. Make any tweaks you'd like, run docker build .
kevinlinxc
  • 470
  • 5
  • 20
visch
  • 707
  • 5
  • 23