Skip to content
This repository

Symbol not found: _get_largest_child #49

Closed
mrjbq7 opened this Issue July 26, 2012 · 20 comments

4 participants

John Benediktsson kwgoodman Dougal Sutherland Christoph Deil
John Benediktsson
mrjbq7 commented July 26, 2012

After installing on OS X 10.8 Mountain Lion, I get this error:

>>> from bottleneck.move import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so, 2): Symbol not found: _get_largest_child
  Referenced from: /Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so

Any ideas?

>>> import numpy
>>> numpy.__version__
'1.6.2'
kwgoodman
Owner

That's odd. get_largest_child is in move_median(). Does bottleneck.test() run?

John Benediktsson
mrjbq7 commented July 29, 2012

All of the failures are associated with not being able to load bottleneck.move.*:

$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bottleneck
>>> bottleneck.test()
Running unit tests for bottleneck
NumPy version 1.6.2
NumPy is installed in /Library/Python/2.7/site-packages/numpy-1.6.2-py2.7-macosx-10.8-intel.egg/numpy
Python version 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
nose version 1.1.2
.................EEEEEEEEEEE..................E..................EEEEEEEEEEEEEEEEEEEEEE......
======================================================================
ERROR: Test move_sum_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 114, in test_move_sum_selector
    fast_checker(bn.move.move_sum_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_nansum_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 118, in test_move_nansum_selector
    fast_checker(bn.move.move_nansum_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_mean_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 122, in test_move_mean_selector
    fast_checker(bn.move.move_mean_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_median_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 126, in test_move_median_selector
    fast_checker(bn.move.move_median_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_nanmean_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 130, in test_move_nanmean_selector
    fast_checker(bn.move.move_nanmean_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_std_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 134, in test_move_std_selector
    fast_checker(bn.move.move_std_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_nanstd_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 138, in test_move_nanstd_selector
    fast_checker(bn.move.move_nanstd_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_min_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 142, in test_move_min_selector
    fast_checker(bn.move.move_min_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_max_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 146, in test_move_max_selector
    fast_checker(bn.move.move_max_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_nanmin_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 150, in test_move_nanmin_selector
    fast_checker(bn.move.move_nanmin_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Test move_nanmax_selector.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py", line 154, in test_move_nanmixn_selector
    fast_checker(bn.move.move_nanmax_selector, mode='move')
AttributeError: 'module' object has no attribute 'move'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_sum')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/input_modifcation_test.py", line 74, in test_modification
    bn.move_sum,
AttributeError: 'module' object has no attribute 'move_sum'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_sum')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 117, in test_move_sum
    yield unit_maker, bn.move_sum, bn.slow.move_sum, (2,)
AttributeError: 'module' object has no attribute 'move_sum'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nansum')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 121, in test_move_nansum
    yield unit_maker, bn.move_nansum, bn.slow.move_nansum, (2,)
AttributeError: 'module' object has no attribute 'move_nansum'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_mean')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 125, in test_move_mean
    yield unit_maker, bn.move_mean, bn.slow.move_mean, (2,)
AttributeError: 'module' object has no attribute 'move_mean'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_median')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 129, in test_move_median
    yield unit_maker, bn.move_median, bn.slow.move_median, (2,)
AttributeError: 'module' object has no attribute 'move_median'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmean')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 133, in test_move_nanmean
    yield unit_maker, bn.move_nanmean, bn.slow.move_nanmean, (2,)
AttributeError: 'module' object has no attribute 'move_nanmean'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_std')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 137, in test_move_std
    yield unit_maker, bn.move_std, bn.slow.move_std, (2,)
AttributeError: 'module' object has no attribute 'move_std'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanstd')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 141, in test_move_nanstd
    yield unit_maker, bn.move_nanstd, bn.slow.move_nanstd, (2,)
AttributeError: 'module' object has no attribute 'move_nanstd'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_min')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 145, in test_move_min
    yield unit_maker, bn.move_min, bn.slow.move_min, (2,)
AttributeError: 'module' object has no attribute 'move_min'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_max')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 149, in test_move_max
    yield unit_maker, bn.move_max, bn.slow.move_max, (2,)
AttributeError: 'module' object has no attribute 'move_max'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmin')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 153, in test_move_nanmin
    yield unit_maker, bn.move_nanmin, bn.slow.move_nanmin, (2,)
AttributeError: 'module' object has no attribute 'move_nanmin'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmax')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/list_input_test.py", line 157, in test_move_nanmax
    yield unit_maker, bn.move_nanmax, bn.slow.move_nanmax, (2,)
AttributeError: 'module' object has no attribute 'move_nanmax'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_sum')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 72, in test_move_sum
    yield unit_maker, bn.move_sum, bn.slow.move_sum, 5
AttributeError: 'module' object has no attribute 'move_sum'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nansum')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 76, in test_move_nansum
    yield unit_maker, bn.move_nansum, bn.slow.move_nansum, 5
AttributeError: 'module' object has no attribute 'move_nansum'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_mean')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 80, in test_move_mean
    yield unit_maker, bn.move_mean, bn.slow.move_mean, 5
AttributeError: 'module' object has no attribute 'move_mean'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_median')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 84, in test_move_median
    yield unit_maker, bn.move_median, bn.slow.move_median, 5, False
AttributeError: 'module' object has no attribute 'move_median'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmean')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 88, in test_move_nanmean
    yield unit_maker, bn.move_nanmean, bn.slow.move_nanmean, 5
AttributeError: 'module' object has no attribute 'move_nanmean'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_std')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 92, in test_move_std
    yield unit_maker, bn.move_std, bn.slow.move_std, 5
AttributeError: 'module' object has no attribute 'move_std'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanstd')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 96, in test_move_nanstd
    yield unit_maker, bn.move_nanstd, bn.slow.move_nanstd, 5
AttributeError: 'module' object has no attribute 'move_nanstd'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_min')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 100, in test_move_min
    yield unit_maker, bn.move_min, bn.slow.move_min, 5
AttributeError: 'module' object has no attribute 'move_min'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_max')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 104, in test_move_max
    yield unit_maker, bn.move_max, bn.slow.move_max, 5
AttributeError: 'module' object has no attribute 'move_max'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmin')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 108, in test_move_nanmin
    yield unit_maker, bn.move_nanmin, bn.slow.move_nanmin, 5
AttributeError: 'module' object has no attribute 'move_nanmin'

======================================================================
ERROR: Failure: AttributeError ('module' object has no attribute 'move_nanmax')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/loader.py", line 231, in generate
    for test in g():
  File "/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/move_test.py", line 112, in test_move_nanmax
    yield unit_maker, bn.move_nanmax, bn.slow.move_nanmax, 5
AttributeError: 'module' object has no attribute 'move_nanmax'

----------------------------------------------------------------------
Ran 93 tests in 31.881s

FAILED (errors=34)
<nose.result.TextTestResult run=93 errors=34 failures=0>
kwgoodman
Owner

Perhaps move_median (where get_largest_child is located) is causing the problem. It is the only function that uses C code that is not generated by cython. To check, you could try removing move_median from the top-level __init__.py:

try:
    from .move import (move_sum, move_nansum,
                      move_mean, move_nanmean,
                      move_std, move_nanstd,
                      move_min, move_nanmin,
                      move_max, move_nanmax,
                      move_median)
except:
    pass
John Benediktsson
mrjbq7 commented July 29, 2012

Somehow the whole move.so fails to import:

>>> from bottleneck import move
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(bottleneck/move.so, 2): Symbol not found: _get_largest_child
  Referenced from: bottleneck/move.so
  Expected in: flat namespace
 in bottleneck/move.so
kwgoodman
Owner

I don't know what is going on.

Where did you get bottleneck (pypi, github, ...)? How did you install it (python setup.py install, make all, ...)?

John Benediktsson
mrjbq7 commented July 30, 2012

I first used easy_install bottleneck.

When that had a problem, I grabbed the github sources, and built using make all which also has the problem.

It worked fine on Mac OS X 10.7 with XCode 4.3. I upgraded to 10.8 Mountain Lion and XCode 4.4, which has a new version of clang, so likely the problem is theirs and in the linking of move_median.c, but I'm not sure how to debug this...

kwgoodman
Owner

I suggest downloading from pypi and doing "python setup.py install". I'm not familiar with easy_install. But I guess that does the same thing as I am suggesting?

kwgoodman
Owner

"make all" builds in place. Yet your tracebacks look like bottleneck was installed system wide:

/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/tests/fast_test.py

So, just wanted to make sure you removed the easy installed bottleneck before trying "make all".

John Benediktsson
mrjbq7 commented July 31, 2012

Right, that was the paste from the system bottleneck.test(), the local one looks the same except the paths are relative to where I installed it... sorry I don't have more information for you!

John Benediktsson

It looks like the move.so doesn't have these symbols:

$ nm move.so
...
                 U _get_largest_child
                 U _get_smallest_child
John Benediktsson

I just wanted to report this is still a problem for anyone trying to get it working on 10.8:

In [6]: from bottleneck.move import *
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-6-ea97c48bbca3> in <module>()
----> 1 from bottleneck.move import *

ImportError: dlopen(/Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so, 2): Symbol not found: _get_largest_child
  Referenced from: /Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so
  Expected in: flat namespace
 in /Library/Python/2.7/site-packages/Bottleneck-0.6.0-py2.7-macosx-10.8-intel.egg/bottleneck/move.so
Dougal Sutherland

I can confirm that my installs on OSX 10.8 with Xcode 4.4.1's command-line tools of

  • Python 2.7.2 with numpy 1.8.0.dev-f2f0ac0 (from a fairly recent scipy-superpack)
  • Python 3.2.3 with numpy 1.6.2

have the same problem, both in pip and from a source checkout.

I didn't see any relevant warnings during compilation (just several thousand self-assigns, a few unused variables / imports, and one about using the deprecated numpy API).

John Benediktsson

Mine is same configuration as yours, but with numpy 1.6.2. I suspect it has to do with new XCode and/or new clang.

John Benediktsson

I'm using a workaround for now until we can get this fixed:

# Fix for bottleneck.move compile problems on Mac OS X 10.8,
# we default to using the pandas methods which are slower
# but work fine on 10.8 Mountain Lion.
try:
    import bottleneck.move
except ImportError:
    class bn:
        move_mean = staticmethod(pandas.rolling_mean)
        move_min = staticmethod(pandas.rolling_min)
        move_max = staticmethod(pandas.rolling_max)
        move_sum = staticmethod(pandas.rolling_sum)
kwgoodman kwgoodman closed this August 29, 2012
kwgoodman kwgoodman reopened this August 29, 2012
kwgoodman
Owner

Another potential solution is to replace move_median_selector() in bottleneck/src/template/move/move_median.py with:

cdef np.ndarray a
if type(arr) is np.ndarray:
    a = arr
else:    
    a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
if axis < 0:
    axis += ndim
cdef tuple key = (ndim, dtype, axis)
if (axis < 0) or (axis >= ndim):
    raise ValueError("axis(=%d) out of bounds" % axis)
try:
    func = move_median_slow_dict[axis]
except KeyError:
    tup = (str(ndim), str(a.dtype), str(axis))
    raise TypeError("Unsupported ndim/dtype/axis (%s/%s/%s)." % tup)
return func, a

And then rebuild.

The idea is to use the slow python version of move_median instead of the C version.

Christoph Deil

I see this problem on Mac OS X 10.7 and 10.8 with Cython from git master if I say make all.

The problem is that get_largest_child is in bottleneck/src/move/csrc/move_median.c

$ find . -name '*.c'
./bottleneck/src/func/32bit/func.c
./bottleneck/src/func/64bit/func.c
./bottleneck/src/move/32bit/move.c
./bottleneck/src/move/64bit/move.c
./bottleneck/src/move/csrc/move_median.c
$ grep get_largest_child ./bottleneck/src/move/csrc/move_median.c
__inline _size_t get_largest_child(mm_node **heap,
  _size_t c_idx = get_largest_child(heap, size, idx, node, &child);
    c_idx = get_largest_child(heap, size, idx, node, &child);

But bottleneck/src/move/csrc/move_median.c is not linked into move.so as it should be ( https://gist.github.com/4537967#file-gistfile1-txt-L63 ):

/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib build/temp.macosx-10.8-x86_64-2.7/bottleneck/src/move/64bit/move.o -o /Users/deil/code/bottleneck/move.so

I guess you have to add it here:
https://github.com/kwgoodman/bottleneck/blob/master/setup.py#L96

Although probably it's more complicated, because why would it work on Linux and why is move_median.c in a separate folder ...

John Benediktsson

Looks like the problem is due to clang building C code according to the C99 standard by default (see http://clang.llvm.org/compatibility.html#inline for more details on clang).

In the C99 standard, you would use inline instead of __inline (which is a vendor-specific keyword, see http://stackoverflow.com/questions/2765164/inline-vs-inline-vs-inline-vs-forceinline for more details on that).

Instead, if you want GCC compatible behavior, you would apply this fix to make it work on 10.8 with clang:

diff --git a/bottleneck/src/move/setup.py b/bottleneck/src/move/setup.py
index 6789d57..830cc0c 100644
--- a/bottleneck/src/move/setup.py
+++ b/bottleneck/src/move/setup.py
@@ -31,6 +31,7 @@ else:

 mod_dir = os.path.dirname(__file__)
 ext_modules = [Extension("move", [os.path.join(mod_dir, "%sbit/move.pyx") % bits],
+               extra_compile_args=["-std=gnu89"],
                include_dirs=[np.get_include()])]

 setup(
John Benediktsson

I verified that this fix also works on GCC 4.7.2 (you can see it is a valid option on http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options).

John Benediktsson

Fixed by #59.

John Benediktsson mrjbq7 closed this February 07, 2013
Jens H Nielsen jenshnielsen referenced this issue from a commit in jenshnielsen/bottleneck August 18, 2013
Jens H Nielsen Additional fix related to #49. The gnuc99 extension should also be en…
…abled when building from the c source to fix the build on Mountain Lion.
5416a64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.