Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No wkhtmltoimage executable found error on google colab #75

Open
meechos opened this issue Jun 23, 2021 · 1 comment
Open

No wkhtmltoimage executable found error on google colab #75

meechos opened this issue Jun 23, 2021 · 1 comment
Assignees
Labels

Comments

@meechos
Copy link

meechos commented Jun 23, 2021

Describe the bug
During conversion of string to image (or any other usage of the package), I am faced with the following error:

SError: 
No wkhtmltoimage executable found: "command not found"

I have installed wkhtmltopdf but issue persists. As far as I understand, there is no wkhtmltoimage package to install.


To Reproduce

  1. Go to google colab
  2. Run:
import imgkit
imgkit.from_string('Hello!', 'out.jpg')
  1. See error

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-7-cb1f5c445c5d> in <module>()
----> 1 imgkit.from_string('Hello!', 'out.jpg')

2 frames
/usr/local/lib/python3.7/dist-packages/imgkit/config.py in get_wkhtmltoimage(self)
     55                 raise_from(OSError(wkhtmltoimage_error), io_error)
     56         else:
---> 57             raise OSError(wkhtmltoimage_error)
     58 
     59         return self.wkhtmltoimage

OSError: 
No wkhtmltoimage executable found: "command not found"
If this file exists please check that this process can read it.
Otherwise please install wkhtmltopdf - http://wkhtmltopdf.org

Additional info

I have tried manually setting the path to wkhtmltopdf using

path_wkthmltopdf = r'/home/cdsw/.local/lib/python3.6/site-packages/wkhtmltopdf/'
config = imgkit.config(wkhtmltoimage=path_wkthmltopdf)
imgkit.from_string('Hello!', 'out.jpg', config=config)

but with no luck receiving the similar errortrace

IsADirectoryError                         Traceback (most recent call last)
/home/cdsw/.local/lib/python3.6/site-packages/imgkit/config.py in get_wkhtmltoimage(self)
     51             try:
---> 52                 with open(self.wkhtmltoimage):
     53                     pass

IsADirectoryError: [Errno 21] Is a directory: '/home/cdsw/.local/lib/python3.6/site-packages/wkhtmltopdf/'

The above exception was the direct cause of the following exception:

OSError                                   Traceback (most recent call last)
<ipython-input-59-85ebba294e78> in <module>()
     13 <p style='font-size: 0.8em; width: 600px; height: 400px;'>
     14 {content}
---> 15 </p>""", os.getcwd(), options=options, config=config)

/home/cdsw/.local/lib/python3.6/site-packages/imgkit/api.py in from_string(string, output_path, options, toc, cover, css, config, cover_first)
    104         css=css,
    105         config=config,
--> 106         cover_first=cover_first,
    107     )
    108     return rtn.to_img(output_path)

/home/cdsw/.local/lib/python3.6/site-packages/imgkit/imgkit.py in __init__(self, url_or_file, source_type, options, config, **kwargs)
     34         self.source = Source(url_or_file, source_type)
     35         self.config = Config() if not config else config
---> 36         self.wkhtmltoimage = self.config.get_wkhtmltoimage()
     37 
     38         self.options = {}

/home/cdsw/.local/lib/python3.6/site-packages/imgkit/config.py in get_wkhtmltoimage(self)
     53                     pass
     54             except IOError as io_error:
---> 55                 raise_from(OSError(wkhtmltoimage_error), io_error)
     56         else:
     57             raise OSError(wkhtmltoimage_error)

/home/cdsw/.local/lib/python3.6/site-packages/six.py in raise_from(value, from_value)

OSError: 
No wkhtmltoimage executable found: "/home/cdsw/.local/lib/python3.6/site-packages/wkhtmltopdf/"
If this file exists please check that this process can read it.
Otherwise please install wkhtmltopdf - http://wkhtmltopdf.org

  • OS: Google Colab and Cloudera Workbench (same issue)
  • IMGkit Version [1.2.2]
  • wkhtmltopdf [0.2]
@KorayUlusan
Copy link

I may sound dumb but did you installed wkhtmltopdf/image to google collab and is it in $PATH. The error message semes clear: No wkhtmltoimage executable found: "command not found". Does is really exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants