I am experiencing a similar issue as #572
I am including PyPDF2 as a dependency in my Chalice project. Since there is no wheel available for it, I had to build it myself and add it to the vendor/ directory, as described in the docs.
Every time I deploy chalice I get the following warnings:
Regen deployment package.
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/DESCRIPTION.rst'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/top_level.txt'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/METADATA'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/WHEEL'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/metadata.json'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2-1.26.0.dist-info/RECORD'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/pagerange.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/xmp.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/utils.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/merger.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/pdf.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/filters.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/_version.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/__init__.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.6/zipfile.py:1355: UserWarning: Duplicate name: 'PyPDF2/generic.py'
return self._open_to_write(zinfo, force_zip64=force_zip64)
However when testing my deployed Lambda functions, PyPDF2 works without any problems. ๐
This is how my vendor/ directory looks like:
vendor/
โโโ PyPDF2
โย ย โโโ __init__.py
โย ย โโโ _version.py
โย ย โโโ filters.py
โย ย โโโ generic.py
โย ย โโโ merger.py
โย ย โโโ pagerange.py
โย ย โโโ pdf.py
โย ย โโโ utils.py
โย ย โโโ xmp.py
โโโ PyPDF2-1.26.0.dist-info
โโโ DESCRIPTION.rst
โโโ METADATA
โโโ RECORD
โโโ WHEEL
โโโ metadata.json
โโโ top_level.txt
2 directories, 15 files
Would really appreciate some help on how to get rid of these warnings, as they are very annoying.
Is this dependency in both your requirements.txt and the vendor directory? If so removing it from the requirements.txt might be the way to go (as it will be included from the vendor dir already).
Yes, this was the issue. Thanks!
@BigChief45 I am experiencing pdf generation with Chalice framework, does PyPDF2 works fine? Did you use html->pdf convert feature (if available in PyPDF2)?
Or do U have any recommendations on other libs I can use?
Thanks !
@3dw1np PyPDF2 works fine as long as you can package it yourself in the /vendor directory in your project. I was using it for PDF to image conversions, and do not know if PyPDF2 supports html --> pdf.
@BigChief45 Thanks! Do have an example of how you return the pdf into Chalice Response?
Most helpful comment
@3dw1np PyPDF2 works fine as long as you can package it yourself in the
/vendordirectory in your project. I was using it for PDF to image conversions, and do not know if PyPDF2 supports html --> pdf.