CondaPkg.jl icon indicating copy to clipboard operation
CondaPkg.jl copied to clipboard

Setting environment variables when activating conda env

Open nhz2 opened this issue 2 years ago • 3 comments

Conda packages can have scripts to set and unset environment variables when the environment is activated and deactivated.

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables

These get added to .CondaPkg/env/etc/conda/activate.d/ and .CondaPkg/env/etc/conda/deactivate.d/

Currently from what I can tell CondaPkg.withenv(f::Function) doesn't run these scripts.

nhz2 avatar May 30 '23 16:05 nhz2

Indeed, most Conda packages do not use this feature, so it hasn't been implemented by CondaPkg.

Are there particular packages you're having issue with.

cjdoris avatar Jun 02 '23 14:06 cjdoris

I had issues using the quarto package. But looking into this issue more, I have no idea how actually to fix this in Julia, (besides some super hacky workarounds to try and parse .bat and .sh scripts).

It would probably be easier to fix the quarto conda package instead.

nhz2 avatar Jun 02 '23 16:06 nhz2

Indeed, an earlier version of CondaPkg did this, but it was not super reliable. It could be reimplemented though.

cjdoris avatar Jun 05 '23 11:06 cjdoris