ndi-python icon indicating copy to clipboard operation
ndi-python copied to clipboard

Unable to import loaded module.

Open medcelerate opened this issue 4 years ago • 24 comments

I compiled the module successfuly but attempting to load it while in the same directory as the so fields yields the below error.

Traceback (most recent call last):
  File "input.py", line 3, in <module>
    import NDIlib as ndi
ModuleNotFoundError: No module named 'NDIlib'

medcelerate avatar May 12 '20 17:05 medcelerate

@medcelerate What OS are you using? In windows, you needs to copy the following libraries to execute directory.

NDIlib.cp**-win_amd64.pyd
Processing.NDI.Lib.x64.dll

In macOS,

NDIlib.cpython-**m-darwin.so
libndi.4.dylib

buresu avatar May 13 '20 02:05 buresu

Are these files generated upon build?

Hantoo avatar May 14 '20 12:05 Hantoo

Let me try copying the Dylib to the folder. I need to see the exact file generated but it is and NDIlib*.so file

On Thu, May 14, 2020 at 8:49 AM Joel L B [email protected] wrote:

Are these files generated upon build?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/buresu/ndi-python/issues/1#issuecomment-628611606, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYKRGJQX7FCP2CROXEXHQ3RRPSFDANCNFSM4M7AARAQ .

medcelerate avatar May 14 '20 12:05 medcelerate

Interesting, I seem to be missing some files then. I'm building with NDI 4.5 SDK. Is this the right SDK version to be using? or was this made for NDI 3.x?

Hantoo avatar May 14 '20 12:05 Hantoo

Did anyone find a solution?

pasanm2 avatar Jun 14 '20 19:06 pasanm2

Unfortunately I haven’t yet.

On Sun, Jun 14, 2020 at 3:56 PM pasanm2 [email protected] wrote:

Did anyone find a solution?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/buresu/ndi-python/issues/1#issuecomment-643814395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYKRGNO2WWOUJTUABH3MODRWUTNBANCNFSM4M7AARAQ .

medcelerate avatar Jun 14 '20 19:06 medcelerate

I didn't either. I had success with pyNDI

Hantoo avatar Jun 14 '20 20:06 Hantoo

Thanks for the suggestion. Will give it a try!

pasanm2 avatar Jun 14 '20 20:06 pasanm2

Got examples to work with NDI SDK 4.5 (latest) installed on Ubuntu 20.4, just moved the built file NDIlib.cpython-38-x86_64-linux-gnu.so into the examples folder. Should be possible to install the lib to Python site-packages but I'm unsure how at the moment. Simpler solutions to access the lib is by setting up a custom folder wherein you put a symlink to the built lib file I mentioned, following the steps here: https://askubuntu.com/a/250935 (Linux OS only).

Murplugg avatar Jul 16 '20 15:07 Murplugg

On Windows, I cannot find "Processing.NDI.Lib.x64.dll" after build process.

mkdir build cd build cmake .. cmake --build . --config Release

After this, files I see in Release directory are following 3, not including the "Processing..." file.

NDIlib.cp38-win_amd64.pyd NDIlib.exp NDIlib.lib

tadashiokoshi avatar Sep 26 '20 11:09 tadashiokoshi

On Windows, I cannot find "Processing.NDI.Lib.x64.dll" after build process.

mkdir build cd build cmake .. cmake --build . --config Release

After this, files I see in Release directory are following 3, not including the "Processing..." file.

NDIlib.cp38-win_amd64.pyd NDIlib.exp NDIlib.lib

On windows the Processing.NDI.Lib.x64.dll is located at C:\Program Files\NDI\NDI 5 SDK\Bin\x64 after installing NDI 5 SDK from https://www.ndi.tv/sdk/ copy Processing.NDI.Lib.x64.dll to your example folder and you will be good to go!

joytsay avatar Nov 04 '21 04:11 joytsay

I've exactly did what you say but nothings happens. Also my files don't have .dll extension but only .lib.

Does someone know a way to import NDI module correctly?

simulateduniverse avatar Jan 11 '22 17:01 simulateduniverse

I've exactly did what you say but nothings happens. Also my files don't have .dll extension but only .lib.

Does someone know a way to import NDI module correctly?

Sorry the dll is located at C:\Program Files\NDI\NDI 5 SDK\Bin\x64 ( I corrected the original reply above)

