scikit-hep / root_pandas

A Python module for conveniently loading/saving ROOT files as pandas DataFrames
MIT License
109 stars 35 forks source link

cannot import root_pandas: Symbol not found #78

Closed goi42 closed 5 years ago

goi42 commented 5 years ago

Today, I did pip install root_pandas --upgrade successfully from 0.3.x to 0.6.x. However, I cannot use it:

Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct  5 2017, 02:28:52) 
Type "copyright", "credits" or "license" for more information.

IPython 5.4.1 -- An enhanced Interactive Python.
?         -> 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 root_pandas
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-2445605c5f03> in <module>()
----> 1 import root_pandas

/Users/michael/anaconda2/lib/python2.7/site-packages/root_pandas/__init__.py in <module>()
----> 1 from .readwrite import read_root
      2 from .readwrite import to_root
      3 from .version import __version__
      4 
      5 __all__ = [

/Users/michael/anaconda2/lib/python2.7/site-packages/root_pandas/readwrite.py in <module>()
      8 from pandas import DataFrame, RangeIndex
      9 import pandas as pd
---> 10 from root_numpy import root2array, list_trees
     11 import fnmatch
     12 from root_numpy import list_branches

/Users/michael/anaconda2/lib/python2.7/site-packages/root_numpy/__init__.py in <module>()
     49     del numpy_version_at_install
     50 
---> 51 from ._tree import (
     52     root2array, root2rec,
     53     tree2array, tree2rec,

/Applications/root_build/lib/ROOT.pyc in _importhook(name, *args, **kwds)
    461       except Exception:
    462          pass
--> 463    return _orig_ihook( name, *args, **kwds )
    464 
    465 __builtin__.__import__ = _importhook

/Users/michael/anaconda2/lib/python2.7/site-packages/root_numpy/_tree.py in <module>()
      4 
      5 from .extern.six import string_types
----> 6 from . import _librootnumpy
      7 
      8 

/Applications/root_build/lib/ROOT.pyc in _importhook(name, *args, **kwds)
    461       except Exception:
    462          pass
--> 463    return _orig_ihook( name, *args, **kwds )
    464 
    465 __builtin__.__import__ = _importhook

ImportError: dlopen(/Users/michael/anaconda2/lib/python2.7/site-packages/root_numpy/_librootnumpy.so, 2): Symbol not found: __ZNK5TFile12GetCacheReadEP7TObject
  Referenced from: /Users/michael/anaconda2/lib/python2.7/site-packages/root_numpy/_librootnumpy.so
  Expected in: /Applications/root_build/lib/libRIO.so
 in /Users/michael/anaconda2/lib/python2.7/site-packages/root_numpy/_librootnumpy.so

I'm using ROOT 6.17/01 and conda 4.5.11 on macOS Mojave.

chrisburr commented 5 years ago

I think the issue is with root_numpy, can you try running import root_numpy from within a Python session?

Assuming that fails, try to see if upgrading it helps:

pip install --upgrade root_numpy
eduardo-rodrigues commented 5 years ago

Hi, for your information I will be uploading the most up-to-date version to PyPI really shortly. You should for sure try things out with that 4.8.0 version.

eduardo-rodrigues commented 5 years ago

FYI version 4.8.0 is now on PyPI, see https://pypi.org/project/root-numpy/. Let us know how it goes, @goi42. Thanks.

goi42 commented 5 years ago

As expected, import root_numpy fails with a similar error. Unfortunately, I am unable to update:

$ pip install root_numpy --upgrade
Collecting root_numpy
  Downloading https://files.pythonhosted.org/packages/d5/5f/82f5111c22599676eb8b5f9b1bf85c38dcc7995d52cd6b4a8f5f5caa4659/root_numpy-4.8.0.tar.gz (520kB)
    100% |████████████████████████████████| 522kB 8.3MB/s 
Building wheels for collected packages: root-numpy
  Running setup.py bdist_wheel for root-numpy ... error
  Complete output from command /Users/michael/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-install-iPwoK2/root-numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-wheel-WhLfk3 --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.6-x86_64-2.7
  creating build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_graph.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_sample.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_warnings.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_array.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/setup_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/info.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_matrix.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_hist.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_tree.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  copying root_numpy/_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
  creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_hist.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_tree.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_sample.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_array.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  copying root_numpy/tests/test_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
  creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
  copying root_numpy/extern/ordereddict.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
  copying root_numpy/extern/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
  copying root_numpy/extern/six.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
  creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
  copying root_numpy/tmva/_data.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
  copying root_numpy/tmva/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
  copying root_numpy/tmva/tests.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
  copying root_numpy/tmva/_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
  copying root_numpy/testdata/directories.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/object2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/struct.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/test.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/vary1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/single1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/fixed2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/trees.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/ntuple.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/fixed1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/vary2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/string.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/single2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/vector.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  copying root_numpy/testdata/object1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
  running build_ext
  building 'root_numpy._librootnumpy' extension
  creating build/temp.macosx-10.6-x86_64-2.7
  creating build/temp.macosx-10.6-x86_64-2.7/root_numpy
  creating build/temp.macosx-10.6-x86_64-2.7/root_numpy/src
  gcc -fno-strict-aliasing -I/Users/michael/anaconda2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Iroot_numpy/src -I/Users/michael/anaconda2/include/python2.7 -I/Users/michael/anaconda2/lib/python2.7/site-packages/numpy/core/include -c root_numpy/src/_librootnumpy.cpp -o build/temp.macosx-10.6-x86_64-2.7/root_numpy/src/_librootnumpy.o -pthread -stdlib=libc++ -std=c++11 -m64 -I/Applications/root_build/include -Wno-unused-function -Wno-write-strings
  clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for root-numpy
  Running setup.py clean for root-numpy
Failed to build root-numpy
Installing collected packages: root-numpy
  Found existing installation: root-numpy 4.7.3
    Uninstalling root-numpy-4.7.3:
      Successfully uninstalled root-numpy-4.7.3
  Running setup.py install for root-numpy ... error
    Complete output from command /Users/michael/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-install-iPwoK2/root-numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-record-OFytw3/install-record.txt --single-version-externally-managed --compile:
    running install

                     _
     _ __ ___   ___ | |_     _ __  _   _ _ __ ___  _ __  _   _
    | '__/ _ \ / _ \| __|   | '_ \| | | | '_ ` _ \| '_ \| | | |
    | | | (_) | (_) | |_    | | | | |_| | | | | | | |_) | |_| |
    |_|  \___/ \___/ \__|___|_| |_|\__,_|_| |_| |_| .__/ \__, |  4.8.0
                       |_____|                    |_|    |___/

    writing 'root_numpy/config.json'
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-x86_64-2.7
    creating build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_graph.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_sample.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_warnings.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_array.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/setup_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/info.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_matrix.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_hist.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_tree.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    copying root_numpy/_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_utils.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_hist.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_tree.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_sample.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_array.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    copying root_numpy/tests/test_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tests
    creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
    copying root_numpy/extern/ordereddict.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
    copying root_numpy/extern/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
    copying root_numpy/extern/six.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/extern
    creating build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
    copying root_numpy/tmva/_data.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
    copying root_numpy/tmva/__init__.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
    copying root_numpy/tmva/tests.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
    copying root_numpy/tmva/_evaluate.py -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/tmva
    copying root_numpy/testdata/directories.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/object2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/struct.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/test.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/vary1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/single1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/fixed2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/trees.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/ntuple.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/fixed1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/vary2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/string.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/single2.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/vector.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/testdata/object1.root -> build/lib.macosx-10.6-x86_64-2.7/root_numpy/testdata
    copying root_numpy/config.json -> build/lib.macosx-10.6-x86_64-2.7/root_numpy
    running build_ext
    building 'root_numpy._librootnumpy' extension
    creating build/temp.macosx-10.6-x86_64-2.7
    creating build/temp.macosx-10.6-x86_64-2.7/root_numpy
    creating build/temp.macosx-10.6-x86_64-2.7/root_numpy/src
    gcc -fno-strict-aliasing -I/Users/michael/anaconda2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Iroot_numpy/src -I/Users/michael/anaconda2/include/python2.7 -I/Users/michael/anaconda2/lib/python2.7/site-packages/numpy/core/include -c root_numpy/src/_librootnumpy.cpp -o build/temp.macosx-10.6-x86_64-2.7/root_numpy/src/_librootnumpy.o -pthread -stdlib=libc++ -std=c++11 -m64 -I/Applications/root_build/include -Wno-unused-function -Wno-write-strings
    clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of root-numpy
Command "/Users/michael/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-install-iPwoK2/root-numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-record-OFytw3/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/zq/pwp8f9td4_9cb_b28mhfpffr0000gp/T/pip-install-iPwoK2/root-numpy/

Note that I am running macOS 10.14.2.

chrisburr commented 5 years ago

Can you try setting the deployment target environment variable while installing?

MACOSX_DEPLOYMENT_TARGET=10.9 pip install root_numpy --upgrade
goi42 commented 5 years ago

Thank you, that's resolved it:

$ MACOSX_DEPLOYMENT_TARGET=10.9 pip install root_numpy --upgrade
Collecting root_numpy
  Using cached https://files.pythonhosted.org/packages/d5/5f/82f5111c22599676eb8b5f9b1bf85c38dcc7995d52cd6b4a8f5f5caa4659/root_numpy-4.8.0.tar.gz
Building wheels for collected packages: root-numpy
  Running setup.py bdist_wheel for root-numpy ... done
  Stored in directory: /Users/michael/Library/Caches/pip/wheels/f0/3c/18/62ccf3aec0284175916617d699f179d7cdbe4de0c7070be2a5
Successfully built root-numpy
Installing collected packages: root-numpy
  Found existing installation: root-numpy 4.7.3
    Uninstalling root-numpy-4.7.3:
      Successfully uninstalled root-numpy-4.7.3
Successfully installed root-numpy-4.8.0
In [1]: import root_numpy

In [2]: import root_pandas
eduardo-rodrigues commented 5 years ago

Glad that magic worded. I'm no Mac user so no clue why ;-).