collective / collective.documentviewer

https://pypi.org/project/collective.documentviewer
21 stars 22 forks source link

sh: gm: command not found #45

Closed opeeters closed 4 years ago

opeeters commented 10 years ago

I'm getting a "sh: gm: command not found" on an install that worked very well before. Plone 4.3.2 on CentOS 6.5, all dependancies according to instructions have been installed (... everything has been working before). The plone user also has access to gm (see output gm version below).

Docsplit 0.7.2 is installed (see output docsplit version below). Both poppler and poppler-utils have been installed. It cannot be the PDF since I also tried this with a PDF which was transformed before without any issues

Traceback (most recent call last): File "/home/plone/production/eggs/collective.documentviewer-2.2.2b3-py2.7.egg/collective/documentviewer/convert.py", line 565, in call pages = self.run_conversion() File "/home/plone/production/eggs/collective.documentviewer-2.2.2b3-py2.7.egg/collective/documentviewer/convert.py", line 401, in run_conversion return docsplit.convert(self.storage_dir, **args) File "/home/plone/production/eggs/collective.documentviewer-2.2.2b3-py2.7.egg/collective/documentviewer/convert.py", line 302, in convert self.dump_images(path, output_dir, sizes, format, language) File "/home/plone/production/eggs/collective.documentviewer-2.2.2b3-py2.7.egg/collective/documentviewer/convert.py", line 226, in dump_images self._run_command(cmd) File "/home/plone/production/eggs/collective.documentviewer-2.2.2b3-py2.7.egg/collective/documentviewer/convert.py", line 120, in _run_command raise Exception(error) Exception: Command /usr/bin/docsplit images /tmp/tmpZn5Drr/dump.pdf --language dut --size 1000x,700x,180x --format gif --rolling --output /tmp/tmpZn5Drr finished with return code 1 and output: sh: gm: command not found

I had a similar issue today with a "sh: pdfinfo: command not found", but I was able to solve this by installing poppler-utils (besides poppler) via yum, but the gm issue I cannot get rid of. I also reinstalled all dependancies with similar configuration to https://github.com/collective/collective.documentviewer/blob/master/CENTOS-INSTALL.rst

gm and docsplit is accessible: $ gm version GraphicsMagick 1.3.19 2013-12-31 Q8 http://www.GraphicsMagick.org/ Copyright (C) 2002-2013 GraphicsMagick Group. Additional copyrights and licenses apply to this software. See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support: Thread Safe yes Large Files (> 32 bit) yes Large Memory (> 32 bit) yes BZIP yes DPS no FlashPix no FreeType yes Ghostscript (Library) yes JBIG no JPEG-2000 no JPEG yes Little CMS yes Loadable Modules no OpenMP yes (200805) PNG yes TIFF yes TRIO no UMEM no WMF no X11 no XML yes ZLIB yes

Host type: x86_64-unknown-linux-gnu

Configured using the command: ./configure '--enable-shared' '--with-bzlib=yes' '--with-gslib=yes' '--with-windows-font-dir=/usr/share/fonts/msttcorefonts'

Final Build Parameters: CC = gcc -std=gnu99 CFLAGS = -fopenmp -g -O2 -Wall -pthread CPPFLAGS = -I/usr/include/freetype2 -I/usr/include/libxml2 CXX = g++ CXXFLAGS = -pthread LDFLAGS = -L/usr/lib -L/usr/lib LIBS = -llcms2 -ltiff -lfreetype -ljpeg -lgs -lpng12 -lbz2 -lxml2 -lz -lm -lgomp -lpthread

$ docsplit --version Docsplit version 0.7.2

Any one an idea what could be wrong? Only thing which might have changed on this system between the time when it was still working and now is a yum update.

opeeters commented 10 years ago

I finally figured out the issue. It's apparently related to GraphicsMagick 1.3.19. I uninstalled version 1.3.19 (make uninstall) and installed GraphicsMagick 1.3.18. Now everything works again. I should have tried this out before :-)

allnode commented 10 years ago

I have a similar problem.

See this error screen shot: https://docs.google.com/drawings/d/1zt_Brp4663b2mOvlysPSSW-Nsbh5ydkEBO2o5ylgULc/edit?usp=sharing .

I have Centos and have followed the GraphicsMagick instructions per this: https://github.com/collective/collective.documentviewer/blob/master/CENTOS-INSTALL.rst

I have also tried opeeters' "fix" and the gm version afterwards is as follows:

