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

Stop requiring $USER to be set #3356

Open scottpurdy opened 8 years ago

scottpurdy commented 8 years ago

Clients should not require the USER environment variable to be set in order to use NuPIC.

vitaly-krugl commented 8 years ago

@scottpurdy, some nupic config files reference USER env var, so it needs to be defined. For example:

vkruglikov@vitalys-mbp:~/nta/nupic (devops184-single-build-multi-tests)$ git grep USER | grep '\.xml'
examples/swarm/test_db.py:USER_CONFIG = "nupic-site.xml"
src/nupic/support/configuration_base.py:USER_CONFIG = "nupic-site.xml"
src/nupic/support/nupic-default.xml:  <value>${env.USER}</value>
src/nupic/swarming/hypersearch/support.py:USER_CONFIG = "nupic-site.xml"
tests/unit/nupic/support/conf/testFile1.xml:    <value>${env.USER}</value>
tests/unit/nupic/support/conf/testFile1.xml:    <value>The user ${env.USER} rocks!</value>
tests/unit/nupic/support/conf/testFile1.xml:    <value>User ${env.USER} and home ${env.HOME} in the middle</value>

And you would get an error like this if it wasn't set:

21-Sep-2016 01:57:13    E     ERR:  Unable to create region Classifier of type SDRClassifierRegion [/home/travis/build/numenta/nupic.core/src/nupic/engine/RegionImplFactory.cpp line 263]
21-Sep-2016 01:57:13    E     Traceback (most recent call last):
21-Sep-2016 01:57:13    E       File "/root/bamboo-agent-home/xml-data/build-dir/BS-NUPIC-TL/tests/integration/nupic/opf/opf_description_template_test/../../../../../scripts/run_opf_experiment.py", line 32, in <module>
21-Sep-2016 01:57:13    E         main()
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/experiment_runner.py", line 878, in main
21-Sep-2016 01:57:13    E         runExperiment(sys.argv[1:])
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/experiment_runner.py", line 156, in runExperiment
21-Sep-2016 01:57:13    E         model = _runExperimentImpl(opt, model)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/experiment_runner.py", line 432, in _runExperimentImpl
21-Sep-2016 01:57:13    E         model = ModelFactory.create(modelDescription)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/modelfactory.py", line 80, in create
21-Sep-2016 01:57:13    E         return modelClass(**modelConfig[\'modelParams\'])
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel.py", line 207, in __init__
21-Sep-2016 01:57:13    E         clParams, anomalyParams)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel.py", line 1153, in __createCLANetwork
21-Sep-2016 01:57:13    E         n.addRegion("Classifier", "py.%s" % str(clRegionName), json.dumps(clParams))
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/engine/__init__.py", line 666, in addRegion
21-Sep-2016 01:57:13    E         engine.Network.addRegion(self, name, nodeType, nodeParams)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/bindings/engine_internal.py", line 1109, in addRegion
21-Sep-2016 01:57:13    E         return _engine_internal.Network_addRegion(self, *args, **kwargs)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/regions/SDRClassifierRegion.py", line 223, in __init__
21-Sep-2016 01:57:13    E         \'nupic.opf.sdrClassifier.implementation\')
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 161, in get
21-Sep-2016 01:57:13    E         return cls.getString(prop)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 80, in getString
21-Sep-2016 01:57:13    E         cls._readStdConfigFiles()
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py", line 143, in _readStdConfigFiles
21-Sep-2016 01:57:13    E         super(Configuration, cls)._readStdConfigFiles()
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 428, in _readStdConfigFiles
21-Sep-2016 01:57:13    E         cls.readConfigFile(DEFAULT_CONFIG)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 218, in readConfigFile
21-Sep-2016 01:57:13    E         properties = cls._readConfigFile(filename, path)
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 338, in _readConfigFile
21-Sep-2016 01:57:13    E         " variable %r, which is not defined" % (varname))
21-Sep-2016 01:57:13    E     RuntimeError: Attempting to use the value of the environment variable \'USER\', which is not defined
21-Sep-2016 01:57:13    E     ', 'stdoutData': '2016-09-21 01:57:13,308 - com.numenta.nupic.tools.configuration_base(12749) - ERROR - Error while parsing configuration file: None.
21-Sep-2016 01:57:13    E     Traceback (most recent call last):
21-Sep-2016 01:57:13    E       File "/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py", line 338, in _readConfigFile
21-Sep-2016 01:57:13    E         " variable %r, which is not defined" % (varname))
21-Sep-2016 01:57:13    E     RuntimeError: Attempting to use the value of the environment variable \'USER\', which is not defined
21-Sep-2016 01:57:13    E     ', 'exitStatus': 1}}]}
vitaly-krugl commented 8 years ago

@scottpurdy, I think it was only an issue with our bamboo docker environment configuration. I don't recall ever running into this issue with linux, osx, and windows.

scottpurdy commented 8 years ago

I know we had to work around it in CI pre-Bamboo. Not sure which platforms required it. But it doesn't really matter as I see no reason why we should require any environment variables to be set.

marchezinixd commented 7 years ago

Hello,

I just ran the code 'import os import pprint

from nupic.swarming import permutations_runner from swarm_description import SWARM_DESCRIPTION'

and got the following error: Attempting to use the value of the environment variable 'USER', which is not defined in the line: 'from nupic.swarming import permutations_runner' also this warning show up: 'No handlers could be found for logger "com.numenta.nupic.tools.configuration_base" ' Thanks

rhyolight commented 7 years ago

@marchezinixd Thanks for the update. The quick fix is to set USER to your username:

export USER=yourusername

The 2nd error is a bit more concerning. I might suggest you post on HTM Forum about this.

marchezinixd commented 7 years ago

I was able to solve it setting the Variable, if anyone have the same problema on windows you should run:

setx USER your_computer_username

in my case was:

setx USER guilherme

Remember to run the terminal as admin, to restart the computer after the command and to put the username you are logged to run the code.

For the second error, it solved itself after solving the first.

Thanks @rhyolight for your help.

way-sal commented 6 years ago

i have this problem on windowes bb