UserWarning: Duplicate name

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
aalvrzcommented, Jan 2, 2018

@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.

2reactions
joguSDcommented, Nov 30, 2017

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

python zip file hit userwarning: Duplicate name - Stack Overflow
The duplicate name warning comes from the input directory files, of the same name, all being written to the same place of the...
Read more >
Suppressing ZipFile duplication warning ยท Issue #129 - GitHub
Python's ZipFile allows writing duplicate files and does this by default. When it writes a duplicate file, it raises a UserWarning .
Read more >
Issue 2824: zipfile to handle duplicate files in archive
We just stumbled across this bug in our code at work where we accidentally put multiple files of the same name into the...
Read more >
mutablezip - PyPI
C:\Python310\lib\zipfile.py:1506: UserWarning: Duplicate name: 'foo.txt' return self._open_to_write(zinfo, force_zip64=force_zip64). With mutablezip:
Read more >
13.5. zipfile โ€” Work with ZIP archives โ€” Python 3.6.3 ...
Return a ZipInfo object with information about the archive member name. ... this when trying to read a ZIP file that contains members...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found