buresu / ndi-python

NewTek NDI Python wrapper
MIT License
133 stars 30 forks source link

Unable to import loaded module. #1

Open medcelerate opened 4 years ago

medcelerate commented 4 years ago

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'
buresu commented 4 years ago

@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
Hantoo commented 4 years ago

Are these files generated upon build?

medcelerate commented 4 years ago

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 notifications@github.com 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 .

Hantoo commented 4 years ago

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?

pasanm2 commented 4 years ago

Did anyone find a solution?

medcelerate commented 4 years ago

Unfortunately I haven’t yet.

On Sun, Jun 14, 2020 at 3:56 PM pasanm2 notifications@github.com 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 .

Hantoo commented 4 years ago

I didn't either. I had success with pyNDI

pasanm2 commented 4 years ago

Thanks for the suggestion. Will give it a try!

Murplugg commented 4 years ago

Got examples to work with NDI SDK 4.5 (latest) installed on Ubuntu 20.4, just moved the built file _NDIlib.cpython-38-x8664-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).

tadashiokoshi commented 3 years ago

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

joytsay commented 2 years ago

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!

simulateduniverse commented 2 years ago

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?

joytsay commented 2 years ago

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)

buresu commented 2 years ago

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

pip install ndi-python
Nimisha-Pabbichetty commented 2 years ago

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

rayandaod commented 2 years ago

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
buresu commented 2 years ago

@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 commented 2 years ago

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

pip install ndi-python --force
rayandaod commented 2 years ago

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 commented 2 years ago

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!

buresu commented 2 years ago

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

hendryman commented 1 year ago

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?

altarbeast commented 1 year ago

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?

rqtqp commented 7 months ago

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

vj-valbuena commented 1 month ago

@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

Hello, I copy and paste this command for mac, but I still get the same error " mport NDIlib as ndi ModuleNotFoundError: No module named 'NDIlib".. has anyone solved this today?