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

Issues finding existing conda env, caused by environment.yml line endings #13

Open
onavhamid opened this issue Aug 5, 2022 · 0 comments

Comments

@onavhamid
Copy link

Thanks for this script! Had been working great for me with the exception of one repository. Entering via the terminal kicked off the correct creation of the environment. However, once created, the conda_auto_env script failed to find it. So it would again try to create it, but conda would warn that the env already exists. This cycle would continue.

Some digging lead pointed to the line endings of the environment.yml file. The problematic repository had windows-based line endings.

> cat -e environment.yml
name: SampleName^M$
dependencies:^M$
  - python=3.10^M$
  - pip=22.1^M$

Repositories that worked fine had unix endings:

> cat -e environment.yml
name: AnotherSampleName$
dependencies:$
  - python=3.9.5$
  - bokeh=2.3.2$

From my brief exploration, it appears this line:

if [[ $PATH != *$ENV* ]]; then
fails to handle DOS endings. Converting the line endings to UNIX, as described in SO resolved the issue for the problematic repository.

onavhamid added a commit to onavhamid/ImageAnalysis that referenced this issue Aug 5, 2022
This was done to resolve [issue](chdoig/conda-auto-env#13)
with `conda_auto_env` script.
onavhamid added a commit to onavhamid/ImageAnalysis that referenced this issue Aug 5, 2022
Tested with `scripts/explorer.py` on Ubuntu 20.04 conda conda 4.13.0.
This was done to resolve [issue](chdoig/conda-auto-env#13)
with `conda_auto_env` script.
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

1 participant