Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
170 stars 38 forks source link

install gfortran on macos #1437

Closed hainm closed 6 years ago

multiplemonomials commented 6 years ago

Sorry to butt in, but I thought it might be helpful: If you use cpptraj's CMake build system, then you do not need to supply a Fortran compiler as long as libfftw is installed.

hainm commented 6 years ago

Cool. Thanks Jamie.

Ps; i really dont know why pytraj cron builld on macos failed recently. Travis might have changed something.

Hai

On Fri, Dec 22, 2017 at 1:14 AM Jamie Smith notifications@github.com wrote:

Sorry to butt in, but I thought it might be helpful: If you use cpptraj's CMake build system, then you do not need to supply a Fortran compiler as long as libfftw is installed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Amber-MD/pytraj/pull/1437#issuecomment-353419836, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPudTudbjig923fG1ZV7vgqaajJqjOVks5tCqARgaJpZM4RJUkG .

slochower commented 6 years ago

This may be related. I'm unable to import pytraj on macOS 10.13.3 due to a libgfortran error after installing via the AmverTools conda channel.

$ python
Python 3.6.4 | packaged by conda-forge | (default, Dec 23 2017, 16:54:01)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytraj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dslochower/anaconda3/envs/paprika/lib/python3.6/site-packages/pytraj/__init__.py", line 23, in <module>
    from .utils.misc import info
  File "/Users/dslochower/anaconda3/envs/paprika/lib/python3.6/site-packages/pytraj/utils/misc.py", line 7, in <module>
    from pytraj.core.c_options import set_world_silent
  File "/Users/dslochower/anaconda3/envs/paprika/lib/python3.6/site-packages/pytraj/core/__init__.py", line 2, in <module>
    from .topology_objects import Atom, Residue, Molecule
ImportError: dlopen(/Users/dslochower/anaconda3/envs/paprika/lib/python3.6/site-packages/pytraj/core/topology_objects.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/gfortran/lib/libgfortran.3.dylib
  Referenced from: /Users/dslochower/anaconda3/envs/paprika/lib/libcpptraj.dylib
  Reason: image not found
hainm commented 6 years ago

hi @slochower, which conda channel you're using?

We have an official version here: http://ambermd.org/GetAmber.php

conda install ambertools=17 -c http://ambermd.org/downloads/ambertools/conda/

Let me know if that works for you. Cheers.

hainm commented 6 years ago

alternatively, you can install the gfortran binary version here: https://gcc.gnu.org/wiki/GFortranBinaries#MacOS

slochower commented 6 years ago

I'm using the same channel you listed. I get an error even with a new conda environment:

$ conda create -y -n pytraj-test python=3.6
$ conda install -y -n pytraj-test ambertools=17.0 -c http://ambermd.org/downloads/ambertools/conda/
$ source activate pytraj-test
$ python
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:44:09)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytraj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dslochower/anaconda3/envs/pytraj-test/lib/python3.6/site-packages/pytraj/__init__.py", line 23, in <module>
    from .utils.misc import info
  File "/Users/dslochower/anaconda3/envs/pytraj-test/lib/python3.6/site-packages/pytraj/utils/misc.py", line 7, in <module>
    from pytraj.core.c_options import set_world_silent
  File "/Users/dslochower/anaconda3/envs/pytraj-test/lib/python3.6/site-packages/pytraj/core/__init__.py", line 2, in <module>
    from .topology_objects import Atom, Residue, Molecule
ImportError: dlopen(/Users/dslochower/anaconda3/envs/pytraj-test/lib/python3.6/site-packages/pytraj/core/topology_objects.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/gfortran/lib/libgfortran.3.dylib
  Referenced from: /Users/dslochower/anaconda3/envs/pytraj-test/lib/libcpptraj.dylib
  Reason: image not found

(I also actually had to do a conda install numpy in the environment because that wasn't pulled in automatically, but everything else is pretty much verbatim).

hainm commented 6 years ago

hi, can you replace ambertools=17.0 to ambertools=17 (use exact command I sent earlier) to get the latest version? I think I made the fix after 17.0. Thanks.

$ conda install ambertools=17 -c http://ambermd.org/downloads/ambertools/conda/
Fetching package metadata .................
Solving package specifications: .

Package plan for installation in environment /Users/haichit/miniconda3:

The following NEW packages will be INSTALLED:

    ambertools: 17.6-0        http://ambermd.org/downloads/ambertools/conda

The following packages will be UPDATED:

    conda:      4.3.34-py36_0 conda-forge                                   --> 4.5.0-py36_0

Proceed ([y]/n)? n
slochower commented 6 years ago

Ah, perfect! Good catch!