pytesseract
is only wrapper on program tesseract
(OCR developed by Google)
tesseract
needs files with languages which you can find in its documentation: Data Files.
You can download ara.traineddata to some folder and run it with option --tessdata-dir some_folder
and then it will use ara.traineddata
from this folder.
If you save ara.traineddata
in the same folder as you run code then you can use .
(dot)
tesseract image.jpg stdout -l ara --tessdata-dir .
And the same you can do in pytesseract
using config=
import pytesseract
text = pytesseract.image_to_string('image.jpg', lang='ara', config='--tessdata-dir .')
print(text)
Eventually you can use environment variable TESSDATA_PREFIX
for this
import pytesseract
import os
os.environ['TESSDATA_PREFIX'] = '.'
text = pytesseract.image_to_string('text-ara.jpg', lang='ara')
print(text)
Later you can set TESSDATA_PREFIX
directly in system or you may try to move ara.traineddata
to folder with other files .traineddata
. There should be somewhere eng.traineddata
which you can try to find with programs/command like find
I tested it with this image which I found also in documentation: Command Line Usage

BTW: tesseract
normally saves text in file but if you use stdout
then it displays text in console.