conda-forge / cupy-feedstock

A conda-smithy repository for cupy.
BSD 3-Clause "New" or "Revised" License
5 stars 23 forks source link

Need post-link and pre-unlink scripts #66

Closed leofang closed 3 years ago

leofang commented 4 years ago

https://docs.conda.io/projects/conda-build/en/latest/resources/link-scripts.html

I noticed we need to fix the following situations:

leofang commented 4 years ago

Would be nice to fix packages since 7.3.0, but I don't have time this week 😅

jakirkham commented 4 years ago

I thought this is what we were accomplishing with the activate/deactivate scripts, right? Or am I missing something?

leofang commented 4 years ago

Apparently they are different and I missed it too 😅 For example, the activate script doesn't get executed when you're already in the targe environment and install the package; it's only executed during conda activate my_env. To have the desired effect enabled immediately after installation, the post-link script must be used. Likewise for deactivate vs pre-unlink.

jakirkham commented 4 years ago

What version of Conda are you using?

leofang commented 4 years ago

4.7.12

jakirkham commented 4 years ago

I think at some point they made it so activation automatically occurs after an install (that's what I've seen at least), but I don't recall when that change occurred. It may be worth upgrading (if you can).

leofang commented 4 years ago

Oh, that's good to know! Will test and close this issue if it works. Thanks John.

jakirkham commented 4 years ago

Yeah there's this line. Though that's been around for a little bit. It's possible the exit code from conda install was not right in some cases and they fixed it?

leofang commented 4 years ago

OK I tested it. So,

  • After the package is installed, CUDA_PATH that we set should be made immediately available without a deactivate/activate cycle.

This is correctly done even in 4.7.12, so we're good and do not need a post-link script.

  • Before the package is uninstalled, CUDA_PATH should be either unset or restored to the old value.

This is not done. After cupy is uninstalled, the CUDA_PATH set by us cannot be a residual, so we need a pre-unlink script that executes the content of our deactivate script.

jakirkham commented 4 years ago

According to this line reactivation should happen during removal. Are we sure there isn't a bug in our deactivation script or possibly Conda itself?

leofang commented 4 years ago

btw I think I wasn't 100% correct.

  • After the package is installed, CUDA_PATH that we set should be made immediately available without a deactivate/activate cycle.

This is correctly done even in 4.7.12, so we're good and do not need a post-link script.

A new CUDA_PATH is set, yes. But in this case if CUDA_PATH is already set prior to conda install cupy, then the old value isn't cached to CONDA_CUPY_CUDA_PATH as I intended. I feel when the environment is reactivated, conda does not see all of the env variables. From the shell script to which you linked I wasn't able to tell where it went wrong, but conda could be to blame...

leofang commented 3 years ago

I could not reproduce this, closing for now.