# Install Python on BornAgain

file:///usr/share/doc/bornagain/html/deploy/py/index.html Recent content in Install Python on BornAgain Hugo en-us

# Python on Linux

file:///usr/share/doc/bornagain/html/deploy/py/linux.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/py/linux.html <h2 id="install-python-on-linux">Install Python on Linux</h2> <p>Any Linux distribution (Debian/Ubuntu, Fedora, etc) provides packages for Python and for many Python modules. This approach, however, runs into difficulties if one needs Python modules that are <em>not</em> available in the distribution. Installing them using the Python package manager Pip can cause inconsistencies and break the system. Therefore, distributions at some point (e.g. Debian 12) disabled Pip, which terminates with <code>error: externally-managed-environment</code>. While this behavior can be overridden by a special flag, we advise against. Rather, we recommend escaping from Python version hell by using the Python version manager <a href="https://github.com/pyenv/pyenv">pyenv</a>.</p>

# Python on Windows

file:///usr/share/doc/bornagain/html/deploy/py/win.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/py/win.html <h2 id="install-python-on-windows">Install Python on Windows</h2> <p>Run the installer and follow the steps.</p> <p>To use BornAgain GUI application, the installation directory should be added to the system <code>PATH</code>:</p> <figure class="center"> <a href="file:///usr/share/doc/bornagain/html/img/win_add_to_PATH.png"> <img src="file:///usr/share/doc/bornagain/html/img/win_add_to_PATH.png" width="450px"> </a> <figcaption> <p></p> </figcaption> </figure> <p>Ensure that <code>pip</code> package manager is checked for installation. Command</p> <pre tabindex="0"><code>$ python -m ensurepip </code></pre><p>will install <code>pip</code> if it is missing.</p> <h4 id="bornagain-with-anaconda">BornAgain with Anaconda</h4> <p>BornAgain can also work the Python from the Anaconda platform. Note that the path to directory which includes the Python platform should be added to the system <code>PATH</code>.</p>

# Python on Mac

file:///usr/share/doc/bornagain/html/deploy/py/mac.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/py/mac.html <h2 id="install-python-on-mac">Install Python on Mac</h2> <p>The pre-installed system Python on MacOS may be outdated, and may be in conflict with external module requirements. Therefore we strongly recommend to install Python and the Python module manager <code>pip</code> from scratch.</p> <p>The preferred installation method for Python is using <a href="https://brew.sh/">Homebrew</a>. For instance, to install Python 3.11, use</p> <pre tabindex="0"><code>brew install python@3.11 </code></pre>

# Python modules

file:///usr/share/doc/bornagain/html/deploy/py/modules.html Mon, 01 Jan 0001 00:00:00 +0000 file:///usr/share/doc/bornagain/html/deploy/py/modules.html <h2 id="python-modules-required-by-bornagain">Python modules required by BornAgain</h2> <p>The BornAgain GUI (unless specially built without Python support) requires the Python module</p> <ul> <li>numpy</li> </ul> <p>All BornAgain Python scripting examples require</p> <ul> <li>matplotlib</li> </ul> <p>Furthermore, a small number of fit script examples require the Python modules</p> <ul> <li>corner</li> <li>emcee</li> <li>fabio</li> <li>lmfit</li> <li>scipy</li> <li>tqdm</li> </ul> <p>These are not required for <em>installing</em> and <em>running</em> most of BornAgain. However, they should be present when <em>building</em> BornAgain lest some tests will fail.</p>