chanzuckerberg / cellxgene-census

CZ CELLxGENE Discover Census
https://chanzuckerberg.github.io/cellxgene-census/
MIT License
76 stars 20 forks source link

"Illegal Instruction" Error When Running Python Script in Docker Container #1057

Closed ubyndr closed 5 months ago

ubyndr commented 5 months ago

Describe the Bug

When running a Python script (test.py) within a Docker container built from homebrew/brew:latest and using Python 3.10 installed via Homebrew, the script exits with an "Illegal instruction" error. This issue occurs when attempting to use the cellxgene_census library version 1.11.1, installed via pip. The exact cause of the illegal instruction is unclear, as the script does not successfully execute to completion.

To Reproduce

Steps to reproduce the behavior:

test.py content;

import cellxgene_census

cellxgene_census.download_source_h5ad("a5d5c529-8a1f-40b5-bda3-35208970070d",
                                      to_path="./a5d5c529-8a1f-40b5-bda3-35208970070d.h5ad")
  1. Create a Dockerfile with the following content:

    FROM homebrew/brew:latest
    
    RUN brew install python@3.10
    
    ENV PATH="/home/linuxbrew/.linuxbrew/opt/python@3.10/bin:$PATH"
    
    RUN python3.10 -m pip install --upgrade pip
    
    RUN python3.10 -m pip install cellxgene_census==1.11.1
    
    WORKDIR /home/app
    
    COPY test.py ./
    
    CMD ["tail", "-f", "/dev/null"]
  2. Build the Docker container:

    docker buildx build --platform linux/arm64/v8 -t cellxgene_census_bug . --load
  3. Run the container:

    docker run -it cellxgene_census_bug
  4. Attempt to execute test.py within the container:

    python3.10 test.py

Expected Behavior

The script test.py should execute to completion without encountering an "Illegal instruction" error. Expected behavior depends on the script's functionality but generally includes successful completion of tasks without crashing.

Environment

Host:

Container:

Package Version
aiobotocore 2.12.1
aiohttp 3.9.3
aioitertools 0.11.0
aiosignal 1.3.1
anndata 0.10.6
array_api_compat 1.4.1
async-timeout 4.0.3
attrs 23.2.0
botocore 1.34.51
cellxgene-census 1.11.1
certifi 2024.2.2
charset-normalizer 3.3.2
contourpy 1.2.0
cycler 0.12.1
exceptiongroup 1.2.0
fonttools 4.50.0
frozenlist 1.4.1
fsspec 2024.3.0
h5py 3.10.0
idna 3.6
jmespath 1.0.1
joblib 1.3.2
kiwisolver 1.4.5
llvmlite 0.42.0
matplotlib 3.8.3
multidict 6.0.5
natsort 8.4.0
networkx 3.2.1
numba 0.59.0
numpy 1.26.4
packaging 24.0
pandas 2.2.1
patsy 0.5.6
pillow 10.2.0
pip 24.0
pyarrow 15.0.1
pyarrow-hotfix 0.6
pynndescent 0.5.11
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
requests 2.31.0
s3fs 2024.3.0
scanpy 1.9.8
scikit-learn 1.4.1.post1
scipy 1.12.0
seaborn 0.13.2
session-info 1.0.0
setuptools 68.2.2
six 1.16.0
somacore 1.0.8
statsmodels 0.14.1
stdlib-list 0.10.0
threadpoolctl 3.3.0
tiledb 0.26.3
tiledbsoma 1.8.0
tqdm 4.66.2
typing_extensions 4.10.0
tzdata 2024.1
umap-learn 0.5.5
urllib3 2.0.7
wheel 0.41.3
wrapt 1.16.0
yarl 1.9.4

Additional Context

The issue seems related to executing Python code within the Docker container environment set up with Homebrew's Python 3.10. Identifying the instruction causing the illegal instruction error or a more specific scenario within test.py that triggers the error would require further debugging tools not accessible due to the nature of the crash.