是否有Windows docker映像可在其上构建python 3平台轮子?

问题描述 投票:-1回答:1

我试图找出是否存在任何可以构建python平台轮的Windows docker / OCI映像,这种映像可以解决此错误:

Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

[当Windows安装未安装Visual Studio构建工具时,会发出此错误,但是,我找不到预装有所需的buildtools来制造python wheel的任何docker映像。

主要用例可以是CI,也可以是隔离/确定的构建。

我知道Microsoft开发人员博客上有一个子句,这些图像必须从本地下载的VS安装本地生成,但是老实说,我不想相信不允许存在具有这些图像的图像(非常重要)尚未预装的工具,即使每个人都可以免费下载包含这些工具的VS版本。

python windows docker python-wheel
1个回答
0
投票

在这上面碰碰。我无法建立docker映像并说cytoolz安装正确。这是我的dockerfile:

# escape=`

# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM python:3.7.7-windowsservercore-1809
ADD . /
ADD pip.conf C:/ProgramData/pip/pip.ini


# Reset the shell.
SHELL ["cmd", "/S", "/C"]

#VS build tools
# Set up environment to collect install errors.
COPY Install.cmd C:\TEMP\
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe

# Install Node.js LTS
ADD https://nodejs.org/dist/v8.11.3/node-v8.11.3-x64.msi C:\TEMP\node-install.msi
RUN start /w msiexec.exe /i C:\TEMP\node-install.msi /l*vx "%TEMP%\MSI-node-install.log" /qn ADDLOCAL=ALL

ARG RELEASE=16
# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/${RELEASE}/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman

# Download and install Build Tools for Visual Studio 2017.
ADD https://aka.ms/vs/${RELEASE}/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN start /w C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
#RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
    --channelUri C:\TEMP\VisualStudio.chman `
    --installChannelUri C:\TEMP\VisualStudio.chman `
    #--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools `
    #--add Microsoft.Net.Component.3.5.DeveloperTools `
    #--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools `
    #--add Microsoft.Net.ComponentGroup.TargetingPacks.Common `
    #--add Microsoft.VisualStudio.Component.TestTools.BuildTools `
    #--add Microsoft.VisualStudio.Workload.VCTools `
    #--add Microsoft.VisualStudio.Component.VC.140 `
    #--add Microsoft.VisualStudio.Component.VC.ATL `
    #--add Microsoft.VisualStudio.Component.VC.CLI.Support `
    #--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop `
    #--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP `
    #--add Microsoft.VisualStudio.Workload.NodeBuildTools `
    #--add Microsoft.VisualStudio.Component.TypeScript.2.8 `
    #--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 `
    #--add Microsoft.VisualStudio.Component.VC.CoreBuildTools `
    #--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
    #--add Microsoft.VisualStudio.Component.VC.14.20.x86.x64`
    #--add VisualStudio.Component.VC.CoreBuildTools `
    #--add Microsoft.VisualStudio.Workload.MSBuildTools `
    #--add Microsoft.VisualStudio.Workload.UniversalBuildTools `
    --add Microsoft.VisualStudio.Workload.VCTools `
    --add Microsoft.VisualStudio.Component.TestTools.BuildTools `
    --add Microsoft.VisualStudio.Component.VC.ASAN `
    --add Microsoft.VisualStudio.Component.VC.CMake.Project `
    --add Microsoft.VisualStudio.Component.Windows10SDK.18362 `
    #--add Microsoft.VisualStudio.Component.VC.CMake.Project `
    #--add Microsoft.VisualStudio.Workload.UniversalBuildTools `
    #--includeRecommended `
    #--includeOptional `
    --installPath C:\BuildTools

ADD https://aka.ms/vs/${RELEASE}/release/vc_redist.x64.exe C:\TEMP\vc_redist.exe

RUN start /w C:\TEMP\vc_redist.exe /install /quiet /norestart
RUN start /w C:\TEMP\vc_redist.exe /install /quiet /norestart

ENV MSBuildBinPath C:\BuildTools\MSBuild\15.0\Bin\
ENV MSBuildExtensionsPath C:\BuildTools\
ENV MSBuildExtensionsPath32 C:\BuildTools\

RUN pip install setuptools==45
RUN pip install Cython
RUN pip install numpy
RUN pip install cytoolz==0.10.0

此事物死于:

   copying cytoolz\tests\test_tlz.py -> build\lib.win-amd64-3.7\cytoolz\tests
    copying cytoolz\tests\test_utils.py -> build\lib.win-amd64-3.7\cytoolz\tests
    running build_ext
    building 'cytoolz.dicttoolz' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\pip-install-43schp5v\\cytoolz\\setup.py'"'"'; __file__='"'"'C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\pip-install-43schp5v\\cytoolz\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ContainerAdministrator\AppData\Local\Temp\pip-record-nf84wocc\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\Include\cytoolz' Check the logs for full command output.
The command 'cmd /S /C pip install cytoolz==0.10.0' returned a non-zero code: 1
© www.soinside.com 2019 - 2024. All rights reserved.