civisanalytics / python-glmnet

A python port of the glmnet package for fitting generalized linear models via penalized maximum likelihood.
Other
262 stars 59 forks source link

Failed to find libgfortran.3.dylib #45

Closed Karrenbelt closed 5 years ago

Karrenbelt commented 5 years ago

I run into an error when trying to pip install glmnet, which I wanted to share with you. I’m using macOS High Siera (10.13.6). The output I receive you find underneath. I also ran a locate to see if I could find the dynamic library, which I did, and also attached the output displaying this result. In case you can tell me how to resolve this, I would appreciate that.

Sincerely, Michiel

(venv) Zarathustra:allosteric-inference-master Zarathustra$ pip3 install glmnet
Collecting glmnet
  Using cached https://files.pythonhosted.org/packages/c7/97/6f92f20fc193478c5d5927396c8d691abbdaa7774fd67e8a08fdeb1a2470/glmnet-2.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/tq/yhb6dsx952l1wcmx5qnxp0940000gn/T/pip-install-u44dd773/glmnet/setup.py", line 38, in <module>
        GFORTRAN_LIB = get_lib_dir('libgfortran.3.dylib')
      File "/private/var/folders/tq/yhb6dsx952l1wcmx5qnxp0940000gn/T/pip-install-u44dd773/glmnet/setup.py", line 30, in get_lib_dir
        raise Exception("Failed to find {}".format(dylib))
    Exception: Failed to find libgfortran.3.dylib

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/tq/yhb6dsx952l1wcmx5qnxp0940000gn/T/pip-install-u44dd773/glmnet/
(venv) Zarathustra:allosteric-inference-master Zarathustra$ locate libgfortran.3.dylib
/Applications/MATLAB_R2017b.app/sys/os/maci64/libgfortran.3.dylib
/Applications/Tellurium.app/Contents/Resources/telocal/python-3.6.3/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libgfortran.3.dylib
/Users/Zarathustra/ETH/git_repo/allosteric-inference-master/venv/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
/Users/Zarathustra/ETH/repositories/allosteric-inference-master/python_server/tutorial/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
/Users/Zarathustra/ETH/repositories/allosteric-inference-master/venv/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
/Users/Zarathustra/ETH/repositories/allosteric-inference-master/venv/python_server/tutorial/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
/Users/Zarathustra/miniconda2/lib/libgfortran.3.dylib
/Users/Zarathustra/miniconda2/pkgs/libgfortran-3.0.1-h93005f0_2/lib/libgfortran.3.dylib
/Users/Zarathustra/miniconda3/lib/libgfortran.3.dylib
/Users/Zarathustra/miniconda3/pkgs/libgfortran-3.0.1-h93005f0_2/lib/libgfortran.3.dylib
/usr/local/lib/python3.6/site-packages/scipy/.dylibs/libgfortran.3.dylib
stephen-hoover commented 5 years ago

Hi @Karrenbelt . It looks like you've used conda to install libgfortran at some point. Are you running the pip install from inside a conda environment which has libgfortran installed? Another option is that you can install with conda instead of with pip. Try conda install -c conda-forge glmnet.

stephen-hoover commented 5 years ago

@Karrenbelt , did you manage to resolve this?

Karrenbelt commented 5 years ago

Thanks for following up, yes I did. I don't like anaconda myself, so I don't use it. gfortran is part of gcc nowadays. When I tried to to use gcc, I got another error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: Failure while executing; `git config --local --replace-all homebrew.private true` exited with 1.

Leading to the solution: https://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/ After running the recommended xcode-select --install, I brew installed gcc and pip3 installed the package (abcpy) that required glmnet

stephen-hoover commented 5 years ago

Thank you for the report. Do you think there need to be any changes in the setup.py, or shall I close this issue? The package still builds okay for me on OS X 10.11.