joytsay avatar Jan 12 '22 03:01 joytsay

Sorry for late reply. ndi-python support pypi repository now. Please try to install it from pip.

pip install ndi-python

buresu avatar Mar 22 '22 08:03 buresu

Solved this issue on Ubuntu 20 and NDI 5 SDK as follows:

You just need to set LD_LIBRARY_PATH to include the folder in which the shared libraries are present. For me, sourcing the lib.linux-x86_64-3.8 inside the build folder solved the error.

Eg: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ndi-python/build/lib.linux-x86_64-3.8/NDIlib:$LD_LIBRARY_PATH

Nimisha-Pabbichetty avatar Apr 22 '22 13:04 Nimisha-Pabbichetty

Hello,

I have difficulties running the examples on macos (Apple Silicon chip):

Screenshot 2022-05-20 at 23 10 25

I followed these steps:

Screenshot 2022-05-20 at 23 07 58

And here is the output (seems to work):

Screenshot 2022-05-20 at 23 09 03

Then I copied the files that were created in the examples directory:

Screenshot 2022-05-20 at 23 08 16

But this still doesn't work... Am I missing something?

Thank you,

Rayan

Edit: I should add that with pip it does not work either and I obtain the error below Screenshot 2022-05-21 at 12 38 39

rayandaod avatar May 20 '22 21:05 rayandaod

@rayandaod Hi I have tried to support arm cross-compilation on mac with the latest build 4117651c8aeef18ee2cce7dfe90269841edbdb29. Please pull the latest changes and rebuild.

git pull
git clean -fdx
python setup.py build

and check the supported architectures.

file NDIlib.cpython-37m-darwin.so

If you get the following output, you have cross-compiled binary.

NDIlib.cpython-37m-darwin.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
NDIlib.cpython-37m-darwin.so (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
NDIlib.cpython-37m-darwin.so (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

Unfortunately I don't have an m1 mac so I can't confirm it works :( And pip binary is only supported for x86_64 now.

buresu avatar May 21 '22 10:05 buresu

I uploaded cross-compiled binary to pypi. Please try to run pip install again.

pip install ndi-python --force

buresu avatar May 21 '22 11:05 buresu

Hello @buresu!

Thank you for your answer.

I have done what you suggested and I indeed obtain the expected output:

NDIlib.cpython-37m-darwin.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
NDIlib.cpython-37m-darwin.so (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
NDIlib.cpython-37m-darwin.so (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

Unfortunately, I still can't run the example scripts (No module named 'NDIlib' error remains)... Am I adding the right files to the examples folder (cf screen capture previously sent)?

I also tried with pip again by removing the cache and running the command you sent, but the result is the same as before.

Thank you, Rayan

rayandaod avatar May 22 '22 10:05 rayandaod

I have finally managed to make it work by running the scripts with /opt/homebrew/bin/python3 instead of usr/bin/python3 😅 I guess I wasn't using the right python installation. Thank you for your help!

rayandaod avatar May 22 '22 10:05 rayandaod

@rayandaod Thank you for trying. I'm glad you were able to solve it!

buresu avatar May 22 '22 11:05 buresu

I am on a Macbook Pro M1, installed ndi-python sucessfully from PyPi and NDI SDK 5 from NDI's official installer. Still, upon running the Python example scripts, I get this error:

import NDIlib as ndi
ModuleNotFoundError: No module named 'NDIlib'

What am I doing wrong?

hendryman avatar May 23 '23 15:05 hendryman

I am still unable to run any of the examples on Windows... same error, even after copying the suggested dll to the examples folder "Processing.NDI.Lib.x64.dll" still the same error:

``ModuleNotFoundError: No module named 'NDIlib.NDIlib'

Even trying with different version of Python but no luck... same error every time.

Any workaround?

altarbeast avatar Jun 08 '23 05:06 altarbeast

I am still unable to run any of the examples on Windows... same error, even after copying the suggested dll to the examples folder "Processing.NDI.Lib.x64.dll" still the same error:

``ModuleNotFoundError: No module named 'NDIlib.NDIlib'

Even trying with different version of Python but no luck... same error every time.

Any workaround?

Experiencing the same issues. I was able to compile it from source and I assume I have all files needed accessible in PATH image

NDI SDK also installed properly.

image

rqtqp avatar Jan 09 '24 08:01 rqtqp