Toblerity / rtree

Rtree: spatial index for Python GIS
https://rtree.readthedocs.io
MIT License
628 stars 123 forks source link

0.8 Release #21

Closed sgillies closed 10 years ago

sgillies commented 10 years ago

Now that #18 is closed, Rtree works on Python 3.4 and this warrants a new release. Will tag and upload to PyPI after a little more testing with GeoPandas.

cc @hobu

hobu commented 10 years ago

Can we wait til tkmorrow? I want to go through my local tree and I can't get to this until tonight.

On Jul 12, 2014, at 10:01 AM, Sean Gillies notifications@github.com wrote:

Now that #18 is closed, Rtree works on Python 3.4 and this warrants a new release. Will tag and upload to PyPI after a little more testing with GeoPandas.

cc @hobu

— Reply to this email directly or view it on GitHub.

sgillies commented 10 years ago

Waiting is good. I just found another 2/3 quirk, next is problematic, fixed in https://github.com/Toblerity/rtree/commit/8ead5fdac930b0c836031b6c9696a89532fc189d. I might find a couple more issues like this today.

hobu commented 10 years ago

Getting some error messages with homebrew's libspatialindex at this time.

======================================================================
FAIL: /Users/hobu/dev/git/rtree/tests/index.txt
Doctest: index.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 2201, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for index.txt
  File "/Users/hobu/dev/git/rtree/tests/index.txt", line 0

----------------------------------------------------------------------
File "/Users/hobu/dev/git/rtree/tests/index.txt", line 37, in index.txt
Failed example:
    idx.insert(4321, (34.3776829412, 26.7375853734, 49.3776829412, 41.7375853734), obj=42)
Exception raised:
    Traceback (most recent call last):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest index.txt[11]>", line 1, in <module>
        idx.insert(4321, (34.3776829412, 26.7375853734, 49.3776829412, 41.7375853734), obj=42)
      File "/Users/hobu/dev/git/rtree/rtree/index.py", line 350, in insert
        size, data, pyserialized = self._serialize(obj)
      File "/Users/hobu/dev/git/rtree/rtree/index.py", line 309, in _serialize
        serialized = self.dumps(obj)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1374, in dumps
        Pickler(file, protocol).dump(obj)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 202, in __init__
        raise ValueError("pickle protocol must be <= %d" % HIGHEST_PROTOCOL)
    ValueError: pickle protocol must be <= 2

======================================================================
FAIL: /Users/hobu/dev/git/rtree/tests/test_customStorage.txt
Doctest: test_customStorage.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 2201, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test_customStorage.txt
  File "/Users/hobu/dev/git/rtree/tests/test_customStorage.txt", line 0

----------------------------------------------------------------------
File "/Users/hobu/dev/git/rtree/tests/test_customStorage.txt", line 155, in test_customStorage.txt
Failed example:
    r2.count( (0,0,10,10) )
Expected:
    1
Got:
    1L

----------------------------------------------------------------------
sgillies commented 10 years ago

I'll fix these during the game :)

sgillies commented 10 years ago

@hobu, I see something different on Travis: https://travis-ci.org/Toblerity/rtree/builds/29842558.

Is the custom storage stuff in use? I'm wondering if it's allowing people to succeed poorly territory...

I've got 1.8.1 on my laptop, homebrew, and no errors at all. Travis has Ubuntu precise, so only 1.7. Hrm.

sgillies commented 10 years ago

I'm inclined to release 0.8 despite that custom storage tests are failing with libspatialindex 1.7. FWIW, the index.txt passes with 1.7 on Travis and 1.8.1 on my Mac.

hobu commented 10 years ago

We should maybe just disable custom storage for all libspatialindex less than 1.8

On Jul 13, 2014, at 3:55 PM, Sean Gillies notifications@github.com wrote:

From #12 it looks like I've got a version < 1.8 on Travis although Ubuntu GIS appears to offer 1.8.1.

— Reply to this email directly or view it on GitHub.

perrygeo commented 10 years ago

I'm seeing the pickle protocol error on Ubuntu 14.04 with stock libspatialite-dev (1.8.1?) via the spatial_index branch in geopandas. Python 2.7.6 64 bit.

/home/mperry/src/geopandas/examples/_ctypes/callbacks.c in 'calling callback function'()

/home/mperry/env/geopandas/src/rtree/rtree/index.pyc in py_next_item(p_id, p_mins, p_maxs, p_dimension, p_data, p_length)
    686                 p_length[0] = 0
    687             else:
--> 688                 p_length[0], data, _ = self._serialize(obj)
    689                 p_data[0] = ctypes.cast(data, ctypes.POINTER(ctypes.c_ubyte))
    690 

/home/mperry/env/geopandas/src/rtree/rtree/index.pyc in _serialize(self, obj)
    307 
    308     def _serialize(self, obj):
--> 309         serialized = self.dumps(obj)
    310         size = len(serialized)
    311 

/usr/lib/python2.7/pickle.pyc in dumps(obj, protocol)
   1372 def dumps(obj, protocol=None):
   1373     file = StringIO()
-> 1374     Pickler(file, protocol).dump(obj)
   1375     return file.getvalue()
   1376 

/usr/lib/python2.7/pickle.pyc in __init__(self, file, protocol)
    200             protocol = HIGHEST_PROTOCOL
    201         elif not 0 <= protocol <= HIGHEST_PROTOCOL:
--> 202             raise ValueError("pickle protocol must be <= %d" % HIGHEST_PROTOCOL)
    203         self.write = file.write
    204         self.memo = {}

ValueError: pickle protocol must be <= 2
sgillies commented 10 years ago

Think it could be the switch from cPickle to pickle? https://github.com/Toblerity/rtree/commit/ba43b440d846b64c5eb7d5e20d9dd6fc655d2ce0

kjordahl commented 10 years ago

@sgillies Yes, this block doesn't make any sense:

try:
    import pickle as pickle
except ImportError:
    import pickle

the first import should still be cPickle as pickle. I'll bet it was an automatic 2to3 change. The try/except should still work on Python 3.

hobu commented 10 years ago

All tests passing for me with libspatialindex 1.8.1 via homebrew for master.

sgillies commented 10 years ago

Yeah, that looks right, hobu. On Python 3, cPickle is _pickle and is imported transparently when available.

sgillies commented 10 years ago

Confirmations of the fix are appearing in https://github.com/geopandas/geopandas/pull/141 :)

hobu commented 10 years ago

Toblerity/Rtree tests still failing due to old libspatialindex, I think

https://travis-ci.org/Toblerity/rtree/jobs/30203316

sgillies commented 10 years ago

Yep, got a fix for that in ce888d1.

hobu commented 10 years ago

Added detection to the library in case someone actually uses it in libspatialindex < 1.8 in @66393b1188a2be600dbadbf87e8e3e86a32fa43d

hobu commented 10 years ago

Still bombing. https://travis-ci.org/Toblerity/rtree/jobs/30206051 For some reason @ce888d1de1ea0e50427e53eedfc0a6e65426f2a1 isn't causing custom storage tests to be turned off, but the error message is returned to the user now at least.

hobu commented 10 years ago

Another swing, working locally, at @b453da6634b3d654889600982acb278c789718ba

sgillies commented 10 years ago

I followed up in 1f969aa. This is gonna work :)

hobu commented 10 years ago

Confirmed that 1.8+ is still gonna work with customStorage after @1f969aa

sgillies commented 10 years ago

Travis is happy. I'll tag and upload to PyPI.