bab2min / tomotopy

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

Error with headers when installing with pip #192

Closed juhopaak closed 1 year ago

juhopaak commented 1 year ago

Hi, thanks for maintaining this great package. I'm trying to install it on macOS Monterey with Python 3.10.0 and pip 22.3.1, but keep getting the following error messages. I couldn't find solutions to these errors by searching online. Any idea how they could be resolved?

pip install tomotopy   
Collecting tomotopy
  Using cached tomotopy-0.12.3.tar.gz (1.3 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from tomotopy) (1.24.1)
Building wheels for collected packages: tomotopy
  Building wheel for tomotopy (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [65 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-3.10
      creating build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/_version.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/coherence.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/__init__.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/_summary.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/utils.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/label.py -> build/lib.macosx-10.9-universal2-3.10/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'
      adding license file 'LICENSE'
      writing manifest file 'tomotopy.egg-info/SOURCES.txt'
      copying tomotopy/auto_labeling_code.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/auto_labeling_code_with_porter.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/documentation.kr.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/documentation.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      running build_ext
      building '_tomotopy' extension
      creating build/temp.macosx-10.9-universal2-3.10
      creating build/temp.macosx-10.9-universal2-3.10/src
      creating build/temp.macosx-10.9-universal2-3.10/src/python
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Iinclude -I/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/python/py_rt.cpp -o build/temp.macosx-10.9-universal2-3.10/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/14.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/14.0.0/include/cpuid.h:287:5: error: invalid output constraint '=a' in asm
          __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:252:11: note: expanded from macro '__cpuid'
              : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
                ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:302:5: error: invalid output constraint '=a' in asm
          __cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:252:11: note: expanded from macro '__cpuid'
              : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
                ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:316:5: error: invalid output constraint '=a' in asm
          __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:259: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/14.0.0/include/cpuid.h:259: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
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error

  × Running setup.py install for tomotopy did not run successfully.
  │ exit code: 1
  ╰─> [65 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-3.10
      creating build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/_version.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/coherence.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/__init__.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/_summary.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/utils.py -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/label.py -> build/lib.macosx-10.9-universal2-3.10/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'
      adding license file 'LICENSE'
      writing manifest file 'tomotopy.egg-info/SOURCES.txt'
      copying tomotopy/auto_labeling_code.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/auto_labeling_code_with_porter.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/documentation.kr.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      copying tomotopy/documentation.rst -> build/lib.macosx-10.9-universal2-3.10/tomotopy
      running build_ext
      building '_tomotopy' extension
      creating build/temp.macosx-10.9-universal2-3.10
      creating build/temp.macosx-10.9-universal2-3.10/src
      creating build/temp.macosx-10.9-universal2-3.10/src/python
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Iinclude -I/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/python/py_rt.cpp -o build/temp.macosx-10.9-universal2-3.10/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/14.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/14.0.0/include/cpuid.h:287:5: error: invalid output constraint '=a' in asm
          __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:252:11: note: expanded from macro '__cpuid'
              : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
                ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:302:5: error: invalid output constraint '=a' in asm
          __cpuid(__leaf, *__eax, *__ebx, *__ecx, *__edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:252:11: note: expanded from macro '__cpuid'
              : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
                ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:316:5: error: invalid output constraint '=a' in asm
          __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
          ^
      /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/cpuid.h:259: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/14.0.0/include/cpuid.h:259: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
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> tomotopy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Many thanks in advance for any help with the issue!

Dobatymo commented 1 year ago

Same error is it? https://github.com/bab2min/tomotopy/issues/153

juhopaak commented 1 year ago

Indeed seems to be the same, thanks and apologies for duplicating the issue! OK by me to close this one.

bab2min commented 1 year ago

@juhopaak From v0.12.4, tomotopy supports Apple Silicons. You can test it with the latest version!

juhopaak commented 1 year ago

Excellent thanks for this!