Nixpkgs: Set zip_safe to false for python to avoid: "ZIP does not support timestamps before 1980"

Created on 20 Jan 2013  路  7Comments  路  Source: NixOS/nixpkgs

If I understand correctly, adding the following to distutils.cfg should stop easy_install from trying to zip eggs, which inevitably leads to the error: "ZIP does not support timestamps before 1980":

[easy_install]
zip_ok = 0
enhancement python

Most helpful comment

I fixed this by invoking export SOURCE_DATE_EPOCH=315532800 # 1980. My nix-shell has a mkDerivation, so I put it in its shellHook.

I found this workaround in the Python docs. Certainly this is a ridiculous thing to have to do as an end user.

All 7 comments

As we anyway use --always-unzip, we probably could use that. Though I don't know whether it would actually solve the problem.

Apart from that a solution is already in stdenv-updates: 6d928ab

The error occurs e.g. for git checkout, where the whole directory is copied into the store and all timestamps set to epoch 0, this is the equivalent to a tarball in the store. For building the package, the directory is copied into a temporary build directory and timestamps where preserved, that is not set to "now".

A temporary workaround is used by charon: https://github.com/NixOS/charon/blob/master/default.nix#L19

Ah ok, that would explain why I noticed the error when using fetchhg.

Can someone check if this is still an issue now that stdenv-updates is merged?

Closing, if problem repeats, open the issue again.

For those coming in from Google on this error, it's very possible there are in fact files that have corrupt touch dates older than 1980. This raises when the mtime of a file in the packaging tree is older than 1980. This even happened for me when zip_safe was set to False

You can see if you have any of these files with: find . -mtime +13700 -ls

In my case, there were uglify.js node_modules with corrupt dates that I simply needed to exclude through my Manifest.in. Also see https://github.com/aws/aws-cli/issues/2639

I fixed this by invoking export SOURCE_DATE_EPOCH=315532800 # 1980. My nix-shell has a mkDerivation, so I put it in its shellHook.

I found this workaround in the Python docs. Certainly this is a ridiculous thing to have to do as an end user.

@matthew-piziak your export suggestion worked. Many thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sid-kap picture sid-kap  路  3Comments

chris-martin picture chris-martin  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

rzetterberg picture rzetterberg  路  3Comments

lverns picture lverns  路  3Comments