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

/etc/profile.d/bash_completion.sh: No such file or directory #2

Closed
astier opened this issue Nov 13, 2019 · 6 comments
Closed

/etc/profile.d/bash_completion.sh: No such file or directory #2

astier opened this issue Nov 13, 2019 · 6 comments

Comments

@astier
Copy link

astier commented Nov 13, 2019

Executing the following line as described in the README

source $CONDA_ROOT/etc/profile.d/bash_completion.sh

fails with the following message

/etc/profile.d/bash_completion.sh: No such file or directory

What is the correct path?

@tartansandal
Copy link
Owner

Thanks for the feedback @astier 😄. I'm updated the installation instruction to be (hopefully) more clear:

CONDA_ROOT=~/anaconda3   # <- set to your Anaconda/Miniconda installation directory
source $CONDA_ROOT/etc/profile.d/bash_completion.sh

Does this make sense?

@astier
Copy link
Author

astier commented Nov 14, 2019

I just added to my bashrc

[ -r ~/miniconda3/etc/profile.d/bash_completion.sh ] &&. ~/miniconda3/etc/profile.d/bash_completion.sh

It works. Thanks. Why do we need to set CONDA_ROOT?

@tartansandal
Copy link
Owner

Great that you have got it working! 😄

I'll think about adding your file existence check, though this is an edge case -- if it gets too convoluted, then its not the right approach.

Setting CONDA_ROOT was the simplest way I could think of to explain what needed to be done. My other attempts at explaining this where much more convoluted. (If you can think of some alternatives, please, let me know).

Technically, CONDA_ROOT corresponds to the CONDA_PREFIX of the CONDA_DEFAULT_ENV environment, although it is not explicitly defined (I think it should be). You could get there with:

CONDA_ROOT = $(dirname $(dirname $CONDA_EXE)))

but that does not work on all platforms and setups, especially if you install the package into another environment. Ah well. Such is the tyranny of systems programming.

@astier
Copy link
Author

astier commented Nov 14, 2019

Isn't the file-check required when conda-bash-completion is not installed?

@tartansandal
Copy link
Owner

Isn't the file-check required when conda-bash-completion is not installed?

If that's the case, then you would be doing a manual installation, with the bash-completion library installed and loaded independently. But then you don't need to add anything to your .bashrc file.

I'll make the two installation methods more explicit.

There might be a case where you:

  1. Install conda-bash-completion and bash-completion as a dependency
  2. Modify your .bashrc
  3. Uninstall conda-bash-completion
  4. Now bash initialisation raises an error

So protecting against this is reasonable. Thanks for the feedback on this 😄

@astier
Copy link
Author

astier commented Nov 18, 2019

I am checking if the file exists because if I make a fresh linux-install I pull my dotfiles with the bashrc which tries to source the conda-completion-file but would fail because I usually don't install conda right away.

@astier astier closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants