Error with make test-submission (M1 Mac)

Hi,

I’m working my way through the benchmark notebook, on my M1 MacBook Air. When I get to
!cd {PROJ_DIRECTORY} && make test-submission

I get the below output, with an error message
ImportError: libtorch_cpu.so: cannot enable executable stack as shared object requires: Invalid argument
make: *** [test-submission] Error 1

I tried googling the issue but could only find references to Windows-specific issues.

Full output from this cell below:

mkdir -p submission/
chmod -R 0777 submission/
docker run \
		-it \
		--network none \
		--mount type=bind,source="/Users/allen/proj/spacecraft_detection/spacecraft-pose-object-detection-runtime"/data,target=/code_execution/data,readonly \
		--mount type=bind,source="/Users/allen/proj/spacecraft_detection/spacecraft-pose-object-detection-runtime"/submission,target=/code_execution/submission \
		--shm-size 8g \
		--name spacecraft-pose-object-detection \
		--rm \
		61861231c974
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
+ main
+ tee /code_execution/submission/log.txt
+ cd /code_execution
+ curl --silent --connect-timeout 10 --max-time 12 www.example.com
+ data_directory=/code_execution/data
+ format_filename=/code_execution/data/submission_format.csv
+ (( i=0 ))
+ (( i<=5 ))
+ t=0
+ '[' -f /code_execution/data/submission_format.csv ']'
+ echo 'found /code_execution/data/submission_format.csv after 0 seconds; data is mounted'
found /code_execution/data/submission_format.csv after 0 seconds; data is mounted
+ break
+ '[' '!' -f /code_execution/data/submission_format.csv ']'
+ expected_filename=main.sh
++ zip -sf ./submission/submission.zip
+ submission_files='Archive contains:
  main.py
  main.sh
  yolov8n.pt
Total 3 entries (6538117 bytes)'
+ grep -q main.sh
+ echo Unpacking submission
Unpacking submission
+ unzip ./submission/submission.zip -d ./workdir
Archive:  ./submission/submission.zip
  inflating: ./workdir/main.py       
  inflating: ./workdir/main.sh       
  inflating: ./workdir/yolov8n.pt    
+ echo Printing submission contents
Printing submission contents
+ find workdir
workdir
workdir/main.py
workdir/main.sh
workdir/yolov8n.pt
+ pushd workdir
/code_execution/workdir /code_execution
+ sh main.sh
Traceback (most recent call last):
  File "/code_execution/workdir/main.py", line 10, in <module>
    from ultralytics import YOLO
  File "/opt/conda/lib/python3.11/site-packages/ultralytics/__init__.py", line 5, in <module>
    from ultralytics.data.explorer.explorer import Explorer
  File "/opt/conda/lib/python3.11/site-packages/ultralytics/data/__init__.py", line 3, in <module>
    from .base import BaseDataset
  File "/opt/conda/lib/python3.11/site-packages/ultralytics/data/base.py", line 15, in <module>
    from torch.utils.data import Dataset
  File "/opt/conda/lib/python3.11/site-packages/torch/__init__.py", line 235, in <module>
    from torch._C import *  # noqa: F403
    ^^^^^^^^^^^^^^^^^^^^^^
ImportError: libtorch_cpu.so: cannot enable executable stack as shared object requires: Invalid argument
make: *** [test-submission] Error 1

Hi @xythum, thanks for posting.

(Small note, I edited the Markdown in your post to put the output in a code block.)

Before we rule out library issues with pytorch, I noticed the warning message here:

WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Following some of the discussion on this thread, can you try rerunning that docker run command with the --platform linux/amd64 parameter added?

Hi @isms,

Thank you for pointing out the code block, I had a nagging feeling I was forgetting something!

I re-ran docker run with --platform linux/amd64 and although the warning message no longer shows up, unfortunately everything else is the same as before, with the same error at the end.

@xythum Digging further, it looks like this is a known regression on the Apple side, and a recent one (last few weeks) and was fixed recently: Rosetta emulation of amd64 version of ibm-semeru-runtimes:open-11-jdk-focal stopped working with macOS Sonoma 14.3 · Issue #7180 · docker/for-mac · GitHub

Are you able to upload to macOS Sonoma 14.3? And if you are using Docker Desktop, can you try uploading that to the latest version?

Edit to add: I suppose you could also try turning off Rosetta.