camelot icon indicating copy to clipboard operation
camelot copied to clipboard

mac m1 Ghostscript is not installed.

Open sanyuanya opened this issue 2 years ago • 4 comments

Describe the bug Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html

I have installed brew install ghostscript tcl-tk but it doesn't work

Steps to reproduce the bug

Expected behavior

Code

import camelot

# add your code here

PDF

Screenshots

Environment

  • OS: [e.g. macOS]
  • Python version:
  • Numpy version:
  • OpenCV version:
  • Ghostscript version:
  • Camelot version:

Additional context

sanyuanya avatar Nov 28 '23 01:11 sanyuanya

Try these suggestions here. The quickest solution is probably this one:

mkdir -p ~/lib
ln -s "$(brew --prefix gs)/lib/libgs.dylib" ~/lib

jsoma avatar Dec 02 '23 15:12 jsoma

it work like a charm

ditarnnt avatar May 31 '24 01:05 ditarnnt

@jsoma answer Doesnt work for me. I am using M1 Pro.

karaposu avatar Jul 10 '24 22:07 karaposu

works for me, I am using mac M3 chip

JingyiXXX avatar Oct 02 '24 14:10 JingyiXXX

@jsoma answer Doesnt work for me. I am using M1 Pro.

Have you tried "pip install ghostscript" after all? Because this solved the problem for me

GRicciardi00 avatar Jan 02 '25 19:01 GRicciardi00

Please see the installation instructions for Ghostscript. Or try the latest version. Ghostscript is now an optional dependency. Pdfium is now the main image conversion backend which is easier to install.

Should be installed automatically if you pip install this package (Camelot )

Closing this for now as it is an old issue. Feel free to respond of you need further assistance.

bosd avatar Jan 02 '25 23:01 bosd

I can confirm that v1.0.0 works without ghostscript on macos

$ brew uninstall ghostscript
Uninstalling /opt/homebrew/Cellar/ghostscript/10.04.0... (640 files, 121.9MB)
==> Autoremoving 2 unneeded formulae:
jbig2dec
libidn
Uninstalling /opt/homebrew/Cellar/jbig2dec/0.20... (14 files, 425.6KB)
Uninstalling /opt/homebrew/Cellar/libidn/1.42... (74 files, 1MB)
$ ipychat
Welcome to ipychat! Use %ask to chat with claude-3-5-sonnet-20241022.
You can change models using %models.
Python 3.10.15 (main, Oct 16 2024, 08:33:15) [Clang 18.1.8 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.17.2 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import camelot
/Users/vinayak/dev/camelot/.venv/lib/python3.10/site-packages/pypdf/_crypt_providers/_cryptography.py:32: CryptographyDeprecationWarning: ARC4 has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.ARC4 and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  from cryptography.hazmat.primitives.ciphers.algorithms import AES, ARC4

In [2]: camelot.__version__
Out[2]: '1.0.0'

In [3]: tables = camelot.read_pdf("docs/_static/pdf/foo.pdf")

In [4]: tables[0].df
Out[4]:
              0            1                2                     3                  4                  5                 6
0  Cycle \nName  KI \n(1/km)  Distance \n(mi)  Percent Fuel Savings
1                                                  Improved \nSpeed  Decreased \nAccel  Eliminate \nStops  Decreased \nIdle
2        2012_2         3.30              1.3                  5.9%               9.5%              29.2%             17.4%
3        2145_1         0.68             11.2                  2.4%               0.1%               9.5%              2.7%
4        4234_1         0.59             58.7                  8.5%               1.3%               8.5%              3.3%
5        2032_2         0.17             57.8                 21.7%               0.3%               2.7%              1.2%
6        4171_1         0.07            173.9                 58.1%               1.6%               2.1%              0.5%

In [5]:

vinayak-mehta avatar Jan 03 '25 14:01 vinayak-mehta

I have figured out this question. First, you need an environment of Python 3.9 and then install 'camelot-py[cv]'==1.0.0. Finally, you just need run one conmmand line "pip install ghostscript", then everything will be Ok

XinxingPKU avatar Jan 22 '25 02:01 XinxingPKU

I have figured out this question. First, you need an environment of Python 3.9 and then install 'camelot-py[cv]'==1.0.0. Finally, you just need run one conmmand line "pip install ghostscript", then everything will be Ok

Awesome, this worked for me.

[!note] Usage with poetry

poetry add camelot-py[cv]
poetry add ghostscript

MoAqsam avatar Jan 25 '25 23:01 MoAqsam