bab2min / tomotopy

Python package of Tomoto, the Topic Modeling Tool
https://bab2min.github.io/tomotopy
MIT License
557 stars 62 forks source link

Support for Apple Silicon M1 #153

Open stephangreene opened 2 years ago

stephangreene commented 2 years ago

Is support for the M1 on the roadmap?

I get the following when trying to install on M1:

$ pip install tomotopy Collecting tomotopy Using cached tomotopy-0.12.2.tar.gz (1.1 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.11.0 in /Users/sgreene/miniforge3/lib/python3.9/site-packages (from tomotopy) (1.21.1) Building wheels for collected packages: tomotopy Building wheel for tomotopy (setup.py) ... error ERROR: Command errored out with exit status 1: command: /Users/sgreene/miniforge3/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"'; file='"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-wheel-txzeomxe cwd: /private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/ Complete output (64 lines): running bdist_wheel running build running build_py creating build creating build/lib.macosx-11.0-arm64-3.9 creating build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/_version.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/coherence.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/init.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/_summary.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/utils.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/label.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy running egg_info writing tomotopy.egg-info/PKG-INFO writing dependency_links to tomotopy.egg-info/dependency_links.txt writing requirements to tomotopy.egg-info/requires.txt writing top-level names to tomotopy.egg-info/top_level.txt reading manifest file 'tomotopy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'LICENSE.txt' writing manifest file 'tomotopy.egg-info/SOURCES.txt' copying tomotopy/auto_labeling_code.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/auto_labeling_code_with_porter.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/documentation.kr.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/documentation.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy running build_ext building '_tomotopy' extension creating build/temp.macosx-11.0-arm64-3.9 creating build/temp.macosx-11.0-arm64-3.9/src creating build/temp.macosx-11.0-arm64-3.9/src/python clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sgreene/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/sgreene/miniforge3/include -arch arm64 -Iinclude -I/Users/sgreene/miniforge3/lib/python3.9/site-packages/numpy/core/include -I/Users/sgreene/miniforge3/include/python3.9 -c src/python/py_rt.cpp -o build/temp.macosx-11.0-arm64-3.9/src/python/py_rt.o -std=c++1y -O3 -fpermissive -stdlib=libc++ -Wno-unused-variable -Wno-switch In file included from src/python/py_rt.cpp:25: /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:14:2: error: this header is for x86 only

error this header is for x86 only

^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:286:5: error: invalid output constraint '=a' in asm cpuid(leaf, eax, ebx, ecx, edx); ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro 'cpuid' : "=a"(eax), "=r" (ebx), "=c"(ecx), "=d"(edx) \ ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:301:5: error: invalid output constraint '=a' in asm cpuid(leaf, *eax, __ebx, ecx, *edx); ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro 'cpuid' : "=a"(eax), "=r" (ebx), "=c"(ecx), "=d"(edx) \ ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:315:5: error: invalid output constraint '=a' in asm cpuid_count(leaf, subleaf, __eax, ebx, *ecx, *edx); ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro 'cpuid_count' : "=a"(eax), "=r" (ebx), "=c"(ecx), "=d"(edx) \ ^ src/python/py_rt.cpp:30:34: error: invalid output constraint '=a' in asm asm volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); ^ src/python/py_rt.cpp:38:2: error: invalid output constraint '=a' in asm cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]); ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro '__cpuid_count' : "=a"(eax), "=r" (ebx), "=c"(ecx), "=d"(__edx) \ ^ 6 errors generated. error: command '/usr/bin/clang' failed with exit code 1

ERROR: Failed building wheel for tomotopy Running setup.py clean for tomotopy Failed to build tomotopy Installing collected packages: tomotopy Running setup.py install for tomotopy ... error ERROR: Command errored out with exit status 1: command: /Users/sgreene/miniforge3/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"'; file='"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-record-1njwyoak/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sgreene/miniforge3/include/python3.9/tomotopy cwd: /private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/ Complete output (64 lines): running install running build running build_py creating build creating build/lib.macosx-11.0-arm64-3.9 creating build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/_version.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/coherence.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/init.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/_summary.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/utils.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/label.py -> build/lib.macosx-11.0-arm64-3.9/tomotopy running egg_info writing tomotopy.egg-info/PKG-INFO writing dependency_links to tomotopy.egg-info/dependency_links.txt writing requirements to tomotopy.egg-info/requires.txt writing top-level names to tomotopy.egg-info/top_level.txt reading manifest file 'tomotopy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'LICENSE.txt' writing manifest file 'tomotopy.egg-info/SOURCES.txt' copying tomotopy/auto_labeling_code.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/auto_labeling_code_with_porter.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/documentation.kr.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy copying tomotopy/documentation.rst -> build/lib.macosx-11.0-arm64-3.9/tomotopy running build_ext building '_tomotopy' extension creating build/temp.macosx-11.0-arm64-3.9 creating build/temp.macosx-11.0-arm64-3.9/src creating build/temp.macosx-11.0-arm64-3.9/src/python clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sgreene/miniforge3/include -arch arm64 -fPIC -O2 -isystem /Users/sgreene/miniforge3/include -arch arm64 -Iinclude -I/Users/sgreene/miniforge3/lib/python3.9/site-packages/numpy/core/include -I/Users/sgreene/miniforge3/include/python3.9 -c src/python/py_rt.cpp -o build/temp.macosx-11.0-arm64-3.9/src/python/py_rt.o -std=c++1y -O3 -fpermissive -stdlib=libc++ -Wno-unused-variable -Wno-switch In file included from src/python/py_rt.cpp:25: /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:14:2: error: this header is for x86 only

error this header is for x86 only

 ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:286:5: error: invalid output constraint '=a' in asm
    __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro '__cpuid'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:301:5: error: invalid output constraint '=a' in asm
    __cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:251:11: note: expanded from macro '__cpuid'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:315:5: error: invalid output constraint '=a' in asm
    __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro '__cpuid_count'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
src/python/py_rt.cpp:30:34: error: invalid output constraint '=a' in asm
        __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
                                        ^
src/python/py_rt.cpp:38:2: error: invalid output constraint '=a' in asm
        __cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
        ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/cpuid.h:258:11: note: expanded from macro '__cpuid_count'
        : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
          ^
6 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------

ERROR: Command errored out with exit status 1: /Users/sgreene/miniforge3/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"'; file='"'"'/private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-install-zbbc7pzy/tomotopy_f5103692bba0430b98d4e4f5cb2eacdf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/11/29tzm_tx4cd3p3rprtfq9kmc0000gn/T/pip-record-1njwyoak/install-record.txt --single-version-externally-managed --compile --install-headers /Users/sgreene/miniforge3/include/python3.9/tomotopy Check the logs for full command output.

bab2min commented 2 years ago

Hi @stephangreene , Currently, tomotopy don't support Apple Silicon M1. I am working on M1 support, but this may takes some time. Please use Rosetta until M1 is fully supported.

stephangreene commented 2 years ago

Thanks @bab2min I appreciate the effort on this. Look forward to trying it out when ready.

jsigman commented 1 year ago

Same here, thanks @bab2min

steven-solomon commented 1 year ago

@bab2min, how can I help add M1 support?

bab2min commented 1 year ago

@stephangreene @steven-solomon @jsigman Finally, I got a new mac with M1 chip and fixed the error. You can install tomotopy v0.12.4 at macOS with Apple Silicon.