I created a script to extract data from a pdf using tabula-py and PyPDF2. When I run my program through Jupyter-notebook and from the cmd, it works perfectly. After converting it to executable with pyinstaller, I get this error:
Error: Unable to access jarfile
E:\Users\paulhong\AppData\Local\Temp\_MEI175522\tabula\tabula-1.0.2-jar-with-dependencies.jar
Error:
Traceback (most recent call last):
File "test.py", line 115, in <module>
File "test.py", line 32, in extractDataDik
tempDf = tabula.read_pdf(file, area = (72, 252, 115.2, 352.8), guess=False, pages='1')
File "site-packages\tabula\wrapper.py", line 108, in read_pdf
File "subprocess.py", line 395, in check_output
File "subprocess.py", line 487, in run
subprocess.CalledProcessError: Command '['java', '-Dfile.encoding=UTF8', '-jar',
'E:\\Users\\paulhong\\AppData\\Local\\Temp\\_MEI175522\\tabula\\tabula-1.0.2-jar-with-dependencies.jar', '--pages', '1', '--area',
'72,252,115.2,352.8', 'E:\\Users\\paulhong\\Desktop\\Purchase Order
2\\SKM_C45819060508450 (003).pdf']' returned non-zero exit status 1. [47140] Failed to execute script test
I also couldn't find the folder _MEI175522 on the specified path.
My python version is 3.7.1 Java version is 1.8 pyinstaller version is 3.4 Tabula-py is the latest version
How can I fix this issue?
I had a similar problem, and I was able to solve it using the solution at this link: Unable to access jarfile 'tabula-1.0.2-jar-with-dependencies.jar'
I built my app within a virtual environment, so I added a tabula folder with the tabula-1.0.2-jar-with-dependencies.jar file to my site-packages folder. Running the command pyinstaller --add-data apps\Lib\site-packages\tabula\tabula-1.0.2-jar-with-dependencies.jar;tabula --onefile Table_OCR.py builds the executable correctly for me.
It looks like the tabula module hasn't been copied to the dist folder of your executable, in my experience this is a common problem with pyinstaller it can often miss packages in the python directory.
Go to the dist folder and check if the tabula folder is there, if it's not then you'll need to copy it over.
Go to your python directory, it should be somewhere like this:
C:\Users\<user_name>\AppData\Local\Programs\Python\Python37-32\Lib\site-packages
Copy over any packages from here that need to be in the dist folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With