{ "cells": [ { "cell_type": "markdown", "id": "3a699cf8-9ed7-4d37-8b37-709a1b56267b", "metadata": {}, "source": [ " **[pyTEMlib](0_pyTEMlib.ipynb)** \n", "\n", "
\n", "\n", "[](https://raw.githubusercontent.com/pycroscopy/pyTEMlib/main/notebooks/Introduction/1_Installation.ipynb)\n", "\n", "[![OpenInColab](https://colab.research.google.com/assets/colab-badge.svg)](\n", " https://colab.research.google.com/github/pycroscopy/pyTEMlib/blob/main/notebooks/Introduction/1_Installation.ipynb)\n", "\n", "\n", " **[pyTEMlib](0_pyTEMlib.ipynb)**, a **pycroscopy** library \n", "\n", "# Installation\n", " **[pyTEMlib](https://pycroscopy.github.io/pyTEMlib/about.html)**\n", "\n", "a [pycroscopy](https://pycroscopy.github.io/pycroscopy/about.html) ecosystem package\n", "\n", "\n", "Notebook by Gerd Duscher, 2025\n", "\n", "Microscopy Facilities
\n", "Institute of Advanced Materials & Manufacturing
\n", "The University of Tennessee, Knoxville\n", "\n", "Model based analysis and quantification of data acquired with transmission electron microscopes\n" ] }, { "cell_type": "markdown", "id": "36c1d7a8-f964-41a5-9bdb-84e3373b53e2", "metadata": {}, "source": [ "## Prerequesites\n", "A usual installation of python or python envirnment (like anaconda - recomended) is sufficient.\n", "\n", "## Installation\n", "\n", "The installation of pyTEMlib with all its dependencies can be done with the code cell below, right here in this jupyter notebook\n", "\n", "In google colab, with always a clean, new python installation, you will have to run this every (run)time.\n", "> So this code cell is added to every notebook.\n", "\n", "At your own installation, you need to run this codecell only once.\n", "\n", "> Note:\n", "> \n", "> To update pyTEMLib you need to run this code cell first\n", "> \n", "> Otherwise pyTEMlib is already loaded and you need to restaart the notebook for the new version to take effect" ] }, { "cell_type": "code", "execution_count": null, "id": "c86afc12-0c14-4c01-8532-c0452fafb573", "metadata": {}, "outputs": [], "source": [ "import sys\n", "import importlib.metadata\n", "def test_package(package_name):\n", " \"\"\"Test if package exists and returns version or -1\"\"\"\n", " try:\n", " version = importlib.metadata.version(package_name)\n", " except importlib.metadata.PackageNotFoundError:\n", " version = '-1'\n", " return version\n", "\n", "if test_package('pyTEMlib') < '0.2025.12.1':\n", " print('installing pyTEMlib')\n", " !{sys.executable} -m pip install --upgrade pyTEMlib -q\n", "\n", "print('done')" ] }, { "cell_type": "markdown", "id": "3a58c0a1-d06d-46d0-815c-731e5a84ffa6", "metadata": {}, "source": [ "## Testing Installation\n", "Once you have installed pyTEMlib, you will need to import it in every notebook or python instance.\n", "\n", "To check installation and version, use the minimal comands below.\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "0925e1a5-7be1-4283-aafd-294130387485", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "pyTEMlib version 0.2025.12.0\n" ] } ], "source": [ "import pyTEMlib\n", "print('pyTEMlib version', pyTEMlib.__version__)" ] }, { "cell_type": "markdown", "id": "f9fe9438-3c43-467c-b50e-203098bb4ac1", "metadata": {}, "source": [ "## Summary\n", "\n", "You will find the code above in each of the notebooks of this documentation of pyTEMlib to run at google colab.\n", "\n", "These code cells are the minimal requirements for the installation.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.5" } }, "nbformat": 4, "nbformat_minor": 5 }