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

Unit test workflow failed setting up conda environment: "Warning: Pip subprocess error" #111

Closed
prjemian opened this issue Apr 15, 2021 · 5 comments · Fixed by #112
Closed
Assignees
Labels
Milestone

Comments

@prjemian
Copy link
Contributor

The code passed unit tests locally but the GitHub actions workflow failed while setting up the conda/pip environment using mamba. (Pip could not find the named conda environment for py36 & py38).

Warning: Pip subprocess error:
Not a conda environment: /usr/share/miniconda/envs/hklpy-test-3.8
/usr/share/miniconda/envs/${ENV_NAME}/.tmp6z870pyp: line 3: /usr/share/miniconda/envs/hklpy-test-3.8/bin/python: No such file or directory

Originally posted by @prjemian in #100 (comment)

This is a new failure (since last commit a few months ago) of the workflow. The failure happened before the repo's code was installed, while constructing the conda environment when adding the pip requirements. Pip could not find the environment directory.

@prjemian prjemian self-assigned this Apr 15, 2021
@prjemian prjemian added the bug label Apr 15, 2021
@prjemian prjemian added this to the v0.3.16 milestone Apr 15, 2021
@prjemian prjemian changed the title Unit test workflow failed Unit test workflow failed setting up conda environment: "Warning: Pip subprocess error" Apr 16, 2021
@prjemian
Copy link
Contributor Author

Reported previously in the setup-miniconda repo we're using in our workflow. Suggested remedies are:

  1. don't use python-version (hint: use sed to rewrite environment.yml and specify python version)
  2. continue with python-version but separate the pip install into a separate workflow command

We're using python-version in our workflow now.

@prjemian
Copy link
Contributor Author

We're already using sed to specify the python version:

- name: set environment name in YAML file
shell: bash -l {0}
run: |
sed -i.bak "s/name: ${PACKAGE}/name: ${ENV_NAME}/g" environment.yml
but also specifying python-version in the config:
python-version: ${{ matrix.python-version }}

Comment-out line 35 and give it a try.

prjemian added a commit that referenced this issue Apr 16, 2021
@prjemian
Copy link
Contributor Author

Commit 96f672c did not solve the problem. Plan B is to separate the pip install to a separate command.

Need to rewrite environment.yml and remove the pip requirements, writing them to a requirements.txt file, then add the pip install step (after activating the new conda environment).

If the sed can be replaced with a python script, this will be easy. It requires that some python version be available at that part of the script. Test that next. Since this is a test, comment all the later steps for now.

prjemian added a commit that referenced this issue Apr 16, 2021
@prjemian
Copy link
Contributor Author

Result (python 3.8.5 is available as python or python3):

  which python
  which python3
  python --version
  python3 --version
  shell: /usr/bin/bash -l {0}
  env:
    ENV_NAME: hklpy-test-3.8
    PACKAGE: hklpy
/usr/bin/python
/usr/bin/python3
Python 3.8.5
Python 3.8.5

prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
prjemian added a commit that referenced this issue Apr 16, 2021
@prjemian
Copy link
Contributor Author

The root problem was in the workflow with activate-environment: ${ENV_NAME}.

Replacing that with activate-environment: test-hklpy has a successful outcome for all Python versions tested 3.6, 3.7, 3.8). For now, all will use the conda environment name test-hklpy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant