Skip to content
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

Build pytraj error when installing Amber22 #1618

Open
ursulap opened this issue Dec 10, 2022 · 3 comments
Open

Build pytraj error when installing Amber22 #1618

ursulap opened this issue Dec 10, 2022 · 3 comments

Comments

@ursulap
Copy link

ursulap commented Dec 10, 2022

Hello, I am new to this and I have been scooting for solutions for a few days now.
I am installing Amber 22. I am in the "make install" step. Here it got as far as 94%.

The error at step 94% is related to "Building pytraj"...

My PATH is:

/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/ATSAS/bin

I have both .zshrc and .zshr, in my home directory, and they both include the following:

export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

A little detour: I found that if I didn't direct the clang compiler to "/opt/homebrew/opt/llvm/bin", it would use the one from Apple at: "/usr/bin/", and thus give an openmp error: "clang: error: unsupported option '-fopenmp'"

It appears to me that in the 94% step of "make install" for amber22 the code looks for the apple clang compiler instead of the one from brew (see below). How do I go about solving this issue? Is this in fact the issue (it does have a "--disable-openmp" ? Thank you!!

[ 94%] Building pytraj native library
sys.argv ['setup.py', 'build', '--disable-openmp']
Original compiler envs
CXX = /usr/bin/clang++
CC = /usr/bin/clang
COMPILER =
use_pip = False, cpptraj_home =
compile_c_extension = True
2.0.6
use_prebuilt_cythonized_files = False
pytraj is inside AMBERHOME
using environment: CC=/usr/bin/clang, CXX=/usr/bin/clang++
using CC=/usr/bin/clang, CXX=/usr/bin/clang++
Final compiler envs
CXX = /usr/bin/clang++
CC = /usr/bin/clang
COMPILER =
Traceback (most recent call last):
File "/Applications/Amber/amber22_src/AmberTools/src/pytraj/setup.py", line 171, in
prepare_env_for_osx()
File "/Applications/Amber/amber22_src/AmberTools/src/pytraj/setup.py", line 165, in prepare_env_for_osx
warnings.warn("darwin_major_to_osx_map needs to be updated! Report this issue if build fails.")
NameError: name 'warnings' is not defined
make[2]: *** [AmberTools/src/pytraj/CMakeFiles/python-build/pytraj-build.stamp] Error 1
make[1]: *** [AmberTools/src/pytraj/CMakeFiles/pytraj.dir/all] Error 2
make: *** [all] Error 2

@ursulap ursulap changed the title Cannot build pytraj Build pytraj error when installing Amber22 Dec 11, 2022
@hainm
Copy link
Contributor

hainm commented Dec 11, 2022

hi @ursulap
Please edit the /Applications/Amber/amber22_src/AmberTools/src/pytraj/setup.py to add import warnings at the top. Sorry.

@dacase
Copy link

dacase commented Dec 12, 2022 via email

@ursulap
Copy link
Author

ursulap commented Dec 12, 2022

Hi, Thank you for responding!
First, I want to thank Hai since indeed adding - literally - "import warnings" at the top of the setup.py file (with no quotes in the script) in /Applications/Amber/amber22_src/AmberTools/src/pytraj/setup.py solved the issue. Right now I am running the tests. Thank you!

David, also thank you for responding and going through my crazy detour! To answer your questions (in reverse order):

Second, yes the OS is Ventura => 13

And first, yes I did try to run without the -fopenmp. The python script however had " #include <omp.h>" which then resulted in an error that such a file could not be found. If I removed this line from the script, then errors arouse too because several variables had "omp" . For example: "tid = omp_get_thread_num();"

Hopefully I am above water now and (almost) ready to run amber22....we'll see :-) If I run into a problem again I will reach out :-)

Thank you so much!!
best,
ursula

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants