ModuleNotFoundError: No module named 'ultimateAlprSdk'

1,313 views
Skip to first unread message

Fredrik

unread,
Jan 25, 2021, 5:54:13 PM1/25/21
to doubango-ai

Hi,
I have installed the SDK via git clone and done according to the documentation with python extensions and optimized models. C++ Compiled benchmark  and recognition runs fine in terminal!
When trying to implement in python the import statement will cause the following error
ModuleNotFoundError: No module named 'ultimateAlprSdk'

Seems that I tried severals ways and read the documentation..... but I am stuck any suggestions?
I am running on a jetson nano with jetpack 4.4.1
used the jetson binaries

Regards
Fredrik

Mamadou DIOP

unread,
Jan 25, 2021, 9:53:41 PM1/25/21
to Fredrik, doubango-ai
Hi,

1/ Make sure you have built the extension as explained at https://github.com/DoubangoTelecom/ultimateALPR-SDK/tree/master/python#building. Looks like you did it as there is no complain about missing "_ultimateAlprSdk.so"


3/ Run the recognizer as per https://github.com/DoubangoTelecom/ultimateALPR-SDK/tree/master/samples/python/recognizer#try and don't forget PYTHONPATH=$PYTHONPATH:.:../../../python

You're getting this error because we fail to find ultimateAlprSdk.py file from https://github.com/DoubangoTelecom/ultimateALPR-SDK/blob/master/python/ultimateAlprSdk.py, my guess is you PYTHONPATH not set or incorrect. The name of the extension is "_ultimateAlprSdk" (notice the underscore), so the complaint is about the file not the sharedlib


Sent from my Galaxy
--
You received this message because you are subscribed to the Google Groups "doubango-ai" group.
To unsubscribe from this group and stop receiving emails from it, send an email to doubango-ai...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/doubango-ai/5262ce9a-cf6a-437b-a307-dae580d3a71en%40googlegroups.com.

Fredrik

unread,
Jan 26, 2021, 8:15:48 AM1/26/21
to doubango-ai
Hi,
Thank you for fast answer!
1. _ultimateAlprSdk.so  is built and placed in the binaries folder. I used python3 (3.6)
2. Yes I am inside the folder
3. I have set the PYTHONPATH
Running recognizer.py --image will give the following error codes

user@user-desktop:~/ultimateALPR-SDK/binaries/jetson/aarch64$ echo $PYTHONPATH

:/home/user/swig:/home/user/ultimateALPR-SDK:/home/user/ultimateALPR-SDK/python:/home/user/ultimateALPR-SDK/binaries/jetson/aarch64

user@user-desktop:~/ultimateALPR-SDK/binaries/jetson/aarch64$ python3 /home/user/ultimateALPR-SDK/samples/python/recognizer/recognizer.py --image /home/user/ultimateALPR-SDK/assets/images/lic_us_1280x720.jpg

Traceback (most recent call last):

File "/home/user/ultimateALPR-SDK/python/ultimateAlprSdk.py", line 16, in swig_import_helper

fp, pathname, description = imp.find_module('_ultimateAlprSdk', [dirname(__file__)])

File "/usr/lib/python3.6/imp.py", line 297, in find_module

raise ImportError(_ERR_MSG.format(name), name=name)

ImportError: No module named '_ultimateAlprSdk'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "/home/user/ultimateALPR-SDK/samples/python/recognizer/recognizer.py", line 25, in <module>

import ultimateAlprSdk

File "/home/user/ultimateALPR-SDK/python/ultimateAlprSdk.py", line 26, in <module>

_ultimateAlprSdk = swig_import_helper()

File "/home/user/ultimateALPR-SDK/python/ultimateAlprSdk.py", line 18, in swig_import_helper

import _ultimateAlprSdk

ImportError: libultimate_alpr-sdk.so: cannot open shared object file: No such file or directory

user@user-desktop:~/ultimateALPR-SDK/binaries/jetson/aarch64$ ls

benchmark libultimate_alpr-sdk.so prepare.sh recognizer symlinks.bat _ultimateAlprSdk.so

build libultimatePluginTensorRT.so python_setup.sh runtimeKey trt_optimizer

user@user-desktop:~/ultimateALPR-SDK/binaries/jetson/aarch64$


/Fredrik

Mamadou DIOP

unread,
Jan 26, 2021, 8:29:02 AM1/26/21
to Fredrik, doubango-ai

Hum, you're missing multiple points, for sure it'll not find the libs if you're not calling ldconfig or setting LD_LIBRARY_PATH

Just run the next command as defined in the wiki (from binaries/jetson/aarch64), do not change it:

PYTHONPATH=$PYTHONPATH:.:../../../python \
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
python3 ../../../samples/python/recognizer/recognizer.py --image ../../../assets/images/lic_us_1280x720.jpg --assets ../../../assets
and share the logs if it doesn't work.

Mamadou DIOP

unread,
Jan 26, 2021, 8:31:18 AM1/26/21
to Fredrik, doubango-ai


On 1/26/2021 2:28 PM, Mamadou DIOP wrote:

Hum, you're missing multiple points, for sure it'll not find the libs if you're not calling ldconfig or setting LD_LIBRARY_PATH

Just run the next command as defined in the wiki (from binaries/jetson/aarch64), do not change it:

PYTHONPATH=$PYTHONPATH:.:../../../python \
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
python3 ../../../samples/python/recognizer/recognizer.py --image ../../../assets/images/lic_us_1280x720.jpg --assets ../../../assets
Note: This is a single line command

Fredrik

unread,
Jan 26, 2021, 2:52:24 PM1/26/21
to doubango-ai
Hi,
I have tried this code before and the result is the same, see below

user@user-desktop:~/ultimateALPR-SDK/binaries/jetson/aarch64$ PYTHONPATH=$PYTHONPATH:.:../../../python \

> LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \
> python3 ../../../samples/python/recognizer/recognizer.py --image ../../../assets/images/lic_us_1280x720.jpg --assets ../../../assets
Traceback (most recent call last):
  File "../../../samples/python/recognizer/recognizer.py", line 31, in <module>
    from PIL import Image, ExifTags
ModuleNotFoundError: No module named 'PIL'


/ Fredrik

Mamadou DIOP

unread,
Jan 26, 2021, 8:35:47 PM1/26/21
to Fredrik, doubango-ai
Nope, this is completely different now.

Now, it's just complaining about missing package, this is basic Python errors and you may have more and should learn how do deal with.

Try: 

pip3 install Pillow

As explained at


If you get another 

"ModuleNotFoundError: No module named 'XXXX"

just Google it

We'll add a requirements.txt file listing the required packages
Reply all
Reply to author
Forward
0 new messages