So, I create a conda env the usual way, but with a slight difference. I copy some extra folders to the env root so I can have them packed.
After packing to tar.gz they are there, but when unpacking and activating, it does not point to the right python executable. any ideas?
╭─ ~/Downloads
╰─ mkdir -p my_env
╭─ ~/Downloads
╰─ tar -xzf my_env.tar.gz -C my_env
╭─ ~/Downloads
╰─ source my_env/bin/activate
╭─ ~/Downloads my_env
╰─ which python
/usr/bin/python
There is an undocumented (probably on purpose, to avoid some user issues)
--copyswitch that allow you to have a "portable" conda env:Example:
The conda env created at this path can then be zipped and unzipped elsewhere on similar architecture (ie. linux x64 to linux x64). You can also manually add packages if necessary (copy to
site-packagespath).I use this all the time with PySpark + Hadoop to ship all dependencies without having to install them on cluster.