- 1 year ago
Windows cmd git bash: conda.sh no such file or directory (Windows line endings, missing slashes)
The error "conda.sh no such file or directory" on Windows cmd or Git Bash when trying to run a conda-related script usually occurs due to incompatibility between Windows-style line endings (CRLF) and Unix-style line endings (LF). Additionally, it can happen if the path contains incorrect slashes.
To resolve this issue, you need to make sure the script uses the correct line endings and that the path to the script is written with the proper slashes for Windows.
Here's how you can fix it:
Fix Line Endings:
Open theconda.sh
file in a text editor, and convert the line endings to Windows-style (CRLF) if they are in Unix-style (LF). Most modern text editors, including VSCode, Notepad++, and Sublime Text, automatically handle line ending conversions. Save the file after the change.Check Script Path:
Double-check that you are using the correct path to theconda.sh
file. Ensure that you provide the full, absolute path to the script or navigate to the script's directory before running it.Use Correct Slashes:
In Git Bash or Windows cmd, you should use forward slashes ("/") instead of backslashes ("\") for specifying the path to the script.Correct example:
bashsource /path/to/conda.sh
Incorrect example:
bashsource C:\path\to\conda.sh # Incorrect use of backslashes
Activate conda Environment:
If you are trying to activate a conda environment usingconda.sh
, make sure you are using the correct environment name.bashsource /path/to/conda.sh
conda activate my_env
After making these changes, the conda.sh
script should run without any "no such file or directory" errors in both Windows cmd and Git Bash. Make sure you have the appropriate permissions to run the script, and if you are using Git Bash, ensure that the conda
command is available in your Git Bash environment.