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

sh 2.0.0 breaks Isca installation #247

Open
sit23 opened this issue Mar 16, 2023 · 3 comments
Open

sh 2.0.0 breaks Isca installation #247

sit23 opened this issue Mar 16, 2023 · 3 comments
Labels
infrastructure Isca infrastructure: installation, CI, HPC setups priority:high High-priority task python Isca's python wrappers

Comments

@sit23
Copy link
Contributor

sit23 commented Mar 16, 2023

Description

I've just tried to do a fresh install of Isca on maths2 (one of our newer linux servers here in Exeter), and it's installed the sh package at version 2.0.0. When I try and run the Held Suarez test case, I get the following error:

python held_suarez_test_case.py 
Traceback (most recent call last):
  File "/emmy-noether/home/sit204/Isca/src/extra/python/isca/helpers.py", line 69, in git_run_in_directory
    git_test = codedir_git.log('-1', '--format="%H"').stdout
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'stdout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/emmy-noether/home/sit204/Isca/exp/test_cases/held_suarez/held_suarez_test_case.py", line 10, in <module>
    cb = DryCodeBase.from_directory(GFDL_BASE)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emmy-noether/home/sit204/Isca/src/extra/python/isca/codebase.py", line 35, in from_directory
    return cls(directory=directory, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emmy-noether/home/sit204/Isca/src/extra/python/isca/codebase.py", line 398, in __init__
    super(GreyCodeBase, self).__init__(*args, **kwargs)
  File "/emmy-noether/home/sit204/Isca/src/extra/python/isca/codebase.py", line 86, in __init__
    self.git = git_run_in_directory(GFDL_BASE, self.codedir)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/emmy-noether/home/sit204/Isca/src/extra/python/isca/helpers.py", line 73, in git_run_in_directory
    git_test = codedir_git.log('-1', '--format="%H"').stdout
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'stdout'

Upon closer inspection, it seems that sh 2.0.0 has changed its behaviour, such that the output of functions like codedir_git.log('-1', '--format="%H"') returns a str type, where previously it returned something of type sh.RunningCommand. The former does not have an stdout attr, but sh.RunningCommand does. This will need to be updated such that newer versions of sh can be accommodated.

@sit23 sit23 added priority:high High-priority task infrastructure Isca infrastructure: installation, CI, HPC setups python Isca's python wrappers labels Mar 16, 2023
@AndrewILWilliams
Copy link

Aha! I was just about to raise an issue because I'm also having a lot of problem with sh upon reinstalling Isca. Is there a simple fix for this?

Cheers, Andrew

@AndrewILWilliams
Copy link

I can get past it if I force sh==1.9 in the requirements.txt, but I'm not sure if that's correct because I still can't get it to run...potentially a different issue though

@sit23
Copy link
Contributor Author

sit23 commented Jul 13, 2023

The fix I used was just to install an older version of sh. I haven't gotten round to doing the fix for sh 2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Isca infrastructure: installation, CI, HPC setups priority:high High-priority task python Isca's python wrappers
Projects
None yet
Development

No branches or pull requests

2 participants