conda / conda-pack

Package conda environments for redistribution
https://conda.github.io/conda-pack/
BSD 3-Clause "New" or "Revised" License
516 stars 91 forks source link

conda-pack is not reproducible #345

Closed pavelzw closed 2 months ago

pavelzw commented 3 months ago

Checklist

What happened?

When running conda-pack multiple times, I would expect that the tar.gz file is reproducible and will be the same (as long as you don't touch the environment by running something in it (then, .pyc files might get generated)).

But when running conda-pack multiple times, I observed that the packed environment always has a different SHA. Here a small reproducer:

❯ pixi init
✔ Initialized project in /private/var/folders/rz/q1r4tv0n6ll38q18fbk419mc0000gn/T/tmp.5Rw82ZWAWg/.
❯ pixi add python
✔ Added python
❯ conda-pack -p .pixi/envs/default
Collecting packages...
Packing environment at '/private/var/folders/rz/q1r4tv0n6ll38q18fbk419mc0000gn/T/tmp.5Rw82ZWAWg/.pixi/envs/default' to 'default.tar.gz'
[########################################] | 100% Completed |  1.6s
❯ sha256sum default.tar.gz
560180e8bde3a5281c4d669fb7cd7cae431d7052a1648957c111e7dd1ed9b908  default.tar.gz
❯ rm default.tar.gz
❯ conda-pack -p .pixi/envs/default
Collecting packages...
Packing environment at '/private/var/folders/rz/q1r4tv0n6ll38q18fbk419mc0000gn/T/tmp.5Rw82ZWAWg/.pixi/envs/default' to 'default.tar.gz'
[########################################] | 100% Completed |  1.7s
❯ sha256sum default.tar.gz
1da9aee4bcf832680faadb9ed3ae9a1bf1794e33cf01312274df0a4c0b6680c6  default.tar.gz

I am using conda-pack installed via pixi global install conda-pack, i.e., in an isolated environment, version 0.7.1.

Conda Info

No response

Conda Config

No response

Conda list

No response

Additional Context

No response

xhochy commented 2 months ago

This is only a small timestamp diff:

% diffoscope default-orig.tar.gz default.tar.gz
--- default-orig.tar.gz
+++ default.tar.gz
├── filetype from file(1)
│ @@ -1 +1 @@
│ -gzip compressed data, last modified: Thu Jul 11 11:53:40 2024
│ +gzip compressed data, last modified: Thu Jul 11 11:53:57 2024
│   --- default-orig.tar
├── +++ default.tar
│ ├── file list
│ │ @@ -6358,8 +6358,8 @@
│ │  -rw-r--r--   0 uwe        (501) staff       (20)   194285 2024-07-11 11:53:14.893165 conda-meta/tzdata-2024a-h0c530f3_0.json
│ │  -rw-r--r--   0 uwe        (501) staff       (20)       47 2024-07-11 11:53:15.820711 conda-meta/history
│ │  -rw-r--r--   0 uwe        (501) staff       (20)      120 2024-07-11 11:53:14.697827 conda-meta/pixi
│ │  -rw-r--r--   0 uwe        (501) staff       (20)       54 2024-07-11 11:53:15.820499 conda-meta/pixi_env_prefix
│ │  -rw-rw-r--   0 uwe        (501) staff       (20)     2364 2024-06-25 14:01:31.000000 bin/activate
│ │  -rw-rw-r--   0 uwe        (501) staff       (20)      878 2024-06-25 14:01:31.000000 bin/deactivate
│ │  -rw-rw-r--   0 uwe        (501) staff       (20)     1830 2024-06-25 14:01:31.000000 bin/activate.fish
│ │ --rwx--x--x   0 uwe        (501) staff       (20)    67224 2024-07-11 11:53:42.524505 bin/conda-unpack
│ │ +-rwx--x--x   0 uwe        (501) staff       (20)    67224 2024-07-11 11:54:00.139150 bin/conda-unpack