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

Unable to run on up-to-date Mac #341

Open
grahamas opened this issue Nov 20, 2022 · 6 comments
Open

Unable to run on up-to-date Mac #341

grahamas opened this issue Nov 20, 2022 · 6 comments

Comments

@grahamas
Copy link

On up-to-date OSX it doesn't seem possible to run pymagicc--- is this correct?

The problem is that 32-bit applications (including wine) are no longer supported (see: https://superuser.com/questions/1513877/bad-cpu-type-in-executable-wine-macos-catalina).

If this is the case, could you update the README to make this apparent up front? Otherwise, are there any workarounds?

@rgieseke
Copy link
Member

Does it work with the MAGICC7 binary available here? https://magicc.org/download/magicc7

See further down in the README on how to use a different binary.

@grahamas
Copy link
Author

That does seem to be the correct workaround. We weren't able to get it to work, though for seemingly unrelated reasons (libgfortran wasn't linked properly and we gave up). I would request updating the README for Macs since using the provided binary will be necessary for all Macs going forward.

@Aq0amancer
Copy link

Having the same issue, both libgfortran is not linked and struggling with setting the environment variable to use 'magicc-darwin-arm64' in MAGICC7. An updated readme would be really helpful, thank you!

@seangtkelley
Copy link

@Aq0amancer and @grahamas, not sure if you're still experiencing the issue with libgfortran, but there's the steps I recently took to get it to work on macOS Sequoia:

# ensure gcc is installed as that provides libgfortran
brew install gcc

# find path to libgfortran.5.dylib
find /opt/homebrew -name "libgfortran*.dylib"

# use environment variable to specify the path to libgfortran
# in my case, my path looked like the following
export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current:$DYLD_LIBRARY_PATH

# now you should be able to use the magicc7 executable
./magicc-darwin-arm64

For using pymagicc, you'll also need the MAGICC_EXECUTABLE_7 env var as mentioned at the bottom of the README. I have the following cell in my python notebook before using pymagicc:

%env DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current:$DYLD_LIBRARY_PATH
%env MAGICC_EXECUTABLE_7=/path/to/magicc/magicc-v7.5.3/bin/magicc-darwin-arm64

@seangtkelley
Copy link

As a follow up to my previous comment, using the DYLD_LIBRARY_PATH environment variable did resolve the libgfortran issue, but I still cannot get the Mac binary to work.

Running the MAGICC7.ipynb with the following modifications to cell 4:

scenario_names = list(map(str.lower, scenarios.rcps.meta["scenario"].unique()))
results = []
for name in scenario_names:
    print("running {}".format(name))
    scen = getattr(scenarios, name)
    scen_results = pymagicc.run(scen, magicc_version=7)
    results.append(scen_results)

I get the following output:

running rcp26
[/Users/seangtkelley/miniconda3/envs/climate-model-pymagicc/lib/python3.13/site-packages/pymagicc/io/scen7.py:43](https://file+.vscode-resource.vscode-cdn.net/Users/seangtkelley/miniconda3/envs/climate-model-pymagicc/lib/python3.13/site-packages/pymagicc/io/scen7.py:43): UserWarning: MAGICC6 RCP region naming (R5*) is not compatible with MAGICC7, automatically renaming to MAGICC7 compatible regions (R5.2*)
  warnings.warn(warn_msg)
[/Users/seangtkelley/miniconda3/envs/climate-model-pymagicc/lib/python3.13/site-packages/pymagicc/io/scen7.py:43](https://file+.vscode-resource.vscode-cdn.net/Users/seangtkelley/miniconda3/envs/climate-model-pymagicc/lib/python3.13/site-packages/pymagicc/io/scen7.py:43): UserWarning: MAGICC6 RCP region naming (R5*) is not compatible with MAGICC7, automatically renaming to MAGICC7 compatible regions (R5.2*)
  warnings.warn(warn_msg)
Image

For now, I cannot figure out why no output is produced. I've double checked that my MAGCFG_USER.CFG has the required lines.

@znicholls
Copy link
Collaborator

znicholls commented Feb 13, 2025

Hi all, apologies for the lack of reply on this issue. Supporting users is something I wish I had more time to do, but I just haven't managed to work out how to find the time to do so up until now.

However, on this issue I can probably offer at least a bit of help. You need to tell MAGICC to write output. By default, MAGICC7 doesn't (for reasons that make sense for developers but obviously aren't a helpful default for users, anyway). The simplest option is to put out_temperature=1 either when running from Python or in your MAGCFG_USER.CFG. The other option is to pick the variables directly and then supply them to out_dynamic_vars e.g. out_dynamic_vars=[ "DAT_SURFACE_ANNUALMEANTEMP", "DAT_SURFACE_ANNUALMEAN_MIXLTEMP", ] (or e.g. OUT_DYNAMIC_VARS="DAT_SURFACE_ANNUALMEANTEMP,DAT_SURFACE_ANNUALMEAN_MIXLTEMP" if you're doing this in MAGCFG_USER.CFG). Unfortunately, there is no really easy way to know what the variables actually mean at this point. You will likely be able guess most of them from looking at their names, but this is definitely an area where the current set up leaves quite a bit to be desired yet we have just not found the time to update it yet. If you want a list, have a look at: https://gitlab.com/magicc/magicc/-/blob/main/src/libmagicc/register_outputs.f90.inc?ref_type=heads

As one other note, you may find the OpenSCM-Runner interface generally easier to work with. The MAGICC-specific docs are here: https://openscm-runner.readthedocs.io/en/latest/notebooks/magicc/run-magicc.html

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

5 participants