Installing with pip
Closed this issue · 12 comments
I ran into problems installing with pip involving the notorious libgfortran rpath bug on mac.
To reproduce,
- pip pysatCDF on a mac anaconda/miniconda environment (python 2.7)
import pysatCDF
- raises something like this
ImportError: dlopen(/Users/apembrok/Library/Caches/Python-Eggs/pysatCDF-0.3.0-py2.7-macosx-10.6-x86_64.egg-tmp/pysatCDF/fortran_cdf.so, 2): Library not loaded: @rpath/./libgfortran.3.dylib
Referenced from: /Users/apembrok/Library/Caches/Python-Eggs/pysatCDF-0.3.0-py2.7-macosx-10.6-x86_64.egg-tmp/pysatCDF/fortran_cdf.so
Reason: image not found
To resolve:
- verify the existing library names assigned to
fortran_cdf.so
:
otool -L ${CONDA_PREFIX}/lib/python2.7/site-packages/pysatCDF/fortran_cdf.so
- modify the library names with
install_name_tool
:
install_name_tool -change @rpath/./libgfortran.3.dylib ${CONDA_PREFIX}/lib/libgfortran.dylib -change @rpath/./libquadmath.0.dylib ${CONDA_PREFIX}/lib/libquadmath.0.dylib fortran_cdf.so ${CONDA_PREFIX}/lib/python2.7/site-packages/pysatCDF/fortran_cdf.so
Conda package installers usually fix the rpath issue automagically. Not sure how to do this with setuptools...
Hi, I also run into a problem trying to install pysat, pysatCDF, and pysatMagVect with pip. It is not directly relevant but I was hesitant to start a new issue, since it is technically an "installation with pip issue". Please feel free to move/edit as you see fit.
I have the following:
- macOS v.10.14.6
- gcc 9.2.0_1 (installed with Brew)
- python2.7.15 (also tried this in python3)
I get a bunch of warnings during installation, all seem to be related with the incompatibility between Apple clang and gfortran versions I installed with Homebrew. To fix I had to define new aliases in my bashrc file to point the gcc and gfortran installed by brew in my /usr/local/bin/.
The problem is similar to pymc-devs/pymc#119
A lot of places suggest the delocate tool which makes pip wheels portable. That would at least solve the issue where users aren't able to install with pip.
Also, note that install_name_tool
requires users to have the xcode developer tools installed so putting the command in setup.py may not help: https://stackoverflow.com/a/11598098
The delocate looks like it would be helpful for pip.
I found a lot of issues with clang as well, but gcc seems to work better.
I'm able to install from setup.py using the following environment setup
conda create -n pysatCDF python=2.7
conda install -c anaconda gcc
conda install -c anaconda numpy
pip install pysat (or setup.py after cloning pysat)
Then, from pysatCDF directory:
python setup.py install (or pip install .)
@rstoneback Anything left to do here?
Yep, it works with python3 as well.
I've uploaded delocated versions of pysatCDF to pypi for macosx. python 2 and 3.8 are currently supported.
I was finally able to fix various issues and got pysatCDF to install on my laptop (OSX Mojave) with python 2.7, 3.7, and 3.8.