nomad-coe / nomad

NOMAD lets you manage and share your materials science data in a way that makes it truly useful to you, your group, and the community.
https://nomad-lab.eu
Apache License 2.0
64 stars 14 forks source link

Install of development version on MacOS #22

Closed aschleife closed 1 year ago

aschleife commented 2 years ago

When running:

pip install -e .[all] --prefer-binary

I get:

Failed to build mdtraj ERROR: Could not build wheels for mdtraj which use PEP 517 and cannot be installed directly

Do you guys have any tips on how to fix this?

markus1978 commented 2 years ago

MDTraj is one of the packages that needs compiling. It is based on some kind of C/C++ parts and the developers do not provide a binary build. If you try to pip install mdraj you probably get some more error output with concrete compile errors and stuff.

On MacOS it typically comes down to installing xcode with command line tools. Try to get a concrete error and stackoverflow typically has some help for you.

aschleife commented 2 years ago

I completely agree with your assessment that it has to do with Xcode and CommandLineTools. Are there recommended versions for Catalina and for BigSur? I have both installed on both versions of the OS and use them successfully with MacPorts, but apparently I still get "clang" errors.

Example for the error on Catalina:

building 'phonopy._phonopy' extension creating build/temp.macosx-10.14.6-x86_64-3.8 creating build/temp.macosx-10.14.6-x86_64-3.8/c clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Ic -I/private/tmp/pip-build-env-awqy5sc4/overlay/lib/python3.8/site-packages/numpy/core/include -I/Volumes/SchleifeStorage/User/schleife/nomadtest/.pyenv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c c/_phonopy.c -o build/temp.macosx-10.14.6-x86_64-3.8/c/_phonopy.o In file included from c/_phonopy.c:35: In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:11: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/limits.h:21: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/limits.h:63: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture

error Unsupported architecture

markus1978 commented 2 years ago

One hint that I could find is that -arch arm64 -arch x86_64 seem to show that pip "is trying to build universal binaries for arm" with a x86 sdk (-o build/temp.macosx-10.14.6-x86_64-3.8/c/_phonopy.o). The system's Python installation might be at fault and a manually installed homebrew version is supposed to do the trick: https://github.com/python-greenlet/greenlet/issues/181#issuecomment-698165647

But I am just copying "random" stuff from the internet. Did not experience that particular problem myself.

aschleife commented 2 years ago

Perfect, that tip helped - I think I successfully switched to the MacPorts python38 version. This gets me past the error above, but gives me (both with and without --prefer-binaries):

ERROR: Could not find a version that satisfies the requirement nomad-dos-fingerprints; extra == "all" (from nomad-lab[all]) (from versions: none) ERROR: No matching distribution found for nomad-dos-fingerprints; extra == "all"

Hope you dont mind me pestering you once again :) Any ideas?

markus1978 commented 2 years ago

That is one of our own. Should have been installed with the ./dependencies.sh -e step. Make sure that the "fingerprint" submodule is cloned and install it directly:

git submodule sync
git submodule update --init
cd dependencies/nomad-dos-fingerprints
pip install -e .

Then repeat the pip install -e .[all] from the root directory.

markus1978 commented 1 year ago

This issue went stale and I am closing it.

Current developers documentation works on Mac computers with recent MacOS versions and Python 3.9. There are instructions for Apple silicon as well (i.e. you have to install an intel-based Python).