Search code examples
pythonipythonsetuptoolsjupyterimporterror

python ZipImportError: bad local file header only when import in jupyter notebook


I have a custom internal package (Python 2.7) I created and was trying to demo it in a jupyter notebook, but it's not importing. I get:

ZipImportError: bad local file header: path/to/package.egg

There are so few results on Google for the ZipImportError: bad local file header that I thought I copied it wrong. The package imports fine in cmd, eclipse, spyder just fine. No idea what the issue is.


Solution

  • I found a fix - just upgrade setuptools. I upgraded via pip. My setuptools version that I used to install the package via python setup.py install was 23.0.0 and is now 34.1.0. After that, I just re-installed the package and it imported without error in the jupyter notebook.