This page was generated from docs/Installation/MAGEMin_PythonCall.ipynb. Interactive online version: Binder badge.

Python Notebook Download

Please download this notebook (use the links above to find the source file) and run the following installation script as a notebook.

Running MAGEMin calculations through Julia

PetThermoTools provides the ability to run calculations/models that utilize the recent Weller et al. (2024) and Green et al. (2025) thermodynamic models. Once everything is set up you should be able to run these calculations from the same functions used to run models with alphaMELTS, but simply setting the Model kwarg to Green2025 or Weller2024.

I’ve worked hard to try and ensure a set up routine that works on every operating system, regardless of prior installations etc. There is, however, a good chance you’ll come across a bug/issue I haven’t seen before. If there is an issue in the following script/functions please email me (gleesonm@berkeley.edu) and I will try to find a fix as quickly as possible!

The following notebook and functions will establish a new julia environment on your machine. From PetThermoTools v0.2.51 and later this environment will be activated whenever a MAGEMin calculation is initialized from Python. This should ensure that any prior julia installations/packages on your machine are not influenced by the following installation routine.

Step 1 - install juliacall

Uncomment the line below and install juliacall in your Python environment. You must have first installed petthermotools!

[2]:
# %pip install juliacall

Step 2 - Install MAGEMin

Import PetThermoTools (install it if you haven’t done so yet) and then use the inbuilt functions to install MAGEMin_C and MAGEMinCalc using the function below. You will need top uncomment the function to run it. If you’ve previously run this section successfully import PetThermoTools and then go to Step 2b to update the MAGEMinCalc and MAGEMin_C installations.

[ ]:
# %pip install petthermotools #### If running on Victor uncomment this line to install petthermotools
[1]:
import petthermotools as ptt
ptt.__version__  # should ve v0.3.2 or later
alphaMELTS for Python files successfully located.
If using the Green et al. (2025) or Weller et al. (2024) thermodynamic models please run `ptt.activate_petthermotools_env()` prior to any calculations.
[1]:
'1.1.9'

This code installs MAGEMinCalc and underlying dependencies in julia and links them to the PetThermoTools installation. In a couple of cases the code below has caused the Python kernel to crash AFTER it completed. Therefore if a kernel crash message appears don’t worry, just restart the kernel and procede to the test_MAGEMinCalc() function below (step 3).

NOTE ######### This may take 20-25 minutes on some computers, go grab a drink!

[2]:
ptt.install_MAGEMinCalc()
If you encounter issues with the installation process please contact me at gleesonm@berkeley.edu
Detected IPython. Loading juliacall extension. See https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
Precompiling project...
    725.2 ms  ✓ CommonSolve
    786.0 ms  ✓ Tables
   2153.0 ms  ✓ OpenBLAS32_jll
   2245.1 ms  ✓ Accessors
    718.0 ms  ✓ Accessors → LinearAlgebraExt
   1041.0 ms  ✓ MAGEMin_jll
   1111.6 ms  ✓ Accessors → TestExt
   2395.2 ms  ✓ Roots
  11405.1 ms  ✓ PythonCall
  46577.6 ms  ✓ MAGEMin_C
   3559.4 ms  ✓ MAGEMinCalc
  11 dependencies successfully precompiled in 57 seconds. 103 already precompiled.
  2 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions. Otherwise, loading dependents of these packages may trigger further precompilation to work with the unexpected versions.
  1 dependency had output during precompilation:
┌ MAGEMinCalc
│  Using libMAGEMin.dylib from MAGEMin_jll
└
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  [6099a3de] - PythonCall v0.9.35
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
        Info We haven't cleaned this depot up for a bit, running Pkg.gc()...
      Active manifest files: 4 found
      Active artifact files: 13 found
      Active scratchspaces: 0 found
     Deleted 7 package installations (6.020 MiB)
     Deleted 11 artifact installations (578.325 MiB)
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  [e5d170eb] - MAGEMin_C v2.2.6
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  [dd69d18c] - MAGEMinCalc v0.6.2 `https://github.com/gleesonm1/MAGEMinCalc.git#v0.6.2`
    Updating `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
  [7d9f7c33] - Accessors v0.1.45
  [26cce99e] - BasicInterpolators v0.7.1
  [fa961155] - CEnum v0.4.2
  [336ed68f] - CSV v0.10.16
  [944b1d66] - CodecZlib v0.7.8
  [38540f10] - CommonSolve v0.2.9
  [34da2185] - Compat v4.18.1
  [a33af91c] - CompositionsBase v0.1.2
  [992eb4ea] - CondaPkg v0.2.36
  [187b0558] - ConstructionBase v1.6.0
  [a8cc5b0e] - Crayons v4.1.1
  [9a962f9c] - DataAPI v1.16.0
  [a93c6f00] - DataFrames v1.7.1
  [864edb3b] - DataStructures v0.19.5
  [e2d170a0] - DataValueInterfaces v1.0.0
  [ffbed154] - DocStringExtensions v0.9.5
  [48062228] - FilePathsBase v0.9.24
  [842dd82b] - InlineStrings v1.4.5
  [3587e190] - InverseFunctions v0.1.17
  [41ab1584] - InvertedIndices v1.3.1
  [92d709cd] - IrrationalConstants v0.2.6
  [82899510] - IteratorInterfaceExtensions v1.0.0
  [692b3bcd] - JLLWrappers v1.8.0
  [682c06a0] - JSON v1.6.1
  [b964fa9f] - LaTeXStrings v1.4.0
  [2ab3a3ac] - LogExpFunctions v1.0.1
  [dd69d18c] - MAGEMinCalc v0.6.2 `https://github.com/gleesonm1/MAGEMinCalc.git#v0.6.2`
  [e5d170eb] - MAGEMin_C v2.2.6
  [1914dd2f] - MacroTools v0.5.16
  [c03570c3] - Memoize v0.4.4
  [0b3b1443] - MicroMamba v0.1.15
  [e1d29d7a] - Missings v1.2.0
  [bac558e1] - OrderedCollections v1.8.2
  [69de0a69] - Parsers v2.8.6
  [fa939f87] - Pidfile v1.3.0
  [f27b6e38] - Polynomials v4.1.1
  [2dfb63ee] - PooledArrays v1.4.3
  [aea7be01] - PrecompileTools v1.2.1
  [21216c6a] - Preferences v1.5.2
  [08abe8d2] - PrettyTables v2.4.0
  [92933f4c] - ProgressMeter v1.11.0
  [6099a3de] - PythonCall v0.9.35
  [189a3867] - Reexport v1.2.2
  [f2b01f46] - Roots v2.3.0
  [6c6a2e73] - Scratch v1.3.0
  [91c51154] - SentinelArrays v1.4.10
  [efcf1570] - Setfield v1.1.2
  [a2af1166] - SortingAlgorithms v1.2.3
  [276daf66] - SpecialFunctions v2.8.0
  [1e83bf80] - StaticArraysCore v1.4.4
  [10745b16] - Statistics v1.11.1
  [892a3eda] - StringManipulation v0.4.4
  [ec057cc2] - StructUtils v2.8.2
  [3783bdb8] - TableTraits v1.0.1
  [bd369af6] - Tables v1.13.0
  [3bb67fe8] - TranscodingStreams v0.11.3
  [e17b2a0c] - UnsafePointers v1.0.0
  [ea10d353] - WeakRefStrings v1.4.3
  [76eceee3] - WorkerUtilities v1.6.1
  [763ebaa8] - MAGEMin_jll v1.9.6+0
  [079eb43e] - NLopt_jll v2.8.0+0
  [656ef2d0] - OpenBLAS32_jll v0.3.33+2
  [efe28fd5] - OpenSpecFun_jll v0.5.6+0
  [f8abcde7] - micromamba_jll v2.3.1+0
  [4d7b5844] - pixi_jll v0.63.2+0
  [0dad84c5] - ArgTools v1.1.2
  [56f22d72] - Artifacts v1.11.0
  [2a0f44e3] - Base64 v1.11.0
  [ade2ca70] - Dates v1.11.0
  [8ba89e20] - Distributed v1.11.0
  [f43a241f] - Downloads v1.6.0
  [7b1f6079] - FileWatching v1.11.0
  [9fa8497b] - Future v1.11.0
  [b77e0a4c] - InteractiveUtils v1.11.0
  [4af54fe1] - LazyArtifacts v1.11.0
  [b27032c2] - LibCURL v0.6.4
  [76f85450] - LibGit2 v1.11.0
  [8f399da3] - Libdl v1.11.0
  [37e2e46d] - LinearAlgebra v1.11.0
  [56ddb016] - Logging v1.11.0
  [d6f4376e] - Markdown v1.11.0
  [a63ad114] - Mmap v1.11.0
  [ca575930] - NetworkOptions v1.2.0
  [44cfe95a] - Pkg v1.11.0
  [de0858da] - Printf v1.11.0
  [9a3f8284] - Random v1.11.0
  [ea8e919c] - SHA v0.7.0
  [9e88b42a] - Serialization v1.11.0
  [1a1011a3] - SharedArrays v1.11.0
  [6462fe0b] - Sockets v1.11.0
  [2f01184e] - SparseArrays v1.11.0
  [fa267f1f] - TOML v1.0.3
  [a4e569a6] - Tar v1.10.0
  [8dfed614] - Test v1.11.0
  [cf7118a7] - UUIDs v1.11.0
  [4ec0a83e] - Unicode v1.11.0
  [e66e0078] - CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] - LibCURL_jll v8.6.0+0
  [e37daf67] - LibGit2_jll v1.7.2+0
  [29816b5a] - LibSSH2_jll v1.11.0+1
  [c8ffd9c3] - MbedTLS_jll v2.28.6+0
  [14a3606d] - MozillaCACerts_jll v2023.12.12
  [4536629a] - OpenBLAS_jll v0.3.27+1
  [05823500] - OpenLibm_jll v0.8.5+0
  [bea87d4a] - SuiteSparse_jll v7.7.0+0
  [83775a58] - Zlib_jll v1.2.13+1
  [8e850b90] - libblastrampoline_jll v5.11.0+0
  [8e850ede] - nghttp2_jll v1.59.0+0
  [3f19e933] - p7zip_jll v17.4.0+2
      Active manifest files: 4 found
      Active artifact files: 12 found
      Active scratchspaces: 0 found
     Deleted no artifacts, repos, packages or scratchspaces
    Updating registry at `C:\Users\Matt\.julia\registries\General.toml`
   Resolving package versions...
   Installed pixi_jll ─────────── v0.76.2+0
   Installed Parsers ──────────── v3.0.0
   Installed Tables ───────────── v1.14.0
   Installed StructUtils ──────── v2.9.2
   Installed JSON ─────────────── v1.10.0
   Installed OrderedCollections ─ v2.0.2
   Installed Preferences ──────── v1.6.0
   Installed PythonCall ───────── v0.9.36
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  [6099a3de] + PythonCall v0.9.36
    Updating `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
  [992eb4ea] + CondaPkg v0.2.36
  [9a962f9c] + DataAPI v1.16.0
  [e2d170a0] + DataValueInterfaces v1.0.0
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [692b3bcd] + JLLWrappers v1.8.0
  [682c06a0] + JSON v1.10.0
  [1914dd2f] + MacroTools v0.5.16
  [0b3b1443] + MicroMamba v0.1.15
  [bac558e1] + OrderedCollections v2.0.2
  [69de0a69] + Parsers v3.0.0
  [fa939f87] + Pidfile v1.3.0
⌅ [aea7be01] + PrecompileTools v1.2.1
  [21216c6a] + Preferences v1.6.0
  [6099a3de] + PythonCall v0.9.36
  [6c6a2e73] + Scratch v1.3.0
  [ec057cc2] + StructUtils v2.9.2
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.14.0
  [e17b2a0c] + UnsafePointers v1.0.0
  [f8abcde7] + micromamba_jll v2.3.1+0
  [4d7b5844] + pixi_jll v0.76.2+0
  [0dad84c5] + ArgTools v1.1.2
  [56f22d72] + Artifacts v1.11.0
  [2a0f44e3] + Base64 v1.11.0
  [ade2ca70] + Dates v1.11.0
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching v1.11.0
  [b77e0a4c] + InteractiveUtils v1.11.0
  [4af54fe1] + LazyArtifacts v1.11.0
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2 v1.11.0
  [8f399da3] + Libdl v1.11.0
  [56ddb016] + Logging v1.11.0
  [d6f4376e] + Markdown v1.11.0
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.11.0
  [de0858da] + Printf v1.11.0
  [9a3f8284] + Random v1.11.0
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization v1.11.0
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test v1.11.0
  [cf7118a7] + UUIDs v1.11.0
  [4ec0a83e] + Unicode v1.11.0
  [deac9b47] + LibCURL_jll v8.6.0+0
  [e37daf67] + LibGit2_jll v1.7.2+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.6+0
  [14a3606d] + MozillaCACerts_jll v2023.12.12
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850ede] + nghttp2_jll v1.59.0+0
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
    565.4 ms  ✓ OrderedCollections
    619.0 ms  ✓ Preferences
    742.0 ms  ✓ StructUtils
   1057.1 ms  ✓ Tables
    466.0 ms  ✓ StructUtils → StructUtilsTablesExt
   1713.4 ms  ✓ pixi_jll
  14922.8 ms  ✓ Parsers
   6172.2 ms  ✓ JSON
   9121.1 ms  ✓ CondaPkg
   8925.7 ms  ✓ PythonCall
  10 dependencies successfully precompiled in 40 seconds. 39 already precompiled.
  7 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions. Otherwise, loading dependents of these packages may trigger further precompilation to work with the unexpected versions.
  1 dependency had output during precompilation:
┌ CondaPkg
│  Downloading artifact: pixi
└
    Updating git-repo `https://github.com/gleesonm1/MAGEMinCalc.git`
   Resolving package versions...
   Installed Crayons ──────────── v4.2.0
   Installed InlineStrings ────── v1.4.6
   Installed MAGEMin_jll ──────── v2.0.7+0
   Installed OpenBLAS32_jll ───── v0.3.34+0
   Installed LaTeXStrings ─────── v1.4.1
   Installed Statistics ───────── v1.11.5
   Installed Polynomials ──────── v4.1.3
   Installed CommonSolve ──────── v0.2.14
   Installed DataStructures ───── v0.19.6
   Installed StringManipulation ─ v0.6.1
   Installed DataFrames ───────── v1.8.2
   Installed PrettyTables ─────── v3.5.0
   Installed MAGEMin_C ────────── v1.2.4
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  [dd69d18c] + MAGEMinCalc v0.6.3 `https://github.com/gleesonm1/MAGEMinCalc.git#v0.6.3`
    Updating `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
  [7d9f7c33] + Accessors v0.1.45
  [26cce99e] + BasicInterpolators v0.7.1
⌅ [fa961155] + CEnum v0.4.2
  [38540f10] + CommonSolve v0.2.14
  [34da2185] + Compat v4.18.1
  [a33af91c] + CompositionsBase v0.1.2
  [187b0558] + ConstructionBase v1.6.0
  [a8cc5b0e] + Crayons v4.2.0
  [a93c6f00] + DataFrames v1.8.2
  [864edb3b] + DataStructures v0.19.6
⌅ [842dd82b] + InlineStrings v1.4.6
  [3587e190] + InverseFunctions v0.1.17
  [41ab1584] + InvertedIndices v1.3.1
  [b964fa9f] + LaTeXStrings v1.4.1
  [dd69d18c] + MAGEMinCalc v0.6.3 `https://github.com/gleesonm1/MAGEMinCalc.git#v0.6.3`
⌃ [e5d170eb] + MAGEMin_C v1.2.4
  [c03570c3] + Memoize v0.4.4
  [e1d29d7a] + Missings v1.2.0
  [f27b6e38] + Polynomials v4.1.3
  [2dfb63ee] + PooledArrays v1.4.3
  [08abe8d2] + PrettyTables v3.5.0
  [189a3867] + Reexport v1.2.2
⌃ [f2b01f46] + Roots v2.3.0
  [91c51154] + SentinelArrays v1.4.10
  [efcf1570] + Setfield v1.1.2
  [a2af1166] + SortingAlgorithms v1.2.3
  [1e83bf80] + StaticArraysCore v1.4.4
  [10745b16] + Statistics v1.11.5
  [892a3eda] + StringManipulation v0.6.1
  [763ebaa8] + MAGEMin_jll v2.0.7+0
⌅ [079eb43e] + NLopt_jll v2.8.0+0
  [656ef2d0] + OpenBLAS32_jll v0.3.34+0
  [8ba89e20] + Distributed v1.11.0
  [9fa8497b] + Future v1.11.0
  [37e2e46d] + LinearAlgebra v1.11.0
  [a63ad114] + Mmap v1.11.0
  [3fa0cd96] + REPL v1.11.0
  [1a1011a3] + SharedArrays v1.11.0
  [6462fe0b] + Sockets v1.11.0
  [2f01184e] + SparseArrays v1.11.0
  [f489334b] + StyledStrings v1.11.0
  [e66e0078] + CompilerSupportLibraries_jll v1.1.1+0
  [4536629a] + OpenBLAS_jll v0.3.27+1
  [bea87d4a] + SuiteSparse_jll v7.7.0+0
  [8e850b90] + libblastrampoline_jll v5.11.0+0
        Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
