talmolab / sleap

A deep learning framework for multi-animal pose tracking.
https://sleap.ai
Other
435 stars 97 forks source link

Reset LD_LIBRARY_PATH on deactivate #1502

Closed roomrys closed 1 year ago

roomrys commented 1 year ago

Description

In #1496 we set the LD_LIBRARY_PATH on activating the mamba environment, This PR remembers and resets the old LD_LIBRARY_PATH on deactivate by using a third environment variable SLEAP_OLD_LD_LIBRARY_PATH.

This PR also documents an approach for doing this on existing environments under sleap.ai/installation#gpu-support: image

Types of changes

Does this address any currently open issues?

[list open issues here]

Outside contributors checklist

Thank you for contributing to SLEAP!

:heart:

Summary by CodeRabbit

roomrys commented 1 year ago

The test on the new build:

# The original LD_LIBRARY_PATH
(sleap_build) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ echo $LD_LIBRARY_PATH

# Activate the environment with the new build installed, note the LD_LIBRARY_PATH
(sleap_build) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ mm activate nb0
(nb0) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ echo $LD_LIBRARY_PATH
/home/talmolab/micromamba/envs/nb0/lib:
(nb0) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ echo $SLEAP_OLD_LD_LIBRARY_PATH

# Now lets deactivate the environment and check that LD_LIBRARY_PATH is reset
(nb0) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ mm deactivate
(sleap_build) talmolab@talmolab-01-ubuntu:~/sleap-estimates-animal-poses/pull-requests/sleap$ echo $LD_LIBRARY_PATH
coderabbitai[bot] commented 1 year ago

Walkthrough

This update enhances the Conda environment handling for SLEAP by ensuring both activation and deactivation scripts are properly copied. It also introduces a mechanism to manage LD_LIBRARY_PATH during environment activation/deactivation, and updates the documentation with instructions related to these changes and TensorFlow version management.

Changes

File Summary
.conda/build.sh Modified to copy both activate and deactivate scripts using a loop.
.conda/sleap_activate.sh Updated to export SLEAP_OLD_LD_LIBRARY_PATH and modify LD_LIBRARY_PATH.
.conda/sleap_deactivate.sh Resets LD_LIBRARY_PATH to its old value during environment deactivation.
docs/installation.md Added instructions for managing TensorFlow version and setting/resetting LD_LIBRARY_PATH.

🐇💻

In the land of code where the shadows lie,

The rabbit hops, his gaze held high.

With each leap, an improvement made,

In the realm of Conda, his mark is laid.

Scripts activated, deactivated in turn,

Through each line, a lesson learned.

Paths set right, TensorFlow tamed,

In the annals of code, his work is named. 🎉

Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - Mention `@coderabbitai` in any *review comment* for bot assistance. - Note: Review comments are made on code diffs or files, not on the PR overview. ### Pause Incremental Reviews - Insert `@coderabbitai: ignore` in the PR description to halt the bot's ongoing reviews. Remove the line to resume.