Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda initialization scripts in ~/.bash_profile are not idempotent #8703

Closed
DonJayamanne opened this issue May 20, 2019 · 2 comments
Closed
Labels
locked [bot] locked due to inactivity stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity

Comments

@DonJayamanne
Copy link

Current Behavior

The conda inialization scripts in ~/.bash_profile are not idempotent.

Steps to Reproduce


  • Install pipenv or similar to ensure Python is installed and in the current path.
    • Ensure we have PATH variable updated in ~/.bash_profile file to ensure the above python environment is in front.
  • Setup conda on a Mac
  • Ensure the initialization scripts are setup in ~/.bash_profile
  • Open a new terminal
    • At this point the conda initialization code will run and Conda will be in the path.
    • Type which python and this will point to a python environment from conda.
  • Open VS Code
    • Open a terminal inside vs code
    • Type which python and this will point to a non-conda python environment.

Note:

  • This happens because when VSCode launches, it launches within an environment with the ~/.bash_profile having been sourced. Now, when the terminal within VSC is opened, it sources the ~/.bash_profile file again. I.e. the code in ~/.bash_profile is sourced twice, as a result of this the path is updated. However the conda initialization scripts don't update the path when executed again.

Expected Behavior

  • The conda inialization scripts in ~/.bash_profile need to be idempotent.
  • Sourcing the ~/.bash_profile file multiple times should produce the same results.

Environment Information

`conda info`

n/a

`conda config --show-sources`

n/a

`conda list --show-channel-urls`

n/a

@msarahan /cc

@msarahan
Copy link
Contributor

Thanks for raising this. Did you try the auto_activate_base setting we discussed at PyCon? That might give you idempotency, and from there you can use conda activate to actually do the activation.

As a reminder, setting CONDA_AUTO_ACTIVATE_BASE=false as an env var in your process where you launch conda will make conda use that setting.

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label May 17, 2022
@github-actions github-actions bot added the stale::closed [bot] closed after being marked as stale label Jun 17, 2022
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Jun 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants