Im trying to use tabula-py to transfer a table from pdf to excel.
When im trying to
from tabula import read_pdf
it says
ImportError: cannot import name 'read_pdf'
All solutions i found say that i have to
pip uninstall tabula
pip3 install tabula-py
https://github.com/chezou/tabula-py/issues/47
Tabula-py - ImportError: No module named tabula
But its still not working for me.
Any ideas?
Maybe this is because of the version of tabula you installed.
If you installed tabula by running:
pip install tabula
You get an old version of tabula (1.0.5) that has the problem with the module .read_pdf(). To fix the problem and get a newer version of tabula, first:
uninstall tabula with the command:
pip uninstall tabula
And install the newer version of tabula with the command:
pip install tabula-py
I think this will solve your problem.
from tabula import wrapper
df = wrapper.read_pdf('my_pdf')
read_pdf is contained within 'wrapper'. Hence you import wrapper and call read_pdf from wrapper.
I solved as follows:
pip3 uninstall tabula-py
pip3 install tabula-py
That solved the problem perfectly! Good luck!
There is a chance that you're testing tabula-py within a module you named tabula.py
This would throw the same exact error because of module import order in Python
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