-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help installing NaMaster on M2 macOS #173
Comments
Possibly too late to be helpful (except for others having the same problem): I also fought a long fight to get it installed on my Apple Silicon Mac (with an M1 CPU in my case). The solution I found in the end was to uninstall all my Python stuff and reinstall it using x86_64 binaries. Since macOS comes with a tool for automatically translating x86 binaries to work on ARM CPUs, things can still run. It's a LOT easier to install things assuming an x86 architecture, since most packages come with pre-compiled binaries. I was able to install NaMaster and all dependencies with x86 binaries, and they run fine on my Macbook. |
I have managed to get NaMaster installed from source on both an M2 and M1 Mac, compiled for arm (x86 should only be used as a last resort!).
There are a few warning along the way (e.g., mismatches between versions of libraries and headers) but everything seems to work: both For what it's worth, I can't seem to get a compilation with The following has been superseded by the next comment. We should probably figure out a way to get pip to run successfully for this case, as I understand that using setuptools in this way is being deprecated. |
Following up, I think we can use pip by adding a file
and then running
(You can also use |
A note that @defjaf's recipe below was super helpful for me getting up and running. I would add to use homebrew python and not the Mac default. My final install command was
|
Hi, I'm trying to install PyMaster on an M3 Mac. It's taken a few days so far, so I'm interested to follow the above. I started using macports, but moved to brew, partly as I was struggling to install pyfftw (linking libraries) and was hoping that by getting that in hand this would also fall in to place.). I followed the above exactly, using
I notice that it states
so CFITSIO, GSL, HEALPix and FFTW are present. This is on branch Note I'm working within a venv linked to python3.11 sourced from brew. If I try instead to use
Any help massively appreciated: I've run out of expertise :) |
@ChristopherAJDuncan this line tells me you may be missing autotools
Can you try installing that (not sure if that's through homebrew on Mac)? Let me know if that doesn't work. |
Thanks as always @damonge. I think autotools are present. Certainly I can run |
ok, strange... Can you run |
Hmm, ok some progress. I did I switched to
/opt/local/lib is the directory for macports which I've deprecated, so I wonder If there was an issue due to it not being a clean install. Are there any steps required to ensure a clean reinstall? I deleted everything in _deps for example. EDIT: it's a healpy issue, I can't import haply itself. I'll try and work on this and get back to you. Thanks |
ok, the issue seems to be |
Thanks @damonge, now have a working version (at least import-able, but that's enough for tonight). For reference, I did
as well as the steps mentioned by @defjaf above. I also completely deleted macports (not sure if that was really necessary but no harm in it), and since I found that I had an error on healpy I reinstalled that using This was on I owe you a beer etc next time I see you :) |
OK, great. We merged |
I went through installation of the code today for a brand new Apple M3 Pro today with clang compilers from Xcode and the latest OS version (14.3.1). Nothing else was installed on the laptop (e.g. macports etc). Here's a summary of my adventure hoping it will be useful to others. Problem
Solution / workaround
I am not sure if all the problems are connected to the clang specific compiler OR by the new architecture OR by the specific python version. Any insight/suggestion appreciated but this was a relatively clean and simple work around. |
@gfabbian This workaround solution was very helpful. My steps:
|
Note, perhaps only to myself. To compile the most recent 2.0 version, on my M1 Mac Studio with homebrew gcc-14 and Python.org python 3.12.3, I encountered link errors like
This was fixed following some info buried here by setting
Is anyone else seeing this and/or have a better solution? |
@defjaf and others: have you tried installing this latest version of namaster from conda (it was uploaded yesterday). It'd be really good to know if these issues are gone. |
Another data point from today: initially I was also having issues by trying to install namaster from pip in my M1 Macbook. But using conda got around the issue. I will point out though that by default if do |
Hello everyone. I have been trying to install NaMaster on my M2 Mac for a while now but unfortunately I've had no luck completing the installation.
I have been trying to do it manually so I have cloned the NaMaster repository to my home directory.
I have already installed cfitsio and it is located in the following directory /Users/el/cfitsio
When running
python setup.py install
, after activating a separate virtual environment (called tensorflow2) I get the following error output:running install
/Users/el/miniconda3/envs/tensorflow2/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/Users/el/miniconda3/envs/tensorflow2/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
writing pymaster.egg-info/PKG-INFO
writing dependency_links to pymaster.egg-info/dependency_links.txt
writing top-level names to pymaster.egg-info/top_level.txt
reading manifest file 'pymaster.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'ar-lib'
warning: no files found matching 'compile'
warning: no files found matching 'config.guess'
warning: no files found matching 'config.h.in'
warning: no files found matching 'config.sub'
warning: no files found matching 'configure'
warning: no files found matching 'depcomp'
warning: no files found matching 'install-sh'
warning: no files found matching 'Makefile.in'
warning: no files found matching 'missing'
adding license file 'LICENSE'
writing manifest file 'pymaster.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-11.0-arm64/egg
running install_lib
running build_py
Found automake.
Makefile.am:3: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:3: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:3: to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:3: If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:3: its definition is in aclocal's search path.
autoreconf: error: automake failed with exit status: 1
Using -march=native. Binary will not be portable.
configure: WARNING: unrecognized options: --enable-shared, --with-pic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in
/Users/el/NaMaster/_deps/libsharp2': configure: error: C compiler cannot create executables See
config.log' for more detailsmake: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
cp: directory ../include/libsharp2 does not exist
Darwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... arm-apple-darwin21.6.0
checking host system type... arm-apple-darwin21.6.0
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert arm-apple-darwin21.6.0 file names to arm-apple-darwin21.6.0 format... func_convert_file_noop
checking how to convert arm-apple-darwin21.6.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin21.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for gcc option to accept ISO C99... none needed
checking for pkg-config... no
checking for CFITSIO... no
checking for ffgnrwll in -lcfitsio... no
configure: error: could not find the cfitsio library
ERROR: failed to configure HEALPix. Check CFITSIO is installed and reachable.
error: Failed to install libchealpix.
I have manually updated the path to my cfitsio installation in the install_libchealpix.sh file but the error seems to occur on line 16, which is before that.
I saw from a previous post that running libtoolize in the NaMaster directory might help but I get the following output:
libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize: '/usr/local/share/aclocal/libtool.m4'
libtoolize: '/usr/local/share/aclocal/ltoptions.m4'
libtoolize: '/usr/local/share/aclocal/ltsugar.m4'
libtoolize: '/usr/local/share/aclocal/ltversion.m4'
libtoolize: '/usr/local/share/aclocal/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
As I am relatively new to manually building libraries on a macOS, any help will be appreciated.
The text was updated successfully, but these errors were encountered: