OSArch Community

Creating docker image fails from building mathutils

  1. J

    Hello there,

    I have a problem when creating a docker image especially from building the mathutils library.

    As far as I know mathutils is required for ifcopenshell.util.shape_builder.ShapeBuilder() class.

    When I run this DockerFile:

    FROM python:3.10-slim-buster
    
    WORKDIR /app
    
    COPY . /app
    
    RUN pip install -r requirements.txt

    The error is:

    Running setup.py install for mathutils: finished with status 'error'

    error: subprocess-exited-with-error

    × Running setup.py install for mathutils did not run successfully.

    error: command 'gcc' failed: No such file or directory

    note: This error originates from a subprocess, and is likely not a problem with pip.

    error: legacy-install-failure

    × Encountered error while trying to install package.

    ╰─> mathutils

    When running the DockerFile with these changes:

    FROM python:3.10-slim-buster
    
    WORKDIR /app
    
    COPY . /app
    
    RUN apt-get update && apt-get install -y gcc
    
    RUN pip install -r requirements.txt

    I get this error:

    import ifcopenshell

    File "/usr/local/lib/python3.10/site-packages/ifcopenshell/init.py", line 69, in <module>

    raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)

    ImportError: IfcOpenShell not built for 'linux/64bit/python3.10'

    Could someone help me out?

    Maybe ifcopenshell requires another base image that I am not aware of?

    ifcopenshell is mentioned in requirements.txt with ifcopenshell==0.7.0.230523

    Any help would be more then appreciated!

  2. M
  3. J

    Setting up the docker file like this seems to work:

    FROM python:3.11-slim-bullseye 
    
    WORKDIR /app
    
    COPY . /app
    
    RUN apt-get update && apt-get install -y gcc
    
    RUN pip install -r requirements.txt
    
    EXPOSE 8000
    
    CMD ["python", "main.py"]

Login or Register to reply.