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

This action fails in combination with Python 3.10 #169

Closed
csadorf opened this issue Nov 15, 2021 · 5 comments
Closed

This action fails in combination with Python 3.10 #169

csadorf opened this issue Nov 15, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@csadorf
Copy link

csadorf commented Nov 15, 2021

Describe the bug

Unable to use this step in combination with Python version "3.10".

The bug occurred as part of a workflow defined here.

To Reproduce

The following workflow definition should reproduce the problem:

  create-conda-environment:
    runs-on: ubuntu-latest

    - name: Setup Conda
      uses: s-weigand/setup-conda@v1
      with:
        python-version: '3.10'
        update-conda: false
        conda-channels: conda-forge

Expected behavior

The action creates a conda environment with Python 3.10.

@s-weigand
Copy link
Owner

@csadorf Thanks for reporting this bug!
Looks like this is due conflicts with the packages preinstalled in the conda base env on the runner.
I guess if a python-version is specified creating a new env and activating this should be faster anyway (hope I find time at the weekend to fix this).

That said I also fiddled around with the test you try to run and it looks like it doesn't do what you expect.
My guess of what you want to do is, that you want to verify that you can install the env in environment.yml on python 3.10.

A workaround for the previous behavior would be to install a python 3.10 env and run the code from there
E.g. with this workflow and the env resolution test passes. But when you have a look at commands output you see that it used python 3.9 (- conda-forge/linux-64::python==3.9.7=hb7a2778_3_cpython)

So if you want to test that the dependencies can be installed on python 3.10 you need to replace python~=3.7 in the environment.yml file with python~=3.10

name: test-install
on:
- push
jobs:
py310-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
- name: Create py310 env
run: |
conda create -y -n setup-conda-env python=3.10
- run: conda --version
- run: python --version
- run: which python
- name: Replace python version in environment.yml
shell: python
run: |
from pathlib import Path
env_file = Path("environment.yml")
env_file_text = env_file.read_text().replace("python~=3.7", "python~=3.10")
env_file.write_text(env_file_text)
- name: Show environment.yml
run: cat environment.yml
- name: Test conda environment
run: |
source activate setup-conda-env
python --version
which python
conda env create --dry-run -f environment.yml -n test-environment

And in that case, it fails due to the too strictly pinned versions.

Hope these workarounds help until I got time to fix the issue.

@s-weigand
Copy link
Owner

@all-contributors please add @csadorf for bug

@allcontributors
Copy link
Contributor

@s-weigand

I've put up a pull request to add @csadorf! 🎉

@s-weigand s-weigand added the bug Something isn't working label Nov 16, 2021
@csadorf
Copy link
Author

csadorf commented Nov 17, 2021

@s-weigand Thank you very much for the support and also for reviewing our workflow and even proposing an improvement. 👍

Indeed, the specification of a specific Python version as part of the job you replicated has no effect and I would only want to keep it to avoid unexpected failures related to the action.

However, the actual tests for checking whether the package can be installed for a specific Python version is implemented here:

    - name: Setup Conda
      uses: s-weigand/setup-conda@v1
      with:
        python-version: ${{ matrix.python-version }}
        update-conda: false
        conda-channels: conda-forge
    - run: conda --version
    - run: python --version
    - run: which python


    - name: Test direct installation
      run: |
        conda create --dry-run -n test-install aiida-core python=${{ matrix.python-version }}

And unless I am missing something it should work as expected.

Hope these workarounds help until I got time to fix the issue.

I will implement the workaround for now, so that we can move forward. Thank you!

@s-weigand
Copy link
Owner

This should be fixed in the v1.1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants