Fixing Remote Conda Environment Builds #154
sbrandstaeter
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🐍 Fixing Remote Conda Environment Builds
While using the remote build functionality, I ran into an issue where
conda(andmamba) weren’t available when running commands viassh, even though my.bashrcincluded the usualconda initblock.If you're able to run an interactive session on your host using SSH, you probably don't need to change anything.
You can check by running:
ssh user@host "which conda"This command is used internally in remote build operations and is where I hit the problem. In my case, I was not able to get
condaavailable in non-interactive SSH sessions.❌ Problem: Missing Conda Activation in Non-Interactive SSH Sessions
The culprit was this common pattern in my
.bashrc:This check causes the shell to exit early in non-interactive sessions (like
ssh host "cmd"), which prevents the Conda environment from being initialized.✅ Fix: Move Conda and Mamba Initialization Before the Interactivity Check
To fix this, I moved the entire
conda(andmamba) initialization block above thecase $-check.Here’s the corrected structure of
.bashrc:This change ensures that:
condaandmambaare initialized in all SSH sessions, including non-interactive ones.🔗 References
Hope this saves someone else some debugging time! 😅
Beta Was this translation helpful? Give feedback.
All reactions