Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import loaded module. #1

Open
medcelerate opened this issue May 12, 2020 · 25 comments
Open

Unable to import loaded module. #1

medcelerate opened this issue May 12, 2020 · 25 comments
Assignees
Labels
bug Something isn't working confirmed

Comments

@medcelerate
Copy link

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
Copy link
Owner

buresu commented May 13, 2020

@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
Copy link

Hantoo commented May 14, 2020

Are these files generated upon build?

@medcelerate
Copy link
Author

medcelerate commented May 14, 2020 via email

@Hantoo
Copy link

Hantoo commented May 14, 2020

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
Copy link

pasanm2 commented Jun 14, 2020

Did anyone find a solution?

@medcelerate
Copy link
Author

medcelerate commented Jun 14, 2020 via email

@Hantoo
Copy link

Hantoo commented Jun 14, 2020

I didn't either.
I had success with pyNDI

@pasanm2
Copy link

pasanm2 commented Jun 14, 2020

Thanks for the suggestion. Will give it a try!

@Murplugg
Copy link

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).

@tadashiokoshi
Copy link

tadashiokoshi commented Sep 26, 2020

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
Copy link

joytsay commented Nov 4, 2021

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
Copy link

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
Copy link

joytsay commented Jan 12, 2022

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
Copy link
Owner

buresu commented Mar 22, 2022

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

pip install ndi-python

@buresu buresu self-assigned this Mar 22, 2022
@buresu buresu added bug Something isn't working confirmed labels Mar 22, 2022
@Nimisha-Pabbichetty
Copy link

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
Copy link

rayandaod commented May 20, 2022

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
Copy link
Owner

buresu commented May 21, 2022

@rayandaod Hi
I have tried to support arm cross-compilation on mac with the latest build 4117651.
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
Copy link
Owner

buresu commented May 21, 2022

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

pip install ndi-python --force

@rayandaod
Copy link

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
Copy link

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
Copy link
Owner

buresu commented May 22, 2022

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

@hendryman
Copy link

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
Copy link

altarbeast commented Jun 8, 2023

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
Copy link

rqtqp commented Jan 9, 2024

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
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests