Repository navigation
Closed
Description
See #953, on a branch I have modified setup.py to expect NumPy to be present under PyPy. This exposes a problem with hashing NumPy floats under the current latest version of PyPy3.
======================================================================
ERROR: test_calculate_function_with_scale (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_calculate_function_wrong_dimensionality (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_classify_function (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_train_function_input_lengths (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_train_function_no_training_set (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_train_function_uneven_dimension_of_training_set (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
======================================================================
ERROR: test_train_function_with_priors (test_NaiveBayes.NaiveBayesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/peterjc/biopython/Tests/test_NaiveBayes.py", line 77, in setUp
self.model = NaiveBayes.train(self.xs, self.ys)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 204, in train
nb.p_conditional[i][j] = _contents(values)
File "/home/travis/build/peterjc/biopython/build/lib.linux-x86_64-3.5/Bio/NaiveBayes.py", line 38, in _contents
counts[item] = counts.get(item, 0) + term
TypeError: 'numpy.float64' objects are unhashable
----------------------------------------------------------------------
Underlying problem with NumPy under PyPy3.5 v5.7 beta, logged as https://bitbucket.org/pypy/pypy/issues/2518/pypy3-hashing-numpy-float-types which turned out to be a duplicate of https://bitbucket.org/pypy/pypy/issues/2479/numpyfloat64-objects-are-unhashable
This test passes with PyPy2 v5.7
Metadata
Metadata
Assignees
Labels
No labels
Activity
TravisCI: Mark PyPy3 as an allowed failure.
peterjc commentedon Apr 3, 2017
Turned out not to be a PyPy3 bug but a NumPy issue. Logged with NumPy as numpy/numpy#8887 which they have fixed with numpy/numpy#8888
TravisCI: Mark PyPy3 as an allowed failure.
peterjc commentedon Apr 4, 2017
We can get TravisCI to pass by explicitly using the fixed (but unreleased) numpy in our Tox file, but that in turn means adding Cython as a NumPy non-release build dependency:
I think it would be simpler to skip this test if the float64 is unhashable with a message about updating NumPy for use on PyPy3.
Skip NaiveBayes test if numpy.float64 is unhashable.
peterjc commentedon Apr 4, 2017
Resolved via c696fb8 - PyPy3 users will need to wait for the next NumPy release to use NaiveBayes
Skip NaiveBayes test if numpy.float64 is unhashable.