Note that running a Python script is inherently a pretty technical process. If you are unable or unwilling to learn the rudiments of using tools like python and git, you should probably strongly consider running PMM in [Docker](docker). That will eliminate the Python and git installs from this process and make it as simple as it can be.
If the idea of editing YAML files by hand is daunting, this may not be the tool for you. All the configuration of PMM is done via YAML text files, so if you are unable or unwilling to learn how those work, you should stop here.
Finally, this walkthrough is intended to give you a basic grounding in how to get the script running. It doesn't cover how to create your own collections, or how to add overlays, or any of the myriad other things PMM is capable of. It provides a simple "Getting Started" guide for those for whom the standard install instructions make no sense; presumably because you've never run a Python script before.
That’s a command you’re going to type or paste into your terminal (OSX or Linux) or Powershell (Windows). In some cases it's displaying *output* from a command you've typed, but the difference should be apparent in context.
IMPORTANT NOTE:
This walkthrough is going to be pretty pedantic. I’m assuming you’re reading it because you have no idea how to get a Python script going, so I’m proceeding from the assumption that you want to be walked through every little detail. You’re going to deliberately cause errors and then fix them as you go through it. This is to help you understand what exactly is going on behind the scenes so that when you see these sorts of problems in the wild you will have some background to understand what’s happening. If I only give you the happy path, then when you make a typo later on you’ll have no idea where that typo might be or why it’s breaking things.
I am assuming you do not have any of these tools already installed. When writing this up I started with a brand new Windows 10 install.
This walkthrough involves typing commands into a command window. On Mac OS X or Linux, you can use your standard terminal window, whether that's the builtin Terminal app or something like iTerm. On Windows, you should use PowerShell. There are other options for command windows in Windows, but if you want this to work as written, which I assume is the case since you've read this far, you should use Powershell.
This walkthrough is assuming you are doing the entire process on the same platform; i.e. you're installing PMM and editing its config files on a single Linux, Windows, or OS X machine. It doesn't account for situations like running PMM on a Linux machine while editing the config files on your Windows box.
If you are running this on a desktop Linux machine, start up the Terminal application. That window will be the terminal you will type commands into throughout this walkthrough, so leave it open.
Open the Terminal app; this window will be the place you type commands throughout this walkthrough, so leave it open. The Terminal app is in Applications -> Utilities.
In order to run a Python script. the first thing you'll need is a Python interpreter. This is typically already present on Linux and Mac, but will probably have to be installed on Windows.
Describing a python install for any arbitrary linux is out of scope here, but if you're using Ubuntu, [this](https://techviewleo.com/how-to-install-python-on-ubuntu-linux/) might be useful.
Before installing Python, try again without the `3`:
```
python --version
```
Depending on the version of Python, you may need to use one or the other. If this works, you're ready to go, jsut substitute `python` for `python3` in the couple places it appears below.
Go to http://www.python.org/download and download the next-to-latest minor version of Python for Windows in 32 or 64-bit as appropriate for your system [probably 64-bit]. As this is written, that's 3.10, while the latest is 3.11.
#### Why the next-to-latest?
There is one dependency [`lxml`] that lags behind new Python releases; this will cause a failure when installing requirements in a moment if the newest Python version is too new [at time of writing the current is 3.11, and the requirements install fails on the lxml library]. You can avoid this by using the next-to-latest release. At some point this will no longer be a problem, but that is outside the control of PMM.
For Windows 10, you will need to enable scripts in PowerShell. Follow the instructions [here](https://windowsloop.com/enable-powershell-scripts-execution-windows-10) to do so. If you skip this step you're going to hit a hard stop in a moment.
Run the install; you can probably just accept the defaults and click through except for the step that asks you to choose an editor; you probably want to choose something other than the default there:
This install comes with its own command line interface. **Do not use this interface in this walkthrough**. Continue to do everything here in Powershell.
When you open a command window to run PMM, the first step will always be:
```
cd ~
cd Plex-Meta-Manager
```
There are parts of the code that are assuming and expecting that you will be in this directory when you run PMM [the fonts used in overlays are one example]. Be sure that you are always in this directory when you run PMM.
This changes to your home directory, which will be something like `/home/yourname` or `/Users/yourname` or `C:\Users\YourName` depending on the platform.
Later on you can move it elsewhere if you want, but for now put it there. This will ensure that everything to follow works just like it says here. Presumably you’re reading this because the other docs are unclear to you. Don’t make unilateral changes to my assumptions while doing this.
<details>
<summary>Why use git instead of downloading the release ZIP?</summary>
Retrieving the code with `git` makes updating simpler. When you want to update to the newest version, you can go into this directory and type:
```
git pull
```
No need to download a new ZIP, uncompress it, etc.
This walkthrough is going to use a "virtual environment", since that provides a simple way to keep the requirements for a given thing self-contained; think of it as a "sandbox" for this script. It also provides a clean way to recover from mistakes, and keeps the host system clean.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
```
You apparently didn't check the “Add to path” checkbox above under [installing Python](#installing-python). "Repair" your Python install and check "add python to environment variables".
This tells Python3 to use the `venv` module to create a virtual environment called `pmm-venv`. The only visible effect will be the creation of a `pmm-venv` directory.
</details>
That command will not produce any output if it works; it will display an error if a problem occurs. If everything is fine, you will be looking at something like this:
```
> python -m venv pmm-venv
>
```
If you aren't looking at an error, you're ready to move on.
.\pmm-venv\Scripts\activate : File C:\Users\mroche\Plex-Meta-Manager\pmm-venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink LinkID=135170.
You will need to take care of that before moving on. Follow the instructions [here](https://windowsloop.com/enable-powershell-scripts-execution-windows-10).
Note that the prompt now shows the name of the virtual environment. You may not see this; it's dependent on *your* terminal configuration, not anything to do with Python or PMM.
<details>
<summary>What did that do?</summary>
This tells Python to make the virtual environment "active", which means to use the copy of python that is available there, install all support libraries there, etc. This keeps the PMM code and its runtime environment totally separate from your host machine's environment.
An advantage of doing this in a virtual environment is that in the event something goes wrong with this part of the setup, you can delete that pmm-venv directory and do the setup again.
**IMPORTANT: In the future, when you want to run the script, you will need to do this "activation" step every time. Not the venv creation, just the activation**:
Plex-Meta-Manager, like every other Python script, depends on support libraries that manage things like connections to Plex, or getting things from the internet, or writing files and so on.
These support libraries are called “requirements”, and they are defined in that file called `requirements.txt`. To install them, type the following command [type this into your terminal]:
<summary>`Encountered error while trying to install package.`</summary>
<br/>
If you see an error that ends in something like this:
```
...
building 'lxml.etree' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lxml
```
You've hit the error we were referring to above with the Python version being too recent. Probably you are running Python 3.11 in late 2022 or Python 3.12 shortly after its release. Deactivate and delete the virtual environment and create one based on the previous Python release [which may involve removing Python and reinstalling the older version depending on platform], then try this step again.
The default config file contains a reference to a directory that will show an error in the output later. That error can safely be ignored, but it causes some confusion with new users from time to time.