Skip to content

segfault in docker when used with torch and matplotlib #381

Closed
@ppwwyyxx

Description

@ppwwyyxx

Steps to reproduce

╰─$cat Dockerfile
FROM centos/python-36-centos7
USER root
WORKDIR /root
RUN yum update -y
RUN pip install --upgrade pip
RUN pip install opencv-python
RUN pip install -U matplotlib
RUN pip install torch==1.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
COPY a.py /root/a.py
RUN python -X faulthandler a.py

╰─$cat a.py
import torch
try:
    import cv2
except:
    pass
import matplotlib.pyplot as plt

╰─$docker build   -t test:v0 .      

..................
Step 10/10 : RUN python -X faulthandler a.py
 ---> Running in 1b7bc36c9727
Fatal Python error: Segmentation fault

Thread 0x00007f185a430740 (most recent call first):
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/json/encoder.py", line 356 in _iterencode_dict
The command '/bin/sh -c python -X faulthandler a.py' returned a non-zero code: 139

It works if I use opencv-python-headless instead.

Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions