7

I am trying to extract tabular data from pdf using camelot and I am getting the following error.

Code:

tables = camelot.read_pdf(file_name)

Error:

GhostscriptNotFound: Please make sure that Ghostscript is installed and available on the PATH environment variable

I have already installed Ghostscript and I have it available on the PATH environment variable.

Please find below version details:

  • Windows-10-10.0.17134-SP0
  • Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
  • NumPy 1.14.3
  • openCV 3.4.3
  • Camelot 0.3.2

Please help resolve this issue.

barbsan
  • 3,328
  • 11
  • 20
  • 28
Venkatesan R
  • 71
  • 1
  • 1
  • 3
  • 2
    You can see here how Camelot is trying to find your GhostScript. https://github.com/socialcopsdev/camelot/blob/defaead6790f5737c348bc1106e6797cf480cee5/camelot/parsers/lattice.py#L176-L209 On Windows, it's looking for "gswin32c" or "gswin64c". Can you confirm that you can run "gswin32c" or "gswin64c" on your command line? – AKX Nov 15 '18 at 12:09

15 Answers15

4

I unistalled the 64bit and

  1. Install the 32bit version

  2. Add the following two paths on Windows Environment Variables:

    C:\Program Files(x86)\gs\gs9.26\bin

    C:\Program Files(x86)\gs\gs9.26\lib

and now it works

Alessandra
  • 56
  • 4
3

Download Ghostscript from here https://www.ghostscript.com/download/gsdnld.html and add it to the path if required

Syenix
  • 210
  • 2
  • 9
2

Adding both the "bin" and "lib" paths for Ghostscript to the PATH worked for me:

  • C:\Program Files\gs\gs9.26\bin
  • C:\Program Files\gs\gs9.26\lib
chermanson
  • 58
  • 7
2

For me using brew link -f --overwrite ghostscript solved the issue. I would recommend checking the suggested solutions on https://github.com/atlanhq/camelot/issues/282. That's where I also found my fix.

AJoR
  • 29
  • 1
1

Tried all the solutions. The only option that works is to use 32 bit ghostscript.

Kush
  • 19
  • 1
  • 1
    Welcome to Stack Overflow. Your late answer here duplicates two existing answers from [M Mehmood](https://stackoverflow.com/a/63275309/5698098) and [Alessandra](https://stackoverflow.com/a/62161242/5698098) without adding anything new or different. Duplication is rarely good, and it may result in down-votes as others see it as an unwanted distraction (possibly also leading up to removal by moderators, see [How to handle cleanup of late blatantly duplicate answers ('surfing') on popular questions](https://meta.stackoverflow.com/q/385063/5698098) for reference). – Ivo Mori Aug 27 '20 at 23:55
  • 1
    As you're starting out here, please take the [tour](https://stackoverflow.com/tour) to learn how Stack Overflow works and refer to [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer). – Ivo Mori Aug 27 '20 at 23:56
0

I had the same problem. I solved it by uninstalling the 64 bit version and installing the 32 bit version.

Anthony
  • 916
  • 1
  • 8
  • 19
M Mehmood
  • 9
  • 1
0

I realized that. If you are using the Python 64bit you need install ghostcript64 bit, else 32 bit.

Also set path for 64bit: C:\Program Files\gs\gs9.26\bin C:\Program Files\gs\gs9.26\lib

or for below for 32bit C:\Program Files(x86)\gs\gs9.26\bin C:\Program Files(x86)\gs\gs9.26\lib

  • Using python 64bits, ghostcript64bit (9.55.0) and the path : `C:\Program Files\gs\gs9.55.0\bin` and `C:\Program Files\gs\gs9.55.0\lib` works to me. – Diego Montania Mar 28 '22 at 20:20
0

Here is my solution (Windows OS (11, 64 BIT)):

  1. Download and install the desired ghost version you wish (32,64 - does not matter)
  2. Using "dir /x" command, get the short version of the path of your installation (c:\progra~1\blahbla...). My location (I love altering the default suggestion) is "C:\Program Files\gs\GPLGhostScript" and the short name is "c:\progra~1\gs\GPLGhostScript"
  3. Add this to the path together with \bin. In my case "c:\progra~1\gs\GPLGhostScript\bin" (no need for lib path as suggested by others)
  4. Restart your PC
  5. Test your installation of GhostScript according to this link.

Good luck :)

Guy Cohen
  • 616
  • 6
  • 24
0

A very simple way is to install Ghostscript from the official website.

Then give the location while set-up the library in the Anaconda script folder. Wait for 10 minutes after closing the Python platforms.

Tomerikoo
  • 15,737
  • 15
  • 35
  • 52
0

This worked for me:

C:\Program Files\gs\gs9.55.0\bin

Just find the path location, copy it, and paste it into user and system variables Path (Environment variables).

0

I solved this problem.

  1. I downloaded Ghostscript.
  2. Then installed it at C:/programfiles.
  3. Added set path: C:\Program Files\gs\gs9.26\bin + C:\Program Files\gs\gs9.26\lib
  4. Restarted my computer.

After these steps, it worked.

RiveN
  • 2,470
  • 8
  • 7
  • 23
Benny
  • 9
  • 1
0

I was facing same issue for 2 days. I found solution at below link.

for windows 10, I used below method

  1. in "search the web and windows" write "under edit environment variable for your account in control panel."
  2. edit path for lib and bin library of Ghostscript here. add ; to separate the path at end also. set path in environment variable

For more info used below link. It worked fine for me.

https://github.com/atlanhq/camelot/issues/465#issuecomment-975976344

Jaivik
  • 1
  • 1
0

For me, uninstalling camelot and re-installing with conda install -c conda-forge camelot-py instead of pip solved the problem (as ghostscript is also re-installed)

Ilya Peterov
  • 1,777
  • 13
  • 31
Anthony
  • 31
  • 2
-1

This is how I solved for this error on a Windows computer, similar to what Alexander Garzo posted:

  1. Went to File Explorer -> C drive -> Program Files -> gs -> gs9.55.0 -> shift-clicked on bin folder -> copied as path ("C:\Program Files\gs\gs9.55.0\bin")
  2. Then went to environmental variables -> Path -> Edit -> New -> pasted above -> OK -> restarted computer.

I then ran the following code in Python:

import ctypes
from ctypes.util import find_library
find_library("".join(("gsdll", str(ctypes.sizeof(ctypes.c_voidp) * 8), ".dll")))

The output was "C:\Program Files\gs\gs9.55.0\bin\gsdll64.dll" which means the solution worked. I was then able to install and use Camelot with no problems.

user3710004
  • 405
  • 1
  • 3
  • 13
-2

I was getting this Error (OSError: Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html) I tried everything mentioned here and also in Github. but after installing Ghostscript from here and then adding to the PATH. I keep trying methods to solve it. BUT the solution is to just Restart your computer and everything Works. so Restart is Must.