PyKinect - KeyError: 'MSRKINECTSDK'

Nov 13, 2011 at 3:14 PM
Edited Nov 13, 2011 at 5:13 PM

This is the error i get trying to import nui from pykinect:

Traceback (most recent call last):
  File "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.1\", line 494, in run_file_as_main
    exec(code, self.exec_mod.__dict__, self.exec_mod.__dict__)
  File "C:\Users\Kenny\documents\visual studio 2010\Projects\KinectGame1\KinectGame1\", line 1, in <module>
    from pykinect import nui
  File "C:\Python27\lib\site-packages\pykinect\nui\", line 15, in <module>
    _nuidll_path = os.path.join(os.environ['MSRKINECTSDK'], 'MSRKinectNUI.dll')
  File "C:\Python27\lib\", line 423, in __getitem__


This is the sample code i am trying to run:
from pykinect import nui import pygame from pygame.color import THECOLORS from pygame.locals import * KINECTEVENT = pygame.USEREVENT def post_frame(frame): """Get skeleton events from the Kinect device and post them into the PyGame event queue""" try:, skeletons = frame.SkeletonData)) except: # event queue full pass if __name__ == '__main__': WINSIZE = 640, 480 pygame.init() # Initialize PyGame screen = pygame.display.set_mode(WINSIZE,0,16) pygame.display.set_caption('Python Kinect Game') screen.fill(THECOLORS["black"]) with nui.Runtime() as kinect: kinect.skeleton_engine.enabled = True kinect.skeleton_frame_ready += post_frame # Main game loop while True: e = pygame.event.wait() if e.type == pygame.QUIT: break elif e.type == KINECTEVENT: # process e.skeletons here pass
I'm using the following SDK version:
- KinectSDK-v1.0-beta2-x86.msi (From


Also, i have successfully run the demos that came with the SDK.


Any input on how to resolve this issue is greatly welcome.
Thanks in advance!
Nov 14, 2011 at 8:21 AM

hi kenny,

this is a known issue & will be addressed shortly (Beta in a month).  you can build from sources before that as soon as the fix is posted before that.


Nov 21, 2011 at 12:11 AM

Hi ptools,

I'm so very excited to play with the kinect support you've added! Thanks for your hard work. Is there going to be a fixed posted before the issue is addressed in the beta? Thanks!

Nov 21, 2011 at 4:03 AM


I'm also interested in working with this new API, but im obtaining the same error... Is there any way to solve it now?

I'm doing my undergraded thesis and it would be helpful if i could work with pykinect.


Nov 21, 2011 at 2:05 PM

Hi Rafael,

If you aren't in need of skeleton tracking you can use the SimpleCV python module with the freenect drivers to easily get the depth matrix and control the motor, until this pyKinect issue is fixed. SimpleCV is pretty awesome, and I'm looking forward to using it with PyKinect.