Hello Nupic community!
I’ve been learning how to use Nupic and haven’t had any issues running anomaly
and prediction examples. However, I’m unable to swarm and, for some reason, I
cannot extract config values from nupic-default.xml.
For example, when I run the first lines of test_db.py to check that Mysql is
properly configured, I get the following:
--
import pymysql
from nupic.support.configuration import Configuration
# Get the values we need from NuPIC's configuration
host = Configuration.get('nupic.cluster.database.host')
print host
None
—
Same with this piece of code found in configuration_base.py
—
In [1]:
import os
print os.path.join(os.environ['NUPIC'], 'config', 'default')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-1-38503c7530aa> in <module>()
1 import os
2
----> 3 print os.path.join(os.environ['NUPIC'], 'config', 'default')
/usr/lib/python2.7/UserDict.pyc in __getitem__(self, key)
21 if hasattr(self.__class__, "__missing__"):
22 return self.__class__.__missing__(self, key)
---> 23 raise KeyError(key)
24 def __setitem__(self, key, item): self.data[key] = item
25 def __delitem__(self, key): del self.data[key]
KeyError: 'NUPIC'
—
Here’s an output of os.environ
In [3]:
print os.environ
{'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'UPSTART_EVENTS': 'started
xsession', 'LESSOPEN': '| /usr/bin/lesspipe %s', 'LOGNAME': 'adminuser',
'WINDOWID': '31457287', 'PATH':
'/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
'XDG_VTNR': '7', 'GNOME_KEYRING_CONTROL': '/run/user/1000/keyring-N6R7vi',
'DISPLAY': ':0', 'SSH_AGENT_PID': '1162', 'LANG': 'en_US.UTF-8', 'TERM':
'xterm-color', 'SHELL': '/bin/bash', 'XDG_SESSION_PATH':
'/org/freedesktop/DisplayManager/Session0', 'XAUTHORITY':
'/home/adminuser/.Xauthority', 'LANGUAGE': 'en_US', 'SESSION_MANAGER':
'local/virtualboximagescom-VirtualBox-14:@/tmp/.ICE-unix/1240,unix/virtualboximagescom-VirtualBox-14:/tmp/.ICE-unix/1240',
'SHLVL': '1', 'MANDATORY_PATH': '/usr/share/gconf/ubuntu.mandatory.path',
'CLUTTER_IM_MODULE': 'xim', 'UPSTART_INSTANCE': '', 'JOB': 'dbus',
'TEXTDOMAIN': 'im-config', 'LIBGL_ALWAYS_SOFTWARE': '1', 'SESSIONTYPE':
'gnome-session', 'XMODIFIERS': '@im=ibus', 'GPG_AGENT_INFO':
'/run/user/1000/keyring-N6R7vi/gpg:0:1', 'HOME': '/home/adminuser',
'QT4_IM_MODULE': 'xim', 'SSH_AUTH_SOCK': '/run/user/1000/keyring-N6R7vi/ssh',
'XDG_RUNTIME_DIR': '/run/user/1000', 'GTK_IM_MODULE': 'ibus',
'COMPIZ_CONFIG_PROFILE': 'ubuntu', 'COMPIZ_BIN_PATH': '/usr/bin/',
'VTE_VERSION': '3408', 'GDMSESSION': 'ubuntu', 'IM_CONFIG_PHASE': '1',
'UPSTART_JOB': 'gnome-session', 'TEXTDOMAINDIR': '/usr/share/locale/',
'GIT_PAGER': 'cat', 'XDG_DATA_DIRS':
'/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/',
'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0', 'XDG_CONFIG_DIRS':
'/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg', 'XDG_CURRENT_DESKTOP':
'Unity', 'XDG_SESSION_ID': 'c1', 'DBUS_SESSION_BUS_ADDRESS':
'unix:abstract=/tmp/dbus-80aFGE7FFS', '_': '/usr/local/bin/ipython',
'GTK_MODULES': 'overlay-scrollbar:unity-gtk-module', 'SESSION': 'ubuntu',
'DESKTOP_SESSION': 'ubuntu', 'UPSTART_SESSION':
'unix:abstract=/com/ubuntu/upstart-session/1000/947', 'LESSCLOSE':
'/usr/bin/lesspipe %s %s', 'DEFAULTS_PATH':
'/usr/share/gconf/ubuntu.default.path', 'UBUNTU_MENUPROXY': '1', 'XDG_SEAT':
'seat0', 'GDM_LANG': 'en_US', 'CLICOLOR': '1', 'INSTANCE': '', 'PWD':
'/home/adminuser', 'COLORTERM': 'gnome-terminal', 'XDG_MENU_PREFIX': 'gnome-',
'LS_COLORS':
'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:',
'PAGER': 'cat', 'USER': 'adminuser'}
—
Anybody know what i’m doing (or not doing) wrong? Should I see paths of NUPIC
and NTA_CONF_PATH in os.environ?
Thanks for your help!
Ghislain