Skip to content

Can't import python3 wrapper (ModuleNotFoundError: No module named 'freenect') #683

Description

@Looki2000

I'm trying to build libfreenect wrapper for python 3 on Raspberry OS (pi 3 B) but I can't import it. There are no errrors when building it. (freenect-glview is working fine) Running python3 with sudo and restarting the terminal does not help. freenect is not present in pip list
I have tried to follow the official build Instructions and this (I had to set DCYTHON_EXECUTABLE to /usr/local/bin/cython).
How can I fix that?

Activity

  1. Looki2000 commented on Mar 6, 2024

    @Looki2000
    Author

    I managed to make it work by copying freenect.so into every possible site-packages and dist-packages locations of python3/3.9 and it started to work. Sadly, it's not very smooth, spams a lot of [Stream 70] Invalid magic ####, the IR projector stays on after everything closes and I have to run freenect-micview each time I plug in the Kinect to upload the firmware. (Kinect for Windows).
    I think I will try to make the official primesense python library work on ARM raspi.

  2. XHao1997 commented on Mar 23, 2025

    @XHao1997

    Hi @Looki2000 , I met the same problem when installing in ubuntu20.04. Could you explain why you copy to python3.9? Is it the default version of your pi?

  3. aidan-octane commented on Apr 3, 2025

    @aidan-octane

    I managed to make it work by copying freenect.so into every possible site-packages and dist-packages locations of python3/3.9 and it started to work. Sadly, it's not very smooth, spams a lot of [Stream 70] Invalid magic ####, the IR projector stays on after everything closes and I have to run freenect-micview each time I plug in the Kinect to upload the firmware. (Kinect for Windows). I think I will try to make the official primesense python library work on ARM raspi.

    I'm also trying to get this to work on a raspi, and am facing the same issue. I would greatly appreciate hearing what you did to get this working, or if you were able to at all.

  4. Looki2000 commented on Apr 16, 2025

    @Looki2000
    Author

    It's been a while, so I don’t remember exactly how I did it. From what I recall, after building freenect, it creates a freenect.so file somewhere, but you can’t just import it in Python right away. It doesn’t actually install it. It just builds the library. So what I ended up doing was kinda brute-forcing it: I copied that .so file into the site-packages and dist-packages folders in all the Python versions I had installed. Somehow, it started importing and working.
    Copying only to the version of Python you are using should do the job, but I am unsure where should you put it - site-packages, dist-packages or both.
    Keep in mind that this is a software driver and that the frame rate will likely be very low, especially on Raspberry Pi. Sadly, the official Primesense Python library does not work with Kinect because of Microsoft copyright or something, idk. It only works with Primesense Carmine, Asus Xtion or some other oem version of this sensor..

  5. hbmartin commented on May 14, 2025

    @hbmartin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions