|
| 1 | +# Installation Guide |
| 2 | + |
| 3 | +Three install paths — pick what fits your use case. |
| 4 | + |
| 5 | +| Path | Time | What you get | When to choose | |
| 6 | +|---|---|---|---| |
| 7 | +| **Docker** | 1 min | Everything bundled, no build | Easiest. Trying it out, demos. | |
| 8 | +| **Full pip** | 10–20 min | All native HEP tools built locally | Most users; you'll get every feature. | |
| 9 | +| **Lightweight pip** | 3 min | QGRAF + FORM + LoopTools only | Teaching, CI without `gfortran`, fastest install. | |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Docker (easiest) |
| 14 | + |
| 15 | +```bash |
| 16 | +docker run -p 8000:8000 ecavan/feynman-api:latest |
| 17 | +# Open http://localhost:8000 |
| 18 | +``` |
| 19 | + |
| 20 | +The image bundles QGRAF, FORM, LoopTools, LHAPDF (with CT18LO), OpenLoops 2 (with the `ppllj` process library), and the LaTeX/SVG rendering stack. |
| 21 | + |
| 22 | +No system prerequisites needed beyond Docker itself. **Recommended on Windows** — saves you Windows-specific build issues with Fortran toolchains. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Full pip install (recommended for native users) |
| 27 | + |
| 28 | +### 1. System prerequisites |
| 29 | + |
| 30 | +You need a Fortran + C/C++ toolchain, plus optional LaTeX for SVG diagram rendering. |
| 31 | + |
| 32 | +#### macOS |
| 33 | + |
| 34 | +```bash |
| 35 | +# Build toolchain (required) |
| 36 | +brew install gcc make # gcc package gives you gfortran |
| 37 | + |
| 38 | +# LaTeX + SVG rendering (optional but recommended for diagrams) |
| 39 | +brew install basictex pdf2svg |
| 40 | +sudo tlmgr update --self |
| 41 | +sudo tlmgr install tikz-feynman standalone |
| 42 | +``` |
| 43 | + |
| 44 | +#### Debian / Ubuntu / WSL |
| 45 | + |
| 46 | +```bash |
| 47 | +sudo apt-get update |
| 48 | +sudo apt-get install -y gfortran g++ make python3-dev |
| 49 | + |
| 50 | +# LaTeX + SVG rendering (optional) |
| 51 | +sudo apt-get install -y texlive-luatex texlive-pictures texlive-science pdf2svg |
| 52 | +``` |
| 53 | + |
| 54 | +#### Windows (native) |
| 55 | + |
| 56 | +Native Windows is **not officially supported** for the local-build path because QGRAF + FORM + LoopTools + LHAPDF + OpenLoops are all Fortran/C/C++ projects with Unix-style build systems. Two options: |
| 57 | + |
| 58 | +- **Use Docker** (recommended): see the Docker section above. |
| 59 | +- **Use WSL2** (Windows Subsystem for Linux): install Ubuntu via WSL, then follow the Debian/Ubuntu section above. |
| 60 | + |
| 61 | +### 2. Install + build |
| 62 | + |
| 63 | +```bash |
| 64 | +pip install feynman-engine |
| 65 | +feynman setup # ~10–20 min, one-time. Builds QGRAF + FORM + LoopTools + LHAPDF + OpenLoops 2 |
| 66 | +feynman doctor # verify all 5 native deps are 'ok' |
| 67 | +feynman serve # http://localhost:8000 |
| 68 | +``` |
| 69 | + |
| 70 | +`feynman setup` will: |
| 71 | +1. Compile QGRAF (Fortran, ~30 s) |
| 72 | +2. Compile FORM (C, ~1 min) |
| 73 | +3. Compile LoopTools (Fortran + C, ~2 min) |
| 74 | +4. Compile LHAPDF (C++, ~3-5 min) and download the CT18LO PDF set (~10 MB) |
| 75 | +5. Compile OpenLoops 2 via SCons (Fortran, ~5-10 min) and download the `ppllj` process library |
| 76 | + |
| 77 | +If any step fails, the recommended `feynman doctor` output points you at the specific install command to retry. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Lightweight pip install |
| 82 | + |
| 83 | +Skip the slowest dependencies for a 3-minute install: |
| 84 | + |
| 85 | +```bash |
| 86 | +pip install feynman-engine |
| 87 | +feynman setup --skip-lhapdf --skip-openloops |
| 88 | +``` |
| 89 | + |
| 90 | +You still get: |
| 91 | +- All Feynman diagram generation (QGRAF + FORM) |
| 92 | +- All tree-level amplitudes for QED, QCD, EW, BSM |
| 93 | +- LO cross-sections via scipy/MC |
| 94 | +- Loop amplitudes via the LoopTools backend |
| 95 | +- Tabulated NLO K-factors for major LHC channels (DY, tt̄, ggH, WW, ZZ, ZH, VBF) |
| 96 | +- Universal QED NLO + EW Sudakov NLO closed-form K-factors |
| 97 | +- The browser UI |
| 98 | + |
| 99 | +What you lose: |
| 100 | +- **LHAPDF**: hadronic cross-sections fall back to a built-in LO PDF (factor-of-2-3 accuracy instead of percent-level) |
| 101 | +- **OpenLoops**: NLO σ for unregistered QCD processes returns `HTTP 422` with a workaround |
| 102 | + |
| 103 | +You can add these later: |
| 104 | +```bash |
| 105 | +feynman install-lhapdf |
| 106 | +feynman install-pdf-set CT18LO |
| 107 | +feynman install-openloops |
| 108 | +feynman install-process ppllj |
| 109 | +``` |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## Verifying the install |
| 114 | + |
| 115 | +```bash |
| 116 | +feynman doctor |
| 117 | +``` |
| 118 | + |
| 119 | +Should report each component as `ok` or `missing`. Example healthy output: |
| 120 | + |
| 121 | +``` |
| 122 | +FeynmanEngine doctor |
| 123 | + Backend: qgraf (/path/to/bin/qgraf) |
| 124 | + QGRAF: ok | binary=... |
| 125 | + FORM: ok | binary=... |
| 126 | + LoopTools: ok | library=... |
| 127 | + LHAPDF: ok | version=6.5.5 | sets=['CT18LO'] |
| 128 | + OpenLoops: ok | prefix=... | processes=['ppllj'] |
| 129 | + Rendering: lualatex=ok, pdf2svg=ok |
| 130 | + Toolchain: gfortran=..., make=..., cc=..., c++=... |
| 131 | + Recommendation: native dependencies look ready. |
| 132 | +``` |
| 133 | + |
| 134 | +If anything is `missing`, the `Recommendation:` line tells you the exact command to fix it. |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## Troubleshooting |
| 139 | + |
| 140 | +### `gfortran: command not found` |
| 141 | +- macOS: `brew install gcc` (the Homebrew `gcc` package includes `gfortran`) |
| 142 | +- Debian/Ubuntu: `sudo apt-get install gfortran` |
| 143 | + |
| 144 | +### `feynman setup` hangs on OpenLoops download |
| 145 | +The OpenLoops `ppllj` process library is downloaded from openloops.hepforge.org during setup. If it hangs: |
| 146 | +- Check internet access |
| 147 | +- Re-run with `feynman install-openloops --no-process` to skip the download |
| 148 | +- Manually install later: `feynman install-process ppllj` |
| 149 | + |
| 150 | +### `feynman doctor` reports `LoopTools: missing` but `gfortran` is installed |
| 151 | +LoopTools requires `gfortran` and a working `make`. On macOS the Apple `gcc` is actually clang (no Fortran). Install Homebrew's gcc package: `brew install gcc`. |
| 152 | + |
| 153 | +### `lualatex: command not found` (SVG rendering missing) |
| 154 | +SVG diagram rendering requires `lualatex` + `pdf2svg`. The engine still works without these — you just don't get rendered diagrams (the TikZ source is always returned). |
| 155 | + |
| 156 | +### Anything else |
| 157 | +File an issue at https://github.com/ecavan/FeynmanAPI/issues with the output of `feynman doctor` attached. |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## Upgrading |
| 162 | + |
| 163 | +```bash |
| 164 | +pip install --upgrade feynman-engine |
| 165 | +# Native binaries built by `feynman setup` are NOT recompiled on package upgrade. |
| 166 | +# If a major version bumps a bundled tool (QGRAF, FORM, LoopTools, LHAPDF, |
| 167 | +# OpenLoops), re-run: |
| 168 | +feynman setup --force |
| 169 | +``` |
0 commit comments