ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 222 forks source link

Conflict between h5py and gdal on Anaconda 2.3, Python 3.4.3 #380

Open cossatot opened 9 years ago

cossatot commented 9 years ago

I'm getting a conflict between h5py and gdal on Anaconda 2.3, Python 3.4.3, OS X:

If gdal is installed, hdf5 downgrades (hdf5: 1.8.15.1-1 --> 1.8.14-0) and h5py won't import:

( itchy )-( chicamocha )-( notebooks ) ipython
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar  6 2015, 12:07:41)
Type "copyright", "credits" or "license" for more information.

IPython 3.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import gdal

In [2]: import h5py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-e81388eeaef8> in <module>()
----> 1 import h5py

/Users/itchy/src/anaconda/lib/python3.4/site-packages/h5py/__init__.py in <module>()
     11
     12 try:
---> 13     from . import _errors
     14 except ImportError:
     15     import os.path as _op

ImportError: dlopen(/Users/itchy/src/anaconda/lib/python3.4/site-packages/h5py/_errors.so, 2): Library not loaded: @loader_path/../../../libhdf5.10.dylib
  Referenced from: /Users/itchy/src/anaconda/lib/python3.4/site-packages/h5py/_errors.so
  Reason: image not found

If, then, I go and re-install h5py with conda install h5py, then gdal won't import:

( itchy )-( chicamocha )-( notebooks ) ipython
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar  6 2015, 12:07:41)
Type "copyright", "credits" or "license" for more information.

IPython 3.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import h5py

In [2]: import gdal
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-27bf4694dd2b> in <module>()
----> 1 import gdal

/Users/itchy/src/anaconda/lib/python3.4/site-packages/gdal.py in <module>()
      1 # import osgeo.gdal as a convenience
----> 2 from osgeo.gdal import deprecation_warn
      3 deprecation_warn('gdal')
      4
      5 from osgeo.gdal import *

/Users/itchy/src/anaconda/lib/python3.4/site-packages/osgeo/__init__.py in <module>()
     19                 fp.close()
     20             return _mod
---> 21     _gdal = swig_import_helper()
     22     del swig_import_helper
     23 else:

/Users/itchy/src/anaconda/lib/python3.4/site-packages/osgeo/__init__.py in swig_import_helper()
     15         if fp is not None:
     16             try:
---> 17                 _mod = imp.load_module('_gdal', fp, pathname, description)
     18             finally:
     19                 fp.close()

/Users/itchy/src/anaconda/lib/python3.4/imp.py in load_module(name, file, filename, details)
    241                 return load_dynamic(name, filename, opened_file)
    242         else:
--> 243             return load_dynamic(name, filename, file)
    244     elif type_ == PKG_DIRECTORY:
    245         return load_package(name, filename)

ImportError: dlopen(/Users/itchy/src/anaconda/lib/python3.4/site-packages/osgeo/_gdal.so, 2): Library not loaded: @loader_path/./libhdf5_hl.9.dylib
  Referenced from: /Users/itchy/src/anaconda/lib/libgdal.1.dylib
  Reason: image not found

This doesn't happen with Anaconda 2.2 on my machine:

(anaconda_22)( itchy )-( chicamocha )-( notebooks ) ipython
Python 3.3.5 |Anaconda 2.2.0 (x86_64)| (default, Sep  2 2014, 13:57:31)
Type "copyright", "credits" or "license" for more information.

IPython 3.0.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import h5py

In [2]: import gdal

In [3]:

Happy to provide any other information.

groutr commented 9 years ago

Noted. Thanks for the issue. I will work today on fixing this.

bekozi commented 9 years ago

Same issue here. Looking forward to the fix!

ben.koziol:[~]$ conda info
Current conda install:

             platform : osx-64
        conda version : 3.14.1
  conda-build version : 1.14.1
       python version : 2.7.10.final.0
     requests version : 2.7.0
     root environment : /Users/ben.koziol/anaconda  (writable)
  default environment : /Users/ben.koziol/anaconda
     envs directories : /Users/ben.koziol/anaconda/envs
        package cache : /Users/ben.koziol/anaconda/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/osx-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/osx-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : /Users/ben.koziol/.condarc
    is foreign system : False
groutr commented 9 years ago

We are updating gdal to 2.0. The recompile should fix this issue.

groutr commented 9 years ago

libgdal/gdal 2.0.0 is available in the continuum repos. Please update and let me know if this issue persists

bekozi commented 9 years ago

The HDF5 issue is gone but now libpq is missing. I had encountered this issue immediately before the HDF5 import problem popped up. This may be considered a standard library?

(test-gdal)ben.koziol:[fabric_tools]$ python -c "import osgeo"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/ben.koziol/anaconda/envs/test-gdal/lib/python2.7/site-packages/osgeo/__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "/Users/ben.koziol/anaconda/envs/test-gdal/lib/python2.7/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Users/ben.koziol/anaconda/envs/test-gdal/lib/python2.7/site-packages/osgeo/_gdal.so, 2): Library not loaded: /usr/lib/libpq.5.dylib
  Referenced from: /Users/ben.koziol/anaconda/envs/test-gdal/lib/python2.7/site-packages/osgeo/../../../libgdal.20.dylib
  Reason: image not found

Requiring gdal>=2.0.0 caused issues with other dependencies, FYI:

Hint: the following packages conflict with each other:
  - netcdf4 <=1.1.7
  - gdal >=2.0.0

Use 'conda info netcdf4' etc. to see the dependencies for each package.
bekozi commented 9 years ago

Hi. I wanted to follow-up and see if libpq is considered a standard osx library?

cossatot commented 9 years ago

libgdal/gdal 2.0.0 is available in the continuum repos. Please update and let me know if this issue persists

I don't get the problem after upgrading. I don't use osgeo so I'm not sure whether I would have that problem.

Thanks!

lwasser commented 9 years ago

Hello -- i am having this exact issue on my mac running yosemite. I install gdal and it downgrades h5py. Gdal imports, h5py won't import. i upgrade h5py, gdal won't import. h5py is ok. Are there instructions somewhere to install both GDAL and h5py successfully? i'm using python 2.7.10/ Thank you for any guidance. i've been trying to get this to work all day!

jstarsky commented 8 years ago

i ma having the same problem.

import gdal Traceback (most recent call last): File "", line 1, in File "/Users/starsk/anaconda/envs/DV/lib/python2.7/site-packages/gdal.py", line 2, in from osgeo.gdal import deprecation_warn File "/Users/starsk/anaconda/envs/DV/lib/python2.7/site-packages/osgeo/init.py", line 21, in _gdal = swig_import_helper() File "/Users/starsk/anaconda/envs/DV/lib/python2.7/site-packages/osgeo/init.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) ImportError: dlopen(/Users/starsk/anaconda/envs/DV/lib/python2.7/site-packages/osgeo/_gdal.so, 2): Library not loaded: @rpath/./libhdf5_hl.9.dylib Referenced from: /Users/starsk/anaconda/envs/DV/lib/libnetcdf.7.dylib Reason: image not found

lwasser commented 8 years ago

@starsk62 I ended up completely uninstalling anaconda and reinstalling with the newest version. It drove me crazy updating one and then the other and getting these errors. Not an ideal solution but it worked for me.