djsutherland / cyflann Goto Github PK
View Code? Open in Web Editor NEWA Cython interface to FLANN
License: BSD 3-Clause "New" or "Revised" License
A Cython interface to FLANN
License: BSD 3-Clause "New" or "Revised" License
Might be nice. Have it build and upload conda packages (and pip wheels?) too.
Would help with making sure #18 makes sense.
Detect the language of the extension? Or just a keyword argument? Probably just a keyword argument.
Environment:
Could not install by either:
pip install cyflann
Or setup.py after checking out the code:
python setup.py install
Error message was:
...
cyflann/index.c:254:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
Homebrew on OSX, apt on Ubuntu.
It would probably be nice if cyflann were a drop-in replacement for pyflann, in case anyone other than py-sdm is ever going to want to use it.
Need to set include_dirs
and extra_link_args
appropriately.
Also, should publish these variables so consumers (like py-sdm) know where to compile/link to as well.
nn_radius only gives me 32 neighbors max. Despite max_nn=-1 or 1024 and also params.max_neighbors doesn't work?
For some reason, MSVC doesn't get FLANN_DEFAULT_PARAMETERS
out of the import lib, even though it's there and objdump /exports
lists it and everything.
https://ci.appveyor.com/project/dougalsutherland/cyflann/build/1.0.49
Would be nice to use this so we can stop redefining the default parameters and actually use them from the library.
Anaconda uses rpath properly now. Was that the only reason we needed it?
Hi Dougal,
Thanks for doing this. I'm pretty new to Cython and my C/C++ is from 20 years ago. I'd ideally like to wrap the FLANN C++ code in Cython and then compile it all to a single .so / .pyd file. Is this possible or will there always be two libs (one Cython, one FLANN native) ?
Thanks
Ian
$ python test_vs_pyflann.py
Traceback (most recent call last):
File "test_vs_pyflann.py", line 4, in <module>
import cyflann
File "/home/magnolia/cyflann/cyflann/__init__.py", line 1, in <module>
from .index import FLANNParameters, FLANNIndex, set_distance_type
ImportError: /home/magnolia/cyflann/cyflann/index.so: undefined symbol: DEFAULT_FLANN_PARAMETERS
I currently only use the non-randomized functions so this doesn't matter, but still, should fix it.
Don't know what's up with this.
https://ci.appveyor.com/project/dougalsutherland/cyflann/build/1.0.53/job/yknjkaaxgh0jt8f7
Passing an absolute path to the library name doesn't seem to be doing it for me anymore; not sure if this is a change in newer OSX versions or if I just didn't test appropriately earlier. Should manually run install_name_tool
to fix it after compilation; example.
Have to figure out how to handle the _data
pointer appropriately.
So that e.g. py-sdm doesn't have to find flann itself, it just does library_dirs=[cyflann.get_library_dirs()]
or whatever.
Would it be possible to actually compile FLANN with this thing? So that pip install cyflann
would work even if you didn't have flann installed. (Though you'd still need cmake, unless I wanted to really go crazy.)
Would probably need the option of linking to a system install of flann also, though.
(From djsutherland/py-sdm#32)
I am using anaconda and set up an environment as described. When I run:
pip install 'https://github.com/dougalsutherland/py-sdm/tarball/master#egg=sdm-0.1.0dev'
I get the following error:
ImportError: The Cython extension requires cyflann to be installed before compilation.
Install cyflann (e.g. `pip install cyflann`), and then try again.
I just ran pip install cyflann
and it still raises this exception.
Running python -c 'import cyflann'
gives me another error:
ImportError: dlopen(/Users/wgmueller/anaconda/envs/py-sdm2/lib/python2.7/site-packages/cyflann/index.so, 2): Symbol not found: _DEFAULT_FLANN_PARAMETERS
Referenced from: /Users/wgmueller/anaconda/envs/py-sdm2/lib/python2.7/site-packages/cyflann/index.so
Expected in: dynamic lookup
Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.