ModuleNotFoundError: No module named 'camelot' - python

I want to extract tables from pdf and for that
I used Camelot. But I'm getting this error whenever I try to import it:
import camelot
Traceback (most recent call last):
File "<ipython-input-11-679d8f55abf0>", line 1, in <module>
import camelot
ModuleNotFoundError: No module named 'camelot'
I've tried installing camelot using:
pip install camelot-py[cv]
and
pip install camelot-py[all]
but I'm getting the same error again and again. How do I remove this?
Your help would be appreciated!

Check for your python version by writing python --version in the command prompt with the path where python is installed.
For python 3.7, try:
pip install camelot-py
https://pypi.org/project/camelot-py/
I hope this works for you.

If using conda (this is what I'd recommend):
conda install -c conda-forge camelot-py
If using pip (may have to manually handle dependencies): pip install camelot-py[cv]
Official installation instructions: https://camelot-py.readthedocs.io/en/master/user/install.html#install

Try to install Camelot in correct python version directory using
''''python2.7 -m pip install''''
Use your python version number instead of 2.7 above

In your python environment you have to install padas library.
You can install Camelot python with following command:
pip install Camelot
After the installation of Camelot python library, ModuleNotFoundError: No module named 'Camelot' error will be solved.
Thanks

Related

Why cant I import/use installed libraries in Python

I recently downloaded Python 3.10 because I used 3.9. At first, everything worked fine. Sadly, I can't use installed libraries nor use newly downloaded ones, since I deleted Python 3.9. What can I do about this problem?
VSCode gives me this Error message:
Traceback (most recent call last):
File "e:\XXXX\XXXX.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
You can check installed packages using this command:
pip freeze
or
pip list
Uninstall and install using command pip install <package-name>

AttributeError: module 'camelot' has no attribute 'read_pdf'

I am trying to extract tables from pdf using camelot and I get this attribute error. Could you please help?
import camelot
import pandas as pd
pdf = camelot.read_pdf("Gordian.pdf")
AttributeError Traceback (most recent call last)
in
----> 1 pdf = camelot.read_pdf("Gordian.pdf")
AttributeError: module 'camelot' has no attribute 'read_pdf'
NOTE : If you are using virtual environment activate environment before do this things.
I have already faced this error.There is a no bug in your code.The problem is with camelot installation.
1 remove installed camelot version
2 install again using this command. There is a multiple ways to install camelot. Please try it one by one
pip install camelot-py
pip install camelot-py[cv]
pip install camelot-py[all]
3 run your code >> i have attached sample code here
import camelot
data = camelot.read_pdf("test_file.pdf", pages='all')
print(data)
Try this: import camelot.io as camelot
That worked for me.
please check if you have java installed on you machine, go to your terminal and run "java -version", if you do not have you won't be able to read pdf using Camelot or tabula,
once you have installed java, install tabula-py using the command
pip install tabula-py.
from tabula.io import read_pdf
tables = read_pdf('file.pdf') # substitute your file name
I abandoned trying to get camelot to work in Jupiter Notebooks to read tables & instead installed the following:
!{sys.executable} -m pip install tabula-py tabulate
from tabula import read_pdf
from tabulate import tabulate
pdf_path = (
Path.home()
/ "my_pdf.pdf"
)
df = read_pdf(str(pdf_path), pages=1)
df[0]
Here's the link with full installation steps:
https://camelot-py.readthedocs.io/en/master/user/install.html#using-pip
After you install
pip install camelot-py[cv]
Write this:
import camelot.io as camelot
pip uninstall camelot
pip uninstall camelot-py
pip install camelot-py[cv]
install ghostscript app from internet
! apt install ghostscript python3-tk
pip install ghostscript
When downloading the library please pay attention to where it is downloaded. Because the library you downloaded may have been saved in another Python version

Tabula-py - ImportError: No module named tabula

I am trying to use Tabula-py to read a pdf. I installed tabula-py through pip install tabula-py
I have also installed the required dependencies
requests
pandas
pytest
flake8
My code is currently as follows:
import tabula
import pandas as pd
df = tabula.read_pdf("report.pdf", pages=2)
print(df)
I am getting the following error:
Traceback (most recent call last):
File "tabula_pdf_reader.py", line 1, in <module>
import tabula
ImportError: No module named tabula
Any inputs to what I am missing here?
I faced this same issue in Ubuntu.
First, check the version of the JDK and JRE that are installed on your machine by running java --version and javac --version. Each should have a version greater than 7.
Then use pip3 to install tabula.
I got the same issue here when executing on Terminal.
However, after I ran by starting with 'ipython3' instead of 'ipython', it worked perfectly.
You have to make sure that tabula-py module is installed in python3 directory, not python2
use this
import camelot
tables = camelot.read_pdf('foo.pdf')
tables.export('foo.csv', f='csv', compress=True)
For macOS users - an update to Monterey operating system will solve the problem.

ImportError: No module named geographiclib.geodesic

When I am trying to run .py script file ,I am getting this error. In the script file after import the packages, I am written "from geographiclib.geodesic import Geodesic"
You might have to install the module geographiclib by running
pip install geographiclib
or
easy_install geographiclib
I resolve the issue below are the step which i follow to reslove.
1. Install PIP using command "python get-pip.py". you can download the get-pip.py file from internet.
2. Then run "pip install geographiclib".
3.finish

Importing opencv and getting numpy.core.multiarray failed to import

Trying to install OpenCV and running into an issue where attempting to import cv2 results in this output -
RuntimeError: module compiled against API version 9 but this version of numpy is 7
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import cv2
ImportError: numpy.core.multiarray failed to import
I'm running on Windows 7 x64, Python v 2.7.9
Thanks!
The error is telling you that you have an out of date version of numpy. If you used pip to install things you can simply run pip install numpy -U, or download the appropriate version from their website.
In case
pip install -U numpy
doesn't work (even with sudo), you may want to make sure you're using the right version of numpy. I had the same "numpy.core.multiarray failed to import" issue, but it was because I had 1.6 installed for the version of Python I was using, even though I kept installing 1.8 and assumed it was installing in the right directory.
I found the bad numpy version by using the following command in my Mac terminal:
python -c "import numpy;print numpy.version;print numpy.file";
This command gave me the version and location of numpy that I was using (turned out it was 1.6.2). I went to this location and manually replaced it with the numpy folder for 1.8, which resolved my "numpy.core.multiarray failed to import" issue. Hopefully someone finds this useful!
I had a similar problem and I solved it by downgrading my numpy version.
What I did was:
pip install opencv-python
pip uninstall numpy
pip install numpy=1.18
This has worked for me using
Python 3.7
opencv-python 4.4.0.46
numpy 1.18.0
linux: sudo apt-get install python-numpy
if you are using ubuntu bionic beaver then try running: sudo apt-get install python-numpy
had the same issue, resolve by running the above command.
Hope it helps
In your environment you can try this command:
conda uninstall numpy
conda install -c conda-forge numpy
I use Python 3.7 # RPI 4.
For opencv to install properly I had to install the listed libraries below.
(Not every package was actually installed, after request)
Regarding Numpy, I think one should stick to the latest version.
For me what worked is to uninstall the existing version 1.16.2 and stick with the current stable 1.21.2.
Stackoverflow topic at missing libraries here: ImportError: libcblas.so.3: cannot open shared object file: No such file or directory.

Categories

Resources