Skip to content

Blazor WASM build unable to find python in $PATH on CBL Mariner 2.0 with .NET 6 #98714

Closed

Description

@lbussell

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The emsdk fails to build the blazorwasm template using the wasm-tools workload on CBL Mariner 2.0 and .NET 6.0 because it cannot find python on the $PATH.

Expected Behavior

The build is successful.

Steps To Reproduce

Build the following Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:6.0-cbl-mariner2.0

ARG TARGETARCH

WORKDIR /source

RUN . /etc/os-release \
    && case $ID in \
        alpine) apk add --no-cache python3 ;; \
        debian | ubuntu) apt-get update \
            && apt-get install -y --no-install-recommends python3 \
            && rm -rf /var/lib/apt/lists/* ;; \
        mariner) tdnf install -y python3 \
            && tdnf clean all ;; \
        esac \
    && dotnet workload install --skip-manifest-update wasm-tools

RUN dotnet new blazorwasm -o app --no-restore

WORKDIR /source/app

RUN dotnet restore -r linux-x64

RUN dotnet build --no-restore

RUN dotnet publish -r linux-x64 -c Release --self-contained true -o out

Try out 7.0/8.0 in the FROM instruction and see that it works for .NET versions > 6.0. Other operating systems also work with this Dockerfile.

Exceptions (if any)

The error presents as an issue with emcc:

/usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.5/Sdk/WasmApp.Native.targets(429,5): error MSB3073: The command "emcc --version" exited with code 1. [/source/app/app.csproj]

Enabling diagnostic output then reveals the actual error:

emcc --version (TaskId:227)
unable to find python in $PATH (TaskId:227)

python3 is installed on Mariner 2.0. Other distros alias python > python3, but not Mariner 2.0. I am guessing this is a fix that didn't get backported to .NET 6.0?

.NET Version

SDK 6.0.418, Runtime 6.0.26

Anything else?

I also found this similar PR: dotnet/emsdk#19

Activity

  1. assigned and unassigned on Jan 18, 2024
  2. wtgodbe commented on Jan 30, 2024

    @wtgodbe
    Member

    Looks like this should be moved to emsdk

  3. wtgodbe commented on Jan 30, 2024

    @wtgodbe
    Member

    @radical who owns EMSDK these days?

  4. radical commented on Jan 30, 2024

    @radical
    Member
  5. transferred this issue fromdotnet/aspnetcoreon Feb 20, 2024
  6. ghost added
    needs-area-label
    on Feb 20, 2024
  7. ghost added
    untriaged
    on Feb 20, 2024
  8. wtgodbe commented on Feb 20, 2024

    @wtgodbe
    Member

    Moved to runtime as that's closer to EMSDK than aspnetcore is

  9. added
    arch-wasm
    on Feb 21, 2024
  10. removed
    needs-area-label
    on Feb 26, 2024
  11. removed
    untriaged
    on Apr 1, 2024
  12. added this to the 9.0.0 milestone on Apr 1, 2024
  13. lewing commented on Apr 1, 2024

    @lewing
    Member

    On linux we use the system python and do not package our own so you will need to install python in your image. @maraf we should add a more descriptive error message for this case.

  14. lbussell commented on Apr 1, 2024

    @lbussell
    MemberAuthor

    @lewing Python is installed. Blazor WASM fails to find the system python because Mariner doesn't alias python -> python3 like most other distros. .NET 7+ does not have this issue.

  15. added
    in-pr
    on Jun 25, 2024
  16. akoeplinger commented on Jun 28, 2024

    @akoeplinger
    Member

    The issue is we fail to detect python3 because the which command isn't installed in the image, adding tdnf install -y which fixes that.

    This was fixed upstream by emscripten-core/emscripten#15071 hence why it works with .NET7+ since we ship a newer emscripten version.

  17. added
    needs-author-action
    on Jun 28, 2024
  18. dotnet-policy-service commented on Jun 28, 2024

    @dotnet-policy-service
    Contributor

    This issue has been marked needs-author-action and may be missing some important information.

  19. akoeplinger commented on Jun 28, 2024

    @akoeplinger
    Member

    We cannot easily fix this for for 6.0 since we didn't build emscripten from source back then.

    Most Linux distros come with which installed by default and for those that don't installing the which package is an easy workaround, so I don't think it meets the servicing bar for 6.0.

  20. moved this from Tracking to Done in .NET Dockeron Jun 28, 2024
  21. locked and limited conversation to collaborators on Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-Setupin-prneeds-author-action

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions