Installation#

PySME can be installed through PyPI (recommended; stable release) or from github (the latest version in develop branch) directly.

Supported environments:

  • Platforms: Linux, macOS (arm platform)

    • The x86/Intel platform macOS is not supported anymore, but you can still install v0.6.23, the last supported PySME version, or download SMElib and compile it manually.

  • Windows: supported via WSL2 (install/run PySME inside the Linux subsystem)

  • Python versions:

    • 3.9–3.13.

Set up virtual environment#

This step is optional but recommended.

conda#

conda create -n pysme python=3.12
conda activate pysme

venv (alternative)#

python -m venv .venv
source .venv/bin/activate

Install PySME#

From Github#

Clone the repository#

git clone https://github.com/MingjieJian/SME.git
cd SME

Install PySME from source#

pip install -U pip
pip install .

Verify installation#

python -c "import pysme; print('PySME version:', pysme.__version__)"

You should see an output of PySME version: [version].

Uninstall#

You can uninstall PySME by:

pip uninstall pysme-astro

Warning

Note that several files (data file, SMElib file etc) will remain after the uninstall. They are all list in the output of the pip command, and it is recommended to remove them manually.

The content below to be removed.

Running SME#

  • An simple minimum example is provided in the examples directory. Make sure to also download the provided input structure.

  • You can then run it with: python minimum.py

Warning

PySME requires a pre-compiled C++/Fortran SME library. Wheels are currently provided for Linux and macOS.
For Windows, we recommend using WSL2 (install PySME inside the Linux environment).

  • PySME requires the pre-compled C++/Fortran SME library to run. Currently we deliver SME library with Linux and Mac version; for Windows users, we recommend to use WSL and hence the Linux version.