vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
344 stars 44 forks source link

html2image 2.0.2 adds dependency on requests package in a way that doesn't install it #108

Closed jrb-github closed 1 year ago

jrb-github commented 1 year ago

I apologize if this just my own misunderstanding of how things work, but here is what I'm seeing:

On a new python 3.11.2 install, if I pip install html2image, then import html2image, I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "AppData\Local\Programs\Python\Python311\Lib\site-packages\html2image\__init__.py", line 4, in <module>
    from .html2image import Html2Image
  File "AppData\Local\Programs\Python\Python311\Lib\site-packages\html2image\html2image.py", line 16, in <module>
    from html2image.browsers import chrome, chrome_cdp#, firefox, firefox_cdp
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "AppData\Local\Programs\Python\Python311\Lib\site-packages\html2image\browsers\chrome_cdp.py", line 7, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

If I pip install html2image==2.0.1, this goes away. If I pip install html2image==2.0.2 and pip install requests, it also goes away.

I think pip install html2image should cause all the things it depends on to also get installed, and it seems like it doesn't.

vgalin commented 1 year ago

Thank you for opening an issue and bringing this to my attention. You are absolutely right; there shouldn't be any import issues after installing the package.

The Html2Image version 2.0.2 wheel file was built using the development branch instead of the master branch, which is quite an unfortunate error on my part. I just released a 2.0.3 version that uses the correct files.