GraphicsMagick 1.3.18 2013-03-10 Q8 http://www.GraphicsMagick.org/ Copyright (C) 2002-2013 GraphicsMagick Group. Additional copyrights and licenses apply to this software. See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support: Thread Safe yes Large Files (> 32 bit) yes Large Memory (> 32 bit) yes BZIP no DPS no FlashPix no FreeType yes Ghostscript (Library) no JBIG no JPEG-2000 no JPEG yes Little CMS no Loadable Modules no OpenMP yes (200805) PNG yes TIFF yes TRIO no UMEM no WMF no X11 no XML no ZLIB yes

Host type: x86_64-unknown-linux-gnu

Configured using the command: ./configure '--enable-shared' '--with-bzlib=yes' '--with-gslib=yes' '--with-windows-font-dir=/usr/share/fonts/msttcorefonts'

Final Build Parameters: CC = gcc -std=gnu99 CFLAGS = -fopenmp -g -O2 -Wall -pthread CPPFLAGS = -I/usr/include/freetype2 CXX = g++ CXXFLAGS = -pthread LDFLAGS = -L/usr/lib LIBS = -ltiff -lfreetype -ljpeg -lpng12 -lz -lm -lgomp -lpthread

Help and advice most appreciated.

vangheem commented 10 years ago

Sorry guys. The build requirements for this package are really daunting. Perhaps the easiest way to deal with this is to create ansible configs for various platforms that'll build everything out.

opeeters commented 10 years ago

Well actually, I recently had the problem again. Reinstalling GraphicsMagick 1.3.18 did not work. Installing GraphicsMagick 1.3.20 did not work. I did a restart of Plone and all was back to normal. Maybe the sollution for CentOS is to do a crontab that restarts Plone during some dead period once a month of so to keep things fresh? Al, can you please check whether a restart solves it for you?

allnode commented 10 years ago

opeeters, in my case re-start did not help. Now my fall back is to use page.turner for pdf viewing. I found though that Plone 4.3.3 requires pageturner 1.3.6 . The thing about 1.3.6 is that it has lost the pdf viewer's control for moving to next page and invoke full screen.

allnode commented 10 years ago

Please refer to this screen shot regarding the lack of "full screen" and "page advance" functions in 1.3.6 https://docs.google.com/drawings/d/1lg3wWFARaXake81efrM2t2EyD0x7PMXfQt7hNfx0PCE/edit?usp=sharing . Would really love some help to get these important functions back. Thanks.

newasmod commented 6 years ago

please help , linux mint 18.1 gm: not found Error: Command failed: gm identify -format "%p " /bin/sh: 1: gm: not found

tkimnguyen commented 4 years ago

You have to install the required dependencies, which is admittedly quite complicated. Also, check the PATH environment variable because when you install something like gm it has to be in the PATH that your Plone client uses. You may have to restart your Plone client for it to find a new executable even if it is in its PATH. If it is not in its PATH, you have to modify the PATH environment variable for the user running the Plone client, and restart the Plone client.

Also: please do not piggyback your issue on someone else's unless you are certain it is the same problem.

tkimnguyen commented 4 years ago

For example, if you look at the log for the Plone client you will see warnings like this, showing which binaries document viewer was unable to find:

2020-07-20 14:46:27,740 ERROR   [collective.documentviewer:201][MainThread] No pdffonts installed. collective.documentviewer will not be able to detect if the pdf alreadycontains text
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 199, in <module>
    textChecker = TextCheckerSubProcess()
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 81, in __init__
    raise IOError("Unable to find %s binary" % self.bin_name)
OSError: Unable to find pdffonts binary
2020-07-20 14:46:27,742 ERROR   [collective.documentviewer:331][MainThread] Tesseract is not installed, Documentviewer Will not be able to convert pdfs or images to text Using Optical Character Recognition
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 329, in <module>
    tesseract = TesseractSubProcess()
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 81, in __init__
    raise IOError("Unable to find %s binary" % self.bin_name)
OSError: Unable to find tesseract binary
2020-07-20 14:46:27,742 ERROR   [collective.documentviewer:377][MainThread] poppler_utils are not installed. You wil not be able to index text or see the text dump in Document Viewer
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 375, in <module>
    pdftotext = PdfToTextSubProcess()
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 81, in __init__
    raise IOError("Unable to find %s binary" % self.bin_name)
OSError: Unable to find pdftotext binary
2020-07-20 14:46:27,743 ERROR   [collective.documentviewer:429][MainThread] Libreoffice not installed, Documentviewer will not be able to convert text files to pdf.
Traceback (most recent call last):
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 427, in <module>
    loffice = LibreOfficeSubProcess()
  File "/opt/plone/buildout-cache/eggs/collective.documentviewer-6.0.0-py3.7.egg/collective/documentviewer/convert.py", line 81, in __init__
    raise IOError("Unable to find %s binary" % self.bin_name)
OSError: Unable to find soffice binary