Powerline: OSX, brew: Traceback, ImportError, Symbol not found: __PyInt_AsInt

Created on 19 Jun 2013  ·  3Comments  ·  Source: powerline/powerline

This is on OS X 10.8.4. When trying to use powerline in vim with homebrew python 2.7.5 linked, the following traceback results:

goldfish:~ goldfish$ brew link python
Linking /usr/local/Cellar/python/2.7.5... 34 symlinks created
goldfish:~ goldfish$ vim
Error detected while processing /Users/goldfish/.vimrc:
line   70:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/__init__.py", line 9, in <module>
    from powerline.lib.config import ConfigLoader
  File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/config.py", line 3, in <module>
    from powerline.lib.threaded import MultiRunnedThread
  File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/threaded.py", line 5, in <module>
    from powerline.lib.monotonic import monotonic
  File "/Users/goldfish/Library/Python/2.7/lib/python/site-packages/powerline/lib/monotonic.py", line 22, in <module>
    import ctypes
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so, 2): Symbol not found: __PyInt_AsInt
  Referenced from: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so
line   71:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
line   72:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'powerline_setup' is not defined
Press ENTER or type command to continue

The relevant section of my .vimrc:

python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup

Using the system python (brew unlink python) works.

Most helpful comment

I don't know how, unfortunately, but restarting iTerm magically fixed the problem.

All 3 comments

I don't know how, unfortunately, but restarting iTerm magically fixed the problem.

restart iTerm +1 ... 😢

This issue can arise when you install a new version of python. In those cases you may need to run hash -r python to tell bash to reset the cached location to the python executable.

Was this page helpful?
0 / 5 - 0 ratings