Precompiling project...
    549.3 ms  ✓ LaTeXStrings
    596.1 ms  ✓ StructUtils → StructUtilsStaticArraysCoreExt
    666.1 ms  ✓ Statistics
    693.8 ms  ✓ CommonSolve
    759.3 ms  ✓ InlineStrings
    747.7 ms  ✓ OpenBLAS32_jll
   1309.5 ms  ✓ Crayons
    615.5 ms  ✓ InlineStrings → ParsersExt
    806.8 ms  ✓ Statistics → SparseArraysExt
   1874.7 ms  ✓ DataStructures
   1423.9 ms  ✓ MAGEMin_jll
    502.5 ms  ✓ SortingAlgorithms
   2558.4 ms  ✓ Roots
   1176.1 ms  ✓ MAGEMin_C
   3633.7 ms  ✓ StringManipulation
  13770.9 ms  ✓ Polynomials
  17059.3 ms  ✓ PrettyTables
  23773.6 ms  ✓ DataFrames
   3675.6 ms  ✓ MAGEMinCalc
  19 dependencies successfully precompiled in 49 seconds. 82 already precompiled.
  1 dependency had output during precompilation:
┌ MAGEMinCalc
│  Using libMAGEMin.dylib from MAGEMin_jll
└
   Resolving package versions...
   Installed CSV ──────────────── v0.10.17
   Installed SpecialFunctions ─── v2.9.0
   Installed Parsers ──────────── v2.8.8
   Installed StringManipulation ─ v0.4.7
   Installed LogExpFunctions ──── v1.0.2
   Installed CodecZlib ────────── v0.7.9
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
⌃ [e5d170eb] + MAGEMin_C v2.2.6
    Updating `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
⌅ [336ed68f] + CSV v0.10.17
  [944b1d66] + CodecZlib v0.7.9
⌅ [a93c6f00] ↓ DataFrames v1.8.2 ⇒ v1.7.1
  [ffbed154] + DocStringExtensions v0.9.5
  [48062228] + FilePathsBase v0.9.24
  [92d709cd] + IrrationalConstants v0.2.6
  [2ab3a3ac] + LogExpFunctions v1.0.2
⌃ [e5d170eb] ↑ MAGEMin_C v1.2.4 ⇒ v2.2.6
⌅ [69de0a69] ↓ Parsers v3.0.0 ⇒ v2.8.8
⌅ [08abe8d2] ↓ PrettyTables v3.5.0 ⇒ v2.4.0
  [92933f4c] + ProgressMeter v1.11.0
  [276daf66] + SpecialFunctions v2.9.0
⌅ [892a3eda] ↓ StringManipulation v0.6.1 ⇒ v0.4.7
  [3bb67fe8] + TranscodingStreams v0.11.3
⌅ [ea10d353] + WeakRefStrings v1.4.3
  [76eceee3] + WorkerUtilities v1.6.1
⌅ [763ebaa8] ↓ MAGEMin_jll v2.0.7+0 ⇒ v1.9.6+0
  [efe28fd5] + OpenSpecFun_jll v0.5.6+0
  [3fa0cd96] - REPL v1.11.0
  [f489334b] - StyledStrings v1.11.0
  [05823500] + OpenLibm_jll v0.8.5+0
        Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
Precompiling project...
    609.6 ms  ✓ LogExpFunctions
    561.9 ms  ✓ CodecZlib
    647.0 ms  ✓ MAGEMin_jll
    438.8 ms  ✓ LogExpFunctions → LogExpFunctionsInverseFunctionsExt
   2750.0 ms  ✓ StringManipulation
   3109.6 ms  ✓ SpecialFunctions
   5118.9 ms  ✓ Parsers
    512.5 ms  ✓ InlineStrings → ParsersExt
    715.6 ms  ✓ WeakRefStrings
   4519.1 ms  ✓ JSON
   2024.5 ms  ✓ CondaPkg
  11191.1 ms  ✓ PrettyTables
  10066.1 ms  ✓ CSV
   9516.2 ms  ✓ PythonCall
  23774.3 ms  ✓ DataFrames
   3280.4 ms  ✓ MAGEMin_C
   3276.6 ms  ✓ MAGEMinCalc
  17 dependencies successfully precompiled in 45 seconds. 97 already precompiled.
  3 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions. Otherwise, loading dependents of these packages may trigger further precompilation to work with the unexpected versions.
  1 dependency had output during precompilation:
┌ MAGEMinCalc
│  Using libMAGEMin.dylib from MAGEMin_jll
└
   Resolving package versions...
    Updating `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
