I installed OpenALPR itself fine and I was able to run it in terminal to get this result:
C:\Users\zebsu>"C:\\OpenALPR\\Agent\\bin\\alpr.exe" "C:\\plate.jpg"
plate0: 3 results
State ID: us-oh (97% confidence)
- PZ65BYV confidence: 94.5181 pattern_match: 0
- P265BYV confidence: 81.1941 pattern_match: 0
- P65BYV confidence: 81.1336 pattern_match: 0
However, I then followed the instructions found on PyPI (https://pypi.org/project/openalpr/#description) to install the openalpr python bindings with pip install openalpr. But when I run the following code that they suggest with python 3.8.6 x64:
import json
from openalpr import Alpr
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
if not alpr.is_loaded():
print("Error loading OpenALPR")
sys.exit(1)
results = alpr.recognize_file("C:/image.jpg")
print(json.dumps(results, indent=4))
alpr.unload()
I get the following error:
Traceback (most recent call last):
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\site-packages\openalpr\openalpr.py", line 70, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalpr.dll")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libopenalpr.dll' (or one of its dependencies). Try using the full path with constructor syntax.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\zebsu\OneDrive\compuuter science\work\LPR\LPR_test.py", line 4, in <module>
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python38\lib\site-packages\openalpr\openalpr.py", line 80, in __init__
raise nex
OSError: Unable to locate the OpenALPR library. Please make sure that OpenALPR is properly installed on your system and that the libraries are in the appropriate paths.
And this is the error that I get if I run the code with python 3.6.8 x32:
Traceback (most recent call last):
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\openalpr\openalpr.py", line 70, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalpr.dll")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\zebsu\OneDrive\compuuter science\work\LPR\LPR_test.py", line 4, in <module>
alpr = Alpr("us", "C:/OpenALPR/Agent/etc/openalpr/openalpr.conf", "C:/OpenALPR/Agent/usr/share/openalpr/configruntime_data")
File "C:\Users\zebsu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\openalpr\openalpr.py", line 80, in __init__
raise nex
OSError: Unable to locate the OpenALPR library. Please make sure that OpenALPR is properly installed on your system and that the libraries are in the appropriate paths.
I've scoured all the internet forums looking for answers however most of the submissions are from years back before the openalpr bindings could be installed with pip and had to be installed from github. Does anyone have any advice?
I ended up finding the solution from the answer to a question on another thread with a similar error but with a different library: FileNotFoundError: Could not find module 'libvlc.dll'. The issue was that the program had no way to find the dll files it needed so the directory where the dll files are needs to be added to the os in the python code. For me this meant adding these lines to the top of my code:
import os
os.add_dll_directory("C:/OpenALPR/Agent/bin")
This change meant that the code ran exactly as it was supposed to.
Related
I installed the latest (0.1.12) version of Datawig module. I've considered all the package requirements:
scikit-learn[alldeps]==0.22.1
typing==3.6.6
pandas==0.25.3
mxnet==1.4.0
But when I run the script,
import datawig
I get this error:
Traceback (most recent call last):
File "C:/Users/PC/Desktop/python_ummd/venv/Lib/imputation.py", line 7, in
import datawig
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\datawig_init_.py", line 2, in
from .column_encoders import CategoricalEncoder, BowEncoder, NumericalEncoder, SequentialEncoder
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\datawig\column_encoders.py", line 26, in
import mxnet as mx
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\mxnet_init_.py", line 24, in
from .context import Context, current_context, cpu, gpu, cpu_pinned
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\mxnet\context.py", line 24, in
from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\mxnet\base.py", line 213, in
_LIB = _load_lib()
File "C:\Users\PC\Desktop\untitled1\venv\bin\lib\site-packages\mxnet\base.py", line 204, in load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\ctypes_init.py", line 364, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
I want to use SimpleImputer. I use Windows [Version 10.0.18363.836], Python 3.7.7, Pycharm 2020.1.1.
I don't have a windows machine at my hands, so can't confirm but maybe using the same python bit-width as your dll will help, see here: https://github.com/apache/incubator-mxnet/issues/1740
You can try a Python version different from the one where you encountered the error (32bit or 64bit).
I have a Raspberry PI and I want to automatically open a website at boot time.
So I made an auto start config to run a python (v.3.5.3) script on boot.
The python script looks like this:
import os
import subprocess
subprocess.call([/home/pi/Desktop/Shortcut Final.desktop])
But I get the error:
Traceback (most recent call last): File "/home/pi/myscript.py", line 3
subprocess.call([/home/pi/Desktop/Shortcut Final.desktop])
^ SyntaxError: invalid syntax
I got my instructions from a guide that used windows file location, so I think the error is that my file location dont start with a directory letter like C:, but I dont think raspbian use the same system.
I have not found any other guides that explain how to accomplish the same thing in simple terms (as i only know very basic python coding)
I have looked into the open() command, but it seemed complicated.
Any tips on how to accomplish my goal/solve the error?
After putting the file location in quotes the syntax error disappears and i encounter a new error:
Traceback (most recent call last):
File "/home/pi/myscript.py", line 5, in <module>
subprocess.call(["/home/pi/Desktop/Shortcut Final.desktop"])
File "/usr/lib/python3.5/subprocess.py", line 247, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I'm a newbie to Python, While learning imgkit (PI module) I got this error which was not expected for a simple code. Below is the code
import imgkit
imgkit.from_url('https://www.google.co.in/','fs.jpg')
and the error which I got is
Traceback (most recent call last):
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\config.py", line 30, in __init__
with open(self.wkhtmltoimage):
FileNotFoundError: [Errno 2] No such file or directory: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ALEXANDER\Desktop\def img.py", line 3, in <module>
imgkit.from_url('https://www.google.co.in/','fs.jpg')
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\api.py", line 20, in from_url
rtn = IMGKit(url, 'url', options=options, toc=toc, cover=cover, config=config, cover_first=cover_first)
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\imgkit.py", line 34, in __init__
self.config = Config() if not config else config
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\config.py", line 36, in __init__
'http://wkhtmltopdf.org\n'.format(self.wkhtmltoimage))
OSError: No wkhtmltoimage executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - http://wkhtmltopdf.org
Could anyone tell me what mistake I have done.
you need to these lines after installing wkhtmltopdf on your windows system:
path_wkthmltoimage = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage.exe'
config = imgkit.config(wkhtmltoimage=path_wkthmltoimage)
imgkit.from_file('table.html', 'table.jpg',config=config)
try: brew install caskroom/cask/wkhtmltopdf
It looks like you need to install wkhtmltopdf. To do so, run pip install wkhtmltopdf
I am using Cygwin (2.2.1) on wind7 to run a python script that loads a dll and I tried using cdll form ctypes. However I get OSError: Exec format error when I run the script, and I do not know how to deal with it. I also tried giving the path to the file, but the issue seems to be elsewhere.
>>> from ctypes import *
>>> cdll.LoadLibrary("DECO_CalInterface.dll")
Traceback (most recent call last):
File "DECOInitialization.py", line 18, in <module>
cdll.LoadLibrary("DECO_CalInterface.dll")
File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Exec format error
I'm following the guide found here:
http://www.dalkescientific.com/writings/NBN/c_extensions.html
for creating C extensions to python. But when I try to run any python program after building that module, such as the first one listed or mandelbrot.py (listed towards the end of the page). I get the error on the line libc = ctypes.CDLL("libc.dylib", ctypes.RTLD_GLOBAL)
The error is:
Traceback (most recent call last):
File "cos.py", line 5, in < module >
libc = ctypes.CDLL("libc.dylib", ctypes.RTLD_GLOBAL)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libc.dylib: cannot open shared object file: No such file or directory
I'm using Linux so I'm not sure if that is the problem. And if it is, how would I accomplish this on Linux? I know dll is how Windows refers to shared objects. But does the syntax change? I can't seem to find an answer anywhere.
On GNU/Linux the cos() function is located in a library called libm.so. So you need to replace "libc.dylib" with "libm.so".