dwgoon / jpegio

A python package for accessing the internal variables of JPEG file format such as DCT coefficients and quantization tables
Apache License 2.0
73 stars 18 forks source link

Unable to install on macOS Sonoma M3 apple Silicon Chip #31

Open JTZ18 opened 9 months ago

JTZ18 commented 9 months ago

Hi, I think your default setup.py ends up in errors for installation on an apple silicon chip. I am running a Linux dev container on vscode on my m3 Mac.

The following was a log output when running pip install jpegio

Collecting jpegio Using cached jpegio-0.2.8.tar.gz (73.5 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: jpegio Building wheel for jpegio (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for jpegio (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [72 lines of output] DIR_LIBJPEGHEADER: /tmp/pip-install-hcvihhk/jpegio_ddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/include DIR_LIBJPEGSOURCE: /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdapistd.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdarith.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcmarker.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcprepct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcmaster.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jaricom.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jquant2.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jfdctint.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdcoefct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdatadst.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcarith.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jctrans.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jmemmgr.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdhuff.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jidctfst.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdmarker.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jidctint.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jccoefct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jmemnobs.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdcolor.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcapimin.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jerror.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jfdctfst.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdsample.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdapimin.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jddctmgr.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jutils.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jfdctflt.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdtrans.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcinit.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jccolor.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcomapi.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdatasrc.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdpostct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdmainct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcsample.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdmerge.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdmaster.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jchuff.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcparam.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcmainct.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jidctflt.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jquant1.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcdctmgr.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jcapistd.c [LIBJPEG] /tmp/pip-install-hcvihhk/jpegio_ddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/src/jdinput.c running bdist_wheel running build running build_py creating build creating build/lib.linux-aarch64-cpython-39 creating build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/io.py -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/flags.py -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/init.py -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/decompressedjpeg.pxd -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/componentinfo.pxd -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/clibjpeg.pxd -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/jstruct.pxd -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/componentinfo.pyx -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/decompressedjpeg.pyx -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/mat2D.h -> build/lib.linux-aarch64-cpython-39/jpegio copying jpegio/jstruct.h -> build/lib.linux-aarch64-cpython-39/jpegio running buildext building 'jpegio.componentinfo' extension creating build/temp.linux-aarch64-cpython-39 creating build/temp.linux-aarch64-cpython-39/jpegio gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I/tmp/pip-build-env-f9516bc8/overlay/lib/python3.9/site-packages/numpy/core/include -I/tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80 -I/tmp/pip-install-hcvihhk/jpegioddcbb810d5a64d05a44b5afe49185c80/jpegio/libjpeg/include -I/tmp/pip-install-hcvihhk/jpegio_ddcbb810d5a64d05a44b5afe49185c80/jpegio -I/usr/local/include/python3.9 -c jpegio/componentinfo.cpp -o build/temp.linux-aarch64-cpython-39/jpegio/componentinfo.o -w -fPIC -m64 gcc: error: unrecognized command-line option ‘-m64’ error: command '/usr/bin/gcc' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for jpegio Failed to build jpegio ERROR: Could not build wheels for jpegio, which is required to install pyproject.toml-based projects

From the error message I suspected it was due to the additional argument for -m64 which traces back to the 64bit architecture detection in your setup.py

I tried to clone your repo and edit the setup.py such that -m64 was not used as an extra compiler argument. I tried making my own wheel which it successfully did compile this whl

jpegio-0.2.4-cp39-cp39-linux_aarch64.whl

however even after running a pip install dist/jpegio-0.2.4-cp39-cp39-linux_aarch64.whl of my wheel, upon running import jpegio, I get the >>> import jpegio Traceback (most recent call last): File "", line 1, in File "/workspaces/jpegio/jpegio/init.py", line 7, in from .componentinfo import ComponentInfo ModuleNotFoundError: No module named 'jpegio.componentinfo'

I suspect this is due to the jpegio version 0.2.4 that it is building for me in the manual setup.py perhaps if I had the 0.2.8 version for the manual setup.py it would probably work