Giter VIP home page Giter VIP logo

Comments (10)

erikbern avatar erikbern commented on May 16, 2024

What's pip2?

from annoy.

edonyzpc avatar edonyzpc commented on May 16, 2024

pip2 is python package manager pip. I rename pip as pip2 for reminding of this is python2.x packages manager.

from annoy.

erikbern avatar erikbern commented on May 16, 2024

Seems like something broken with your Python environment.

For example: http://stackoverflow.com/questions/32152166/python-2-7-suddenly-not-working-symbol-not-found-pyerr-replaceexception-wh

Did you try to install it in a virtual environment? Might work better

from annoy.

erikbern avatar erikbern commented on May 16, 2024

Works on my mac:

$ virtualenv venv
$ venv/bin/pip2 install annoy
$ venv/bin/python2
>>> import annoy
>>> 

(a bunch of output removed)

from annoy.

edonyzpc avatar edonyzpc commented on May 16, 2024

I tried as following.

  • step 1, pip install virutalenv venv
  • step 2, follow your recommendation

_It did not work._
Maybe I should reinstall Python and try it again. Personally, I am curious about how to locate the _PyModule_Create2. There is not such symbol in file annoymodule.cc and annoylib.so

readelf -a annoylib.so | grep PyModule
00000020e028  000500000007 R_X86_64_JUMP_SLO 0000000000000000 PyModule_AddObject + 0
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND PyModule_AddObject
    83: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND PyModule_AddObject

from annoy.

erikbern avatar erikbern commented on May 16, 2024

pretty sure _PyModule_Create2 is defined in /usr/lib/libpython

I think your problem is that libpython isn't found in runtime

from annoy.

erikbern avatar erikbern commented on May 16, 2024

I actually noticed I have this problem on my work computer so will try to repro & fix

from annoy.

amcgregor avatar amcgregor commented on May 16, 2024

Interestingly, I have begun to see the same linker error on an unrelated package, and this was the only Google hit for the exact exception string.

# tox -e py27
GLOB sdist-make: /Users/amcgregor/Projects/marrow/src/libsass-python/setup.py
py27 inst-nodeps: /Users/amcgregor/Projects/marrow/src/libsass-python/.tox/dist/libsass-0.9.2.zip
py27 installed: flake8==2.5.0,libsass==0.9.2,mccabe==0.3.1,pep8==1.5.7,pyflakes==1.0.0,six==1.10.0,Werkzeug==0.11.2,wheel==0.24.0
py27 runtests: PYTHONHASHSEED='3228397935'
py27 runtests: commands[0] | python -c from shutil import *; rmtree("build", True)
py27 runtests: commands[1] | python -m unittest sasstests
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/__main__.py", line 12, in <module>
    main(module=None)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "sasstests.py", line 23, in <module>
    import sass
  File "sass.py", line 26, in <module>
    from _sass import OUTPUT_STYLES, compile_filename, compile_string
ImportError: dlopen(./_sass.so, 2): Symbol not found: _PyModule_Create2
  Referenced from: ./_sass.so
  Expected in: flat namespace
 in ./_sass.so
ERROR: InvocationError: '/Users/amcgregor/Projects/marrow/src/libsass-python/.tox/py27/bin/python -m unittest sass tests'

Running using a brew-installed pypy or pypy3 does not exhibit this problem, but the both CPython 2 runs do. The py27 compiled module similarly does not contain a reference to that symbol:

# symbols .tox/py27/lib/python2.7/site-modules/_sass.so | grep PyModule
                0x000fad92 (     0x6) DYLD-STUB$$PyModule_AddObject [DYLD-STUB, LENGTH, NameNList, MangledNameNList, NList]

Weird.

from annoy.

erikbern avatar erikbern commented on May 16, 2024

@Edonym what happens if you clone the repository and run python setup.py install? Does it also give the same error? If so – can you send the command line options for the compiler? Mine look like this:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/annoymodule.cc -o build/temp.macosx-10.10-intel-2.7/src/annoymodule.o -O3 -march=native -ffast-math

See the -dynamic flag here – that one is key

from annoy.

singlakdeepak avatar singlakdeepak commented on May 16, 2024

@Edonym were you able to find out a solution to the error that you talked about,
>>> import annoy Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/annoy/__init__.py", line 15, in <module> from .annoylib import * ImportError: dlopen(/usr/local/lib/python2.7/site-packages/annoy/annoylib.so, 2): Symbol not found: _PyModule_Create2 Referenced from: /usr/local/lib/python2.7/site-packages/annoy/annoylib.so Expected in: flat namespace in /usr/local/lib/python2.7/site-packages/annoy/annoylib.so
I am getting the same error while I am working on Python 2.7 on HPC.

from annoy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.