Installing package on M1 Mac fails

Viewed 268

I am trying to install the package Pyssht on my M1 Mac. https://pypi.org/project/pyssht/

I am using miniconda and pip. I'm installing using

pip install pyssht --no-binary :all:

(have of course tried to use pip install pyssht) as well. When running

import pyssht

in python, I get the following error:

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/Users/username/miniforge3/lib/python3.9/site-packages/pyssht/__init__.py", line 8, in <module>
    from pyssht.cpyssht import *
ImportError: dlopen(/Users/username/miniforge3/lib/python3.9/site-packages/pyssht/cpyssht.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_fftw_destroy_plan'

I know there have been similar questions asked before, such as How to fix python `dlib` error: "symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon'"?,

but running

    pip3 install dlib --force-reinstall --no-cache-dir --global-option=build_ext

results in 

 Building wheel for cmake (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for cmake (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [13 lines of output]
            Traceback (most recent call last):
              File "/Users/username/miniforge3/bin/cmake", line 5, in <module>
                from cmake import cmake
            ModuleNotFoundError: No module named 'cmake'
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-45ax5mrr/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
                cmkr = cmaker.CMaker(cmake_executable)
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-45ax5mrr/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 141, in __init__
                self.cmake_version = get_cmake_version(self.cmake_executable)
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-45ax5mrr/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 95, in get_cmake_version
                raise SKBuildError(
            Traceback (most recent call last):
      
            Problem with the CMake installation, aborting build. CMake executable is cmake
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cmake
        Building wheel for ninja (pyproject.toml): started
        Building wheel for ninja (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for ninja (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [13 lines of output]
            Traceback (most recent call last):
              File "/Users/username/miniforge3/bin/cmake", line 5, in <module>
                from cmake import cmake
            ModuleNotFoundError: No module named 'cmake'
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-sdc7ezbh/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
                cmkr = cmaker.CMaker(cmake_executable)
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-sdc7ezbh/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 141, in __init__
                self.cmake_version = get_cmake_version(self.cmake_executable)
              File "/private/var/folders/rf/yt830zhs38q8sm2dkzzqkk840000gp/T/pip-build-env-sdc7ezbh/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 95, in get_cmake_version
                raise SKBuildError(
            Traceback (most recent call last):
      
            Problem with the CMake installation, aborting build. CMake executable is cmake
            [end of output]

I have installed, reinstalled cmake a couple of times. Trying to install the entire thing like they suggest, by

git clone https://github.com/astro-informatics/ssht.git
mkdir ssht/build && cd ssht/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -Dconan_deps=True ..
make
make install

fails at make with output

[ 45%] Built target ssht
[ 63%] Built target cmocka-static
[ 72%] Linking C executable ../bin/test_ssht
ld: warning: ignoring file /Users/username/.conan/data/fftw/3.3.9/_/_/package/46aaf8626db874d5f0f30550446bda9b5da30b4e/lib/libfftw3.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_fftw_destroy_plan", referenced from:
      _ssht_core_mw_lb_inverse_sov_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mwdirect_inverse_sov in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss_real in libssht.a(ssht_core.c.o)
      ...
  "_fftw_execute_dft", referenced from:
      _ssht_core_mw_lb_inverse_sov_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mwdirect_inverse_sov in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss_real in libssht.a(ssht_core.c.o)
      ...
  "_fftw_execute_dft_c2r", referenced from:
      _ssht_core_mw_lb_inverse_sov_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss_real in libssht.a(ssht_core.c.o)
      _ssht_core_gl_inverse_sov_real in libssht.a(ssht_core.c.o)
      _ssht_core_dh_inverse_sov_real in libssht.a(ssht_core.c.o)
  "_fftw_execute_dft_r2c", referenced from:
      _ssht_core_mw_lb_forward_sov_conv_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss_real in libssht.a(ssht_core.c.o)
      _ssht_core_gl_forward_sov_real in libssht.a(ssht_core.c.o)
      _ssht_core_dh_forward_sov_real in libssht.a(ssht_core.c.o)
  "_fftw_plan_dft_1d", referenced from:
      _ssht_core_mwdirect_inverse_sov in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss_real in libssht.a(ssht_core.c.o)
      _ssht_core_gl_inverse_sov in libssht.a(ssht_core.c.o)
      _ssht_core_gl_forward_sov in libssht.a(ssht_core.c.o)
      ...
  "_fftw_plan_dft_2d", referenced from:
      _ssht_core_mw_lb_inverse_sov_sym in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss in libssht.a(ssht_core.c.o)
  "_fftw_plan_dft_c2r_1d", referenced from:
      _ssht_core_gl_inverse_sov_real in libssht.a(ssht_core.c.o)
      _ssht_core_dh_inverse_sov_real in libssht.a(ssht_core.c.o)
  "_fftw_plan_dft_c2r_2d", referenced from:
      _ssht_core_mw_lb_inverse_sov_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_inverse_sov_sym_ss_real in libssht.a(ssht_core.c.o)
  "_fftw_plan_dft_r2c_1d", referenced from:
      _ssht_core_mw_lb_forward_sov_conv_sym_real in libssht.a(ssht_core.c.o)
      _ssht_core_mw_lb_forward_sov_conv_sym_ss_real in libssht.a(ssht_core.c.o)
      _ssht_core_gl_forward_sov_real in libssht.a(ssht_core.c.o)
      _ssht_core_dh_forward_sov_real in libssht.a(ssht_core.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_ssht] Error 1
make[1]: *** [tests/CMakeFiles/test_ssht.dir/all] Error 2
make: *** [all] Error 2

I have also tried to run the following command, as I have read it gives information that can be useful, I can't make any sense of it however.

username@computer pyssht % otool -l cpyssht.cpython-39-darwin.so
cpyssht.cpython-39-darwin.so:
Load command 0
      cmd LC_SEGMENT_64
  cmdsize 472
  segname __TEXT
   vmaddr 0x0000000000000000
   vmsize 0x0000000000114000
  fileoff 0
 filesize 1130496
  maxprot 0x00000005
 initprot 0x00000005
   nsects 5
    flags 0x0
Section
  sectname __text
   segname __TEXT
      addr 0x00000000000037b8
      size 0x000000000010af1c
    offset 14264
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0
Section
  sectname __stubs
   segname __TEXT
      addr 0x000000000010e6d4
      size 0x00000000000006cc
    offset 1107668
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x80000408
 reserved1 0 (index into indirect symbol table)
 reserved2 12 (size of stubs)
Section
  sectname __const
   segname __TEXT
      addr 0x000000000010eda0
      size 0x0000000000001e38
    offset 1109408
     align 2^4 (16)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __cstring
   segname __TEXT
      addr 0x0000000000110bd8
      size 0x0000000000003117
    offset 1117144
     align 2^0 (1)
    reloff 0
    nreloc 0
     flags 0x00000002
 reserved1 0
 reserved2 0
Section
  sectname __unwind_info
   segname __TEXT
      addr 0x0000000000113cf0
      size 0x000000000000030c
    offset 1129712
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Load command 1
      cmd LC_SEGMENT_64
  cmdsize 232
  segname __DATA_CONST
   vmaddr 0x0000000000114000
   vmsize 0x0000000000008000
  fileoff 1130496
 filesize 32768
  maxprot 0x00000003
 initprot 0x00000003
   nsects 2
    flags 0x10
Section
  sectname __got
   segname __DATA_CONST
      addr 0x0000000000114000
      size 0x0000000000000590
    offset 1130496
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000006
 reserved1 145 (index into indirect symbol table)
 reserved2 0
Section
  sectname __const
   segname __DATA_CONST
      addr 0x0000000000114590
      size 0x0000000000005110
    offset 1131920
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Load command 2
      cmd LC_SEGMENT_64
  cmdsize 312
  segname __DATA
   vmaddr 0x000000000011c000
   vmsize 0x0000000000008000
  fileoff 1163264
 filesize 16384
  maxprot 0x00000003
 initprot 0x00000003
   nsects 3
    flags 0x0
Section
  sectname __data
   segname __DATA
      addr 0x000000000011c000
      size 0x0000000000001b38
    offset 1163264
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __common
   segname __DATA
      addr 0x000000000011db38
      size 0x0000000000000004
    offset 0
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Section
  sectname __bss
   segname __DATA
      addr 0x000000000011db40
      size 0x00000000000035b8
    offset 0
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Load command 3
      cmd LC_SEGMENT_64
  cmdsize 72
  segname __LINKEDIT
   vmaddr 0x0000000000124000
   vmsize 0x0000000000010000
  fileoff 1179648
 filesize 54096
  maxprot 0x00000001
 initprot 0x00000001
   nsects 0
    flags 0x0
Load command 4
      cmd LC_DYLD_CHAINED_FIXUPS
  cmdsize 16
  dataoff 1179648
 datasize 3832
Load command 5
      cmd LC_DYLD_EXPORTS_TRIE
  cmdsize 16
  dataoff 1183480
 datasize 1776
Load command 6
     cmd LC_SYMTAB
 cmdsize 24
  symoff 1185728
   nsyms 868
  stroff 1200912
 strsize 23112
Load command 7
            cmd LC_DYSYMTAB
        cmdsize 80
      ilocalsym 0
      nlocalsym 599
     iextdefsym 599
     nextdefsym 91
      iundefsym 690
      nundefsym 178
         tocoff 0
           ntoc 0
      modtaboff 0
        nmodtab 0
   extrefsymoff 0
    nextrefsyms 0
 indirectsymoff 1199616
  nindirectsyms 323
      extreloff 0
        nextrel 0
      locreloff 0
        nlocrel 0
Load command 8
     cmd LC_UUID
 cmdsize 24
    uuid 451AF433-6B00-3279-9BBE-E5090EBF874F
Load command 9
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform 1
    minos 12.0
      sdk 12.3
   ntools 1
     tool 3
  version 764.0
Load command 10
      cmd LC_SOURCE_VERSION
  cmdsize 16
  version 0.0
Load command 11
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/lib/libSystem.B.dylib (offset 24)
   time stamp 2 Thu Jan  1 01:00:02 1970
      current version 1311.100.3
compatibility version 1.0.0
Load command 12
      cmd LC_FUNCTION_STARTS
  cmdsize 16
  dataoff 1185256
 datasize 472
Load command 13
      cmd LC_DATA_IN_CODE
  cmdsize 16
  dataoff 1185728
 datasize 0
Load command 14
      cmd LC_CODE_SIGNATURE
  cmdsize 16
  dataoff 1224032
 datasize 9712
0 Answers
Related