⌅ [69de0a69] + Parsers v2.8.8
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
MAGEMin environment ready at C:/Users/Matt/.petthermotools_julia_env

Step 2b - Update MAGEMin

If you’ve previously run the cell above but need to update the MAGEMinCalc and MAGEMin_C versions following a PetThermoTools update, uncomment and run the cell below.

[3]:
# ptt.update_MAGEMinCalc()
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
   Resolving package versions...
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
   Resolving package versions...
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
   Resolving package versions...
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Project.toml`
  No Changes to `C:\Users\Matt\.petthermotools_julia_env\Manifest.toml`
MAGEMin environment updated at C:/Users/Matt/.petthermotools_julia_env

Step 3 - test the installation

Test the installation by running the following cell. This is calling the MAGEMinCalc functions directly with Julia code using juliacall. This is different to how the code is usually initiated in PetThermoTools but it provides an initial test of the installation. If successful it should print a Pandas DataFrame containing the predicted melt compositions in this crystallization example:

Before running crystallization or phase diagram calculations in MAGEMin you need to run ptt.activate_petthermotools_env() once in that notebook/script

[1]:
import petthermotools as ptt
ptt.activate_petthermotools_env()
alphaMELTS for Python files successfully located.
If using the Green et al. (2025) or Weller et al. (2024) thermodynamic models please run `ptt.activate_petthermotools_env()` prior to any calculations.
Julia environment detected.
Initializing MAGEMin environment and workers...
Detected IPython. Loading juliacall extension. See https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 3:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 4:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 2:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 12:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 7:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 5:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 8:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 6:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 14:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 16:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 15:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 11:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 9:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 13:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 10:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 17:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
Using libMAGEMin.dylib from MAGEMin_jll
Precompiling MAGEMinCalc...
   1003.8 ms  ? PythonCall
Info Given MAGEMinCalc was explicitly requested, output will be shown live
Using libMAGEMin.dylib from MAGEMin_jll
┌ Warning: Module PythonCall with build ID fafbfcfd-683b-dbb2-29a2-d5f541e6173e is missing from the cache.
│ This may mean PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2541
   1858.2 ms  ? MAGEMinCalc
[ Info: Precompiling MAGEMinCalc [dd69d18c-a947-4316-a873-d8ea006ff1b2] (cache misses: wrong dep version loaded (4), incompatible header (4))
┌ Warning: Module PythonCall with build ID fafbfcfd-683b-dbb2-29a2-d5f541e6173e is missing from the cache.
│ This may mean PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2541
┌ Info: Skipping precompilation due to precompilable error. Importing MAGEMinCalc [dd69d18c-a947-4316-a873-d8ea006ff1b2].
└   exception = Error when precompiling module, potentially caused by a __precompile__(false) declaration in the module.
Using libMAGEMin.dylib from MAGEMin_jll
      From worker 16:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 6:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 5:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 11:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 7:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 3:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 2:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 12:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 9:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 14:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 17:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 15:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 4:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 13:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 8:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 10:   Using libMAGEMin.dylib from MAGEMin_jll
Julia Environment and Workers Ready.
Julia Environment Ready. MAGEMinCalc v0.6.3 detected
[5]:
ptt.test_MAGEMinCalc()
  Activating project at `~/.petthermotools_julia_env`
        SiO2     Al2O3       CaO       MgO       FeO       K2O      Na2O  \
0   0.476224  0.164454  0.116304  0.094010  0.091846  0.003298  0.022564
1   0.476280  0.164680  0.116479  0.093540  0.091799  0.003298  0.022579
2   0.476446  0.164869  0.116612  0.093010  0.091743  0.003308  0.022617
3   0.476534  0.165086  0.116768  0.092498  0.091693  0.003307  0.022647
4   0.476649  0.165348  0.116894  0.091973  0.091650  0.003315  0.022687
5   0.476770  0.165558  0.117042  0.091455  0.091602  0.003326  0.022719
6   0.476892  0.165772  0.117184  0.090939  0.091588  0.003324  0.022746
7   0.476955  0.165988  0.117345  0.090424  0.091579  0.003329  0.022772
8   0.477084  0.166192  0.117499  0.089916  0.091507  0.003328  0.022801
9   0.477204  0.166436  0.117655  0.089407  0.091416  0.003336  0.022840
10  0.477308  0.166654  0.117785  0.088893  0.091395  0.003336  0.022875
11  0.477335  0.166937  0.117974  0.088394  0.091322  0.003337  0.022900
12  0.477487  0.167154  0.118087  0.087886  0.091276  0.003339  0.022947
13  0.477865  0.166221  0.117989  0.087286  0.091944  0.003376  0.023091
14  0.478239  0.165295  0.117878  0.086689  0.092633  0.003412  0.023225
15  0.478591  0.164414  0.117800  0.086092  0.093263  0.003455  0.023384
16  0.478983  0.163490  0.117728  0.085500  0.093895  0.003491  0.023524
17  0.479357  0.162594  0.117666  0.084921  0.094478  0.003526  0.023667
18  0.479709  0.161700  0.117623  0.084341  0.095072  0.003564  0.023808
19  0.480171  0.160795  0.117554  0.083764  0.095628  0.003610  0.023943
20  0.480527  0.159915  0.117498  0.083194  0.096196  0.003650  0.024069
21  0.480899  0.159051  0.117470  0.082627  0.096752  0.003686  0.024209
22  0.481322  0.158188  0.117395  0.082061  0.097293  0.003728  0.024336

        TiO2         O  Cr2O3       H2O
0   0.022964  0.001525    0.0  0.006813
1   0.022995  0.001528    0.0  0.006822
2   0.023038  0.001528    0.0  0.006829
3   0.023097  0.001531    0.0  0.006838
4   0.023103  0.001533    0.0  0.006847
5   0.023136  0.001535    0.0  0.006857
6   0.023153  0.001538    0.0  0.006864
7   0.023197  0.001541    0.0  0.006871
8   0.023255  0.001541    0.0  0.006878
9   0.023280  0.001543    0.0  0.006883
10  0.023318  0.001545    0.0  0.006890
11  0.023357  0.001546    0.0  0.006898
12  0.023368  0.001548    0.0  0.006909
13  0.023665  0.001568    0.0  0.006995
14  0.023960  0.001588    0.0  0.007081
15  0.024225  0.001607    0.0  0.007169
16  0.024512  0.001626    0.0  0.007251
17  0.024811  0.001644    0.0  0.007337
18  0.025102  0.001664    0.0  0.007416
19  0.025357  0.001682    0.0  0.007497
20  0.025674  0.001700    0.0  0.007577
21  0.025927  0.001719    0.0  0.007659
22  0.026199  0.001735    0.0  0.007742

Step 4 - Restart the kernel and test running calculations through PetThermoTools

Assuming the crystallization model above ran without any issues we can now progress to testing the integration of MAGEMin with PetThermoTools. First make sure you have the up to date version of PetThermoTools installed (v0.2.51 or later). Restart the kernel and then run the 3 cells below.

Remember, after restarting the kernel you have to run the command ptt.activate_petthermotools_env() again

[1]:
import petthermotools as ptt
ptt.__version__
alphaMELTS for Python files successfully located.
If using the Green et al. (2025) or Weller et al. (2024) thermodynamic models please run `ptt.activate_petthermotools_env()` prior to any calculations.
[1]:
'1.1.9'
[2]:
ptt.activate_petthermotools_env()
Julia environment detected.
Initializing MAGEMin environment and workers...
Detected IPython. Loading juliacall extension. See https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
  Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 2:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 8:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 3:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 4:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 5:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 11:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 9:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 10:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 13:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 17:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 15:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 16:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 6:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 7:      Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 14:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
      From worker 12:     Activating project at `C:\Users\Matt\.petthermotools_julia_env`
Precompiling MAGEMinCalc...
    982.3 ms  ? PythonCall
Info Given MAGEMinCalc was explicitly requested, output will be shown live
Using libMAGEMin.dylib from MAGEMin_jll
┌ Warning: Module PythonCall with build ID fafbfcfd-683b-dbb2-29a2-d5f541e6173e is missing from the cache.
│ This may mean PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2541
   1829.2 ms  ? MAGEMinCalc
[ Info: Precompiling MAGEMinCalc [dd69d18c-a947-4316-a873-d8ea006ff1b2] (cache misses: wrong dep version loaded (4), incompatible header (4))
┌ Warning: Module PythonCall with build ID fafbfcfd-683b-dbb2-29a2-d5f541e6173e is missing from the cache.
│ This may mean PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2541
┌ Info: Skipping precompilation due to precompilable error. Importing MAGEMinCalc [dd69d18c-a947-4316-a873-d8ea006ff1b2].
└   exception = Error when precompiling module, potentially caused by a __precompile__(false) declaration in the module.
Using libMAGEMin.dylib from MAGEMin_jll
Using libMAGEMin.dylib from MAGEMin_jll
      From worker 5:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 3:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 11:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 9:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 12:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 7:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 8:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 2:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 14:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 10:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 13:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 4:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 6:    Using libMAGEMin.dylib from MAGEMin_jll
      From worker 16:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 15:   Using libMAGEMin.dylib from MAGEMin_jll
      From worker 17:   Using libMAGEMin.dylib from MAGEMin_jll
Julia Environment and Workers Ready.
Julia Environment Ready. MAGEMinCalc v0.6.3 detected
[3]:
comp = {"SiO2_Liq": 47.5,
        "Al2O3_Liq": 16.4,
        "CaO_Liq": 11.6,
        "MgO_Liq": 9.38,
        "FeOt_Liq": 9.16,
        "K2O_Liq": 0.329,
        "Na2O_Liq": 2.25,
        "TiO2_Liq": 2.29,
        "Fe3Fet_Liq": 0.15,
        "Cr2O3_Liq": 0.0,
        "H2O_Liq": 0.68}

Results = ptt.isobaric_crystallisation(bulk=comp,
                             Model = "Green2025",
                             dt_C = 2.0,
                             T_end_C=1100.0,
                             P_bar=1000.0,
                             find_liquidus=True,
                             Frac_solid=True,
                             timeout=300)
[4]:
import matplotlib.pyplot as plt
plt.plot(Results["All"]["MgO_Liq"], Results["All"]["FeOt_Liq"], '-r')
plt.xlabel('MgO')
plt.ylabel('FeO$_t$')
[4]:
Text(0, 0.5, 'FeO$_t$')
../_images/Installation_MAGEMin_PythonCall_17_1.png

Step 5 - use PetThermoTools alongside MAGEMin in your research!