numenta / nupic-legacy

Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
http://numenta.org/
GNU Affero General Public License v3.0
6.33k stars 1.56k forks source link

py.test tests/unit failure (1 out of 738) #3836

Closed colingoldberg closed 6 years ago

colingoldberg commented 6 years ago

Just in case this helps, I am posting the "Failures" output from py.test tests/unit

platform linux2 -- Python 2.7.12, pytest-3.0.7, py-1.5.3, pluggy-0.4.0 rootdir: /usr/local/share/numenta/nupic, inifile: plugins: xdist-1.16.0, cov-2.5.0 collected 738 items ... ================================================================= FAILURES ================================================================== SDRClassifierTest.testSoftMaxOverflow

self =

def testSoftMaxOverflow(self):
  """
    Test if the softmax normalization overflows
    """
  c = SDRClassifier([1], 1.0, 0.1, 0)
  weight = numpy.array([[sys.float_info.max_exp + 1]])
  res = c.inferSingleStep([0], weight)
self.assertFalse(numpy.isnan(res), "SoftMax overflow")

E AssertionError: array([ True], dtype=bool) is not False : SoftMax overflow

tests/unit/nupic/algorithms/sdr_classifier_test.py:799: AssertionError ----------------------------------------------------------- Captured stderr call ------------------------------------------------------------ /usr/local/lib/python2.7/dist-packages/nupic/algorithms/sdr_classifier.py:377: RuntimeWarning: overflow encountered in exp expOutputActivation = numpy.exp(outputActivation) /usr/local/lib/python2.7/dist-packages/nupic/algorithms/sdr_classifier.py:378: RuntimeWarning: invalid value encountered in divide predictDist = expOutputActivation / numpy.sum(expOutputActivation) ========================================================== pytest-warning summary =========================================================== WC1 /usr/local/share/numenta/nupic/tests/unit/nupic/engine/network_test.py cannot collect test class 'TestNode' because it has a init constructor WC1 /usr/local/share/numenta/nupic/tests/unit/nupic/frameworks/opf/htmpredictionmodel_classifier_helper_test.py cannot collect test class 'TestOptionParser' because it has a init constructor WC1 /usr/local/share/numenta/nupic/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py cannot collect test class 'TestOptionParser' because it has a init constructor WC1 /usr/local/share/numenta/nupic/tests/unit/nupic/support/decorators_test.py cannot collect test class 'TestParentException' because it has a init constructor WC1 /usr/local/share/numenta/nupic/tests/unit/nupic/support/decorators_test.py cannot collect test class 'TestChildException' because it has a init constructor ============================= 1 failed, 712 passed, 17 skipped, 8 xfailed, 5 pytest-warnings in 326.69 seconds ==============================

Run on DigitalOcean Ubuntu 16.04 Python 2.7.12

rhyolight commented 6 years ago

Please run unit tests with this command:

python ./scripts/run_nupic_tests.py -u

Is the output the same? Also be sure to pull tip of master because we have made changes recently.

LunaAmour commented 6 years ago

I am having the same issue when running the "py.test tests/unit" command, and when I run

python ./scripts/run_nupic_tests.py -u

I see the following:

python ./scripts/run_nupic_tests.py -u Traceback (most recent call last): File "./scripts/run_nupic_tests.py", line 262, in os.chdir(os.getenv('NUPIC')) TypeError: coercing to Unicode: need string or buffer, NoneType found

ilialexander commented 6 years ago

Hi LunaAmour,

I was having the same issue. I solved it by uninstalling nupic and using the --user option for installation.

Let me know if this is of any help.

DeepakVellampalli commented 6 years ago

Hello guys! Even I faced the same error while running "py.test tests/unit". As per your suggestion @ilialexander I reinstalled Nupic using "--user" option. After that "python ./scripts/run_nupic_tests.py -u" neither gave an error nor gave any type of output. Should I assume that everything got fixed? However, "py.test tests/unit" still gives the same error.

P.S : This solution of using "--user" installs the package globally and deprives the benefit of using virtual environment.

rvsandeep commented 6 years ago

tests/unit/nupic/docs/examples_test.py::ExamplesTest::testFiveStepConfidencesOpfVsNetwork <- ../../.local/lib/python2.7/site-packages/unittest2/case.py xfail tests/unit/nupic/docs/examples_test.py::ExamplesTest::testFiveStepPredictionsOpfVsNetwork <- ../../.local/lib/python2.7/site-packages/unittest2/case.py xfail tests/unit/nupic/docs/examples_test.py::ExamplesTest::testOneStepConfidencesAlgoVsNetwork <- ../../.local/lib/python2.7/site-packages/unittest2/case.py xfail tests/unit/nupic/docs/examples_test.py::ExamplesTest::testOneStepConfidencesOpfVsAlgo <- ../../.local/lib/python2.7/site-packages/unittest2/case.py xfail tests/unit/nupic/docs/examples_test.py::ExamplesTest::testOneStepConfidencesOpfVsNetwork <- ../../.local/lib/python2.7/site-packages/unittest2/case.py xfail I'm facing the same issue, My first attempt was directly using pip install nupic, later i tried with --user option and also building from the local repository.

rhyolight commented 6 years ago

@DeepakVellampalli @rvsandeep Are you guys using virtualenv? Like @DeepakVellampalli said, you should not have to use --user with virtualenv

Thanh-Binh commented 6 years ago

@rhyolight I have the same issues with my Ubuntu, which can ONLY solved by using --user. I have no idea why it works sometimes by using --user, sometimes nur by using sudo?

rvsandeep commented 6 years ago

@rhyolight No i'm not using virtualenv. I tried the same steps on my mac as well and it's failing for the above tests as well.
713 passed, 17 skipped, 8 xfailed, 5 pytest-warnings in 210.08 seconds Update I tried using virtualenv and it completed with above message as well. On checking the test that was failing tests/unit/nupic/docs/examples_test.py . There were 8 tests (above failed ones) annoted as expected failure. So is this result expected out of run_test and I'm good to move on or am i missing something here?

DeepakVellampalli commented 6 years ago

@rhyolight I tried using virtualenv but it didn't work, so ended up installing by --user way.

rhyolight commented 6 years ago

You may have the wrong nupic.bindings version. Can you run pip list | grep nupic to find out? If you have anything less than 1.0.6 you should uninstall completely then run pip install nupic again. (thanks @lscheinkman for pointing this out)

DeepakVellampalli commented 6 years ago

@rhyolight You are right, I am having nupic.bindings 1.0.4. I think re-installation will work. Thank you so much!