Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be explicit about python version #46

Merged
merged 1 commit into from
May 18, 2012
Merged

Be explicit about python version #46

merged 1 commit into from
May 18, 2012

Conversation

svenstaro
Copy link
Contributor

Arch Linux has python3 in /usr/bin/python and other distros may follow. Better be sure to use the absolutely correct version here.

mariusmuja added a commit that referenced this pull request May 18, 2012
Be explicit about python version
@mariusmuja mariusmuja merged commit f320d4b into flann-lib:master May 18, 2012
@djsutherland
Copy link
Contributor

Arch is the only environment I'm aware of where there's commonly a python2 command, however, meaning that this breaks these shebang lines on most platforms....

@svenstaro
Copy link
Contributor Author

Other platform would do well to add it: http://allanmcrae.com/2011/03/the-python2-pep/

@djsutherland
Copy link
Contributor

Agreed, but in the meantime, this still breaks the shebangs on all platforms other than Arch.

@svenstaro
Copy link
Contributor Author

Well, what do you suggest? My patch is the proper solution. You will need quite ugly hacks otherwise.

@djsutherland
Copy link
Contributor

At a minimum there should probably be a note in the documentation about adding a python2 symlink if necessary.

Ideally, the python files would all be source-compatible with both python 2 and 3, meaning it could stay as a /usr/bin/env python symlink. It seems like scipy.weave doesn't work with python 3, though, so any support for python 3 would require significant changes. Maybe I'll poke around at a non-weave way to do the bindings, since as a python 3 user it'd be nice to have the option of direct flann bindings.

@mariusmuja
Copy link
Collaborator

Pyhton bindings should be compatible with both python 2 and 3 now, so I changed back to /usr/bin/env python.

@djsutherland
Copy link
Contributor

Um...you seem to have removed most of the bindings in 21bec7e, which means that although we do indeed get the same behavior under Python 2 and 3, that behavior is to crash with ImportError: No module named flann_ctypes.

@mariusmuja
Copy link
Collaborator

Hmm... the file I removed aren't actually needed by the python bindings.
What is the code you are using when you are getting the import error?

On Wed, Jun 6, 2012 at 9:14 AM, Dougal Sutherland <
reply@reply.github.com

wrote:

Um...you seem to have removed most of the bindings in 21bec7e, which
means that although we do indeed get the same behavior under Python 2 and
3, that behavior is to crash with ImportError: No module named flann_ctypes.


Reply to this email directly or view it on GitHub:
#46 (comment)

@djsutherland
Copy link
Contributor

This happens on import pyflann; pyflann/__init__.py imports from pyflann.index, which imports from the removed pyflann.flann_ctypes. Here's the traceback (I installed into a temporary directory and added that to sys.path so as to not mess with my regular FLANN install):

In[3]: import pyflann
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/dougal/<ipython-input-3-b6d4c333a325> in <module>()
----> 1 import pyflann

/Users/dougal/flann-lol/share/flann/python/pyflann/__init__.py in <module>()
     29 #sys.path.insert(0, os.path.split(__file__)[0]) # make python3 happy
     30 
---> 31 from pyflann.index import *

/Users/dougal/flann-lol/share/flann/python/pyflann/index.py in <module>()
     25 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 
---> 27 from pyflann.flann_ctypes import *
     28 from pyflann.exceptions import *
     29 import numpy.random as _rn

ImportError: No module named flann_ctypes

@mariusmuja
Copy link
Collaborator

Ups, my mistake. I've moved flann_ctypes.py locally and forgot to (re-)add
it to the git index. It should be there now.

On Mon, Jun 11, 2012 at 8:23 PM, Dougal Sutherland <
reply@reply.github.com

wrote:

This happens on import pyflann; pyflann/__init__.py imports from
pyflann.index, which imports from the removed pyflann.flann_ctypes.
Here's the traceback (I installed into a temporary directory and added that
to sys.path so as to not mess with my regular FLANN install):

In[3]: import pyflann


ImportError Traceback (most recent call
last)
/Users/dougal/ in ()
----> 1 import pyflann

/Users/dougal/flann-lol/share/flann/python/pyflann/init.py in
()
29 #sys.path.insert(0, os.path.split(file)[0]) # make python3
happy
30
---> 31 from pyflann.index import *

/Users/dougal/flann-lol/share/flann/python/pyflann/index.py in
()
25 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
26
---> 27 from pyflann.flann_ctypes import *
28 from pyflann.exceptions import *
29 import numpy.random as _rn

ImportError: No module named flann_ctypes


Reply to this email directly or view it on GitHub:
#46 (comment)

@djsutherland
Copy link
Contributor

It works! Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants