Comments (10)
What's pip2?
from annoy.
pip2
is python package manager pip
. I rename pip
as pip2
for reminding of this is python2.x packages manager.
from annoy.
Seems like something broken with your Python environment.
Did you try to install it in a virtual environment? Might work better
from annoy.
Works on my mac:
$ virtualenv venv
$ venv/bin/pip2 install annoy
$ venv/bin/python2
>>> import annoy
>>>
(a bunch of output removed)
from annoy.
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.
pretty sure _PyModule_Create2
is defined in /usr/lib/libpython
I think your problem is that libpython isn't found in runtime
from annoy.
I actually noticed I have this problem on my work computer so will try to repro & fix
from annoy.
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.
@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.
@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)
- How many trees should I use? HOT 2
- Memory Leak in Annoy (get_nns_by_vector)? HOT 8
- Annoy Object Not Pickle'able HOT 1
- Add sample weights to distance metric? HOT 3
- Source distribution not availabe for 1.17.2 version HOT 2
- Unable to inherit the AnnoyIndex class HOT 2
- doesn't work correctly if torch tensor is input. But also doesn't throw error. Pls add an assertion that this only takes np arrays not torch tensors HOT 2
- _Vector should use position-only parameter for the index HOT 3
- How do you reduce a vector to 2 coordinates HOT 1
- [Distance] What did I do wrong?
- [MSVC] Annoy failed to run test on Windows HOT 1
- Some segment faults HOT 1
- Regarding updating an existing ANNOY model HOT 2
- Anyone tried storing trees and nodes in DynamoDB? HOT 1
- Is there any workaround to be able to use the Chebyshev distance with this library? HOT 1
- from annoy import AnnoyIndex
- Annoy build failed in MSVC x86 mode
- Using a built Annoy tree in a different device HOT 1
- ? HOT 1
- problem building with python3.12 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from annoy.