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.34k stars 1.56k forks source link

Python tests fail #784

Closed chetan51 closed 10 years ago

chetan51 commented 10 years ago

When I run the Python tests after building with the new method, I see the following error:

http://pastebin.com/pmV2PbQ2

breznak commented 10 years ago

Looks like NTA_DATA_PATH needs to be set as well:

  1.                 (datasetPath, os.environ.get('NTA_DATA_PATH',

    '')))

  2. E Exception: Unable to locate: extra/gym/gym.csv using NTA_DATA_PATH of

I (and most of us) don't run these locally (the DB) so you and Travis are the first explorers

chetan51 commented 10 years ago

Can we set it automatically, or at least add it to the README?

breznak commented 10 years ago

If it's a path used in nupic (I guess so?) we could hard-code it to Cmake. But do you need to change it to point to your custom locations of datasets? In that case note to export it in Readme would be imho better. (And probably not necessarily the "main" readme, but Swarming Readme / wiki?)

chetan51 commented 10 years ago

@rhyolight Thoughts?

david-ragazzi commented 10 years ago

And probably not necessarily the "main" readme, but Swarming Readme / wiki?

:+1:

rhyolight commented 10 years ago

NTA_DATA_PATH seems to be already set in CMake:

set_environment_variable(NTA_DATA_PATH "${PROJECT_BUILD_RELEASE_DIR}/share/prediction/data" OFF)

This same failure is occurring in the Grok pipelines as well. It seems that env vars set within cmake are not remaining afterwards, even though they all seem to get set when I run locally.

rhyolight commented 10 years ago

Running tests locally from a fresh shell. I manually unset all nupic-related env vars except for NUPIC.

Got this error:

› make tests_run_all
Scanning dependencies of target tests_run_all
[100%] Python tests + swarming (requires DB)
============================= test session starts ==============================
platform darwin -- Python 2.7.5 -- pytest-2.4.2 -- /usr/bin/python
plugins: cov, xdist
collecting ...
==================================== ERRORS ====================================
___ ERROR collecting tests/integration/py2/nupic/opf/opf_experiments_test.py ___
tests/integration/py2/nupic/opf/opf_experiments_test.py:36: in <module>
>   PREDICTION_DIR = os.path.join(os.environ['NTA'], 'share', 'opf')
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py:23: in __getitem__
>       raise KeyError(key)
E       KeyError: 'NTA'
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.79 seconds ============================
make[3]: *** [CMakeFiles/tests_run_all] Error 2
make[2]: *** [CMakeFiles/tests_run_all.dir/all] Error 2
make[1]: *** [CMakeFiles/tests_run_all.dir/rule] Error 2
make: *** [tests_run_all] Error 2```

Looks like NTA is not set:

› env | grep NTA
NOTHING

But when I start a fresh shell...

› env | grep NTA
NTA=/Users/mtaylor/nta/nupic/build/release
NTA_ROOTDIR=/Users/mtaylor/nta/nupic/build/release
NTA_DATA_PATH=/Users/mtaylor/nta/nupic/build/release/share/prediction/data
NTA_ROOT_DIR=/Users/mtaylor/nta/nupic/build/release

So the environment variables are getting set, but not within the shell environment where cmake ran? @david-ragazzi do you understand this?

breznak commented 10 years ago

@rhyolight You probably added those lines to .bashrc, in the old shell they are not exported, unless you run: source ~/.bashrc in each fresh shell bashrc is sourced at beginning, so they're exported

rhyolight commented 10 years ago

@breznak yes, that was it.

david-ragazzi commented 10 years ago

@rhyolight You probably added those lines to .bashrc, in the old shell they are not exported, unless you run: source ~/.bashrc in each fresh shell bashrc is sourced at beginning, so they're exported

:+1:

rhyolight commented 10 years ago

@chetan51 The README already has the instruction:

export NTA_ROOT_DIR=$NTA

Is this sufficient for you to close this ticket?

We have a PR to remote NTA_ROOT_DIR entirely now, too: https://github.com/numenta/nupic/pull/787

chetan51 commented 10 years ago

I thought this failure is happening because NTA_DATA_PATH is not set?

rhyolight commented 10 years ago

@chetan51 Sorry, it's been a long day.

I don't understand why this is failing for you, though. Everything works for me. Can anyone else replicate this failure?