astro-informatics / ssht

Fast and exact spin spherical harmonic transforms
http://astro-informatics.github.io/ssht/
GNU General Public License v3.0
11 stars 2 forks source link

Python installation fails m1 Mac #61

Open egjansson opened 2 years ago

egjansson commented 2 years ago

Hi!

Runningpip install pyssht runs fine, but results in the error

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

Running pip install --force --upgrade numpy pyssht does not resolve the issue. Compiling package does not resolve the issue.

paddyroddy commented 2 years ago

I'm on M1 using mambaforge with python==3.9.13 and don't have this problem. I'd try creating a fresh conda environment and trying again

egjansson commented 2 years ago

Hi, I have the exact same setup. Tried a couple of times to do new condo environments, no dice. Maybe related as it seems to complain on the same symbol, the instructions for installing the C version also fails, everything runs fine until make.


(base) username@C21QAAH build % make
[  9%] Building C object src/c/CMakeFiles/ssht.dir/ssht_adjoint.c.o
[ 18%] Building C object src/c/CMakeFiles/ssht.dir/ssht_core.c.o
[ 27%] Building C object src/c/CMakeFiles/ssht.dir/ssht_dl.c.o
[ 36%] Building C object src/c/CMakeFiles/ssht.dir/ssht_sampling.c.o
[ 45%] Linking C static library ../../lib/libssht.a
[ 45%] Built target ssht
[ 54%] Building C object _deps/cmocka-build/src/CMakeFiles/cmocka-static.dir/cmocka.c.o
clang: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
[ 63%] Linking C static library libcmocka-static.a
[ 63%] Built target cmocka-static
[ 72%] Building C object tests/CMakeFiles/test_ssht.dir/test_ssht.c.o
[ 81%] Building C object tests/CMakeFiles/test_ssht.dir/utilities.c.o
[ 90%] Building C object tests/CMakeFiles/test_ssht.dir/interface.c.o
[100%] 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
paddyroddy commented 2 years ago

Mine works

image

But I've definitely encountered these annoying linker complaints on mac before (long before M1). Good luck

jasonmcewen commented 2 years ago

Hey @erikjans-cth, we're actually writing a completely new version of ssht in jax, to be released in the coming months. This will be pure python/jax so shouldn't run into these issues. I'm afraid we don't have the capacity to put further time into improving the current ssht at present since it will be superseded soon. I guess that doesn't help you at the moment but I hope the fact that there will be a new clean code in the near future is some consolidation. Watch this space!