Switching Python versions
Last updated
Last updated
At some point, you may want to switch your Python version to a newer (or, in some cases, older) version. This may be because the current Python version is no longer supported, does not support certain dependencies on your system, etc.
On Unifier, you can easily change your Python version or environment.
You will first need to shut the bot down if it is already running. To do this, you can run u!shutdown
. This will save the data to disk and then stop the bot and the bootloader.
If Unifier is unresponsive, you can use Ctrl+C on the console to interrupt the process. Please note that this may result in data loss and should only be used as a last resort.
Unifier's bootloader lets you set custom Python binary paths, if the default Python binary doesn't suit your needs. To learn how to configure the bootloader, please read .
When using Unifier, we highly recommend you use it with a virtual environment. This allows you to separate Unifier's dependencies from globally installed libraries, so that installing Unifier won't break other programs and vice versa. Besides, if you somehow accidentally managed to break things in the virtual environment, you can simply delete the virtual environment and make a new one.
For example, to create a Python 3.12 virtual environment in Python in a .venv folder, you can run python3.12 -m venv .venv
. Once you've done this, set the binary to ./.venv/bin/python
to use the Python binary in the virtual environment.
Although we highly recommend using virtual environments with Unifier, you can still use the global environment. Please note that this has the potential to break your global environment packages, so this should only be used when virtual environments cannot be used for whatever reason. If you break your global packages, we will not be able to help you.
For example, to use Python 3.12's global environment, you can simply set the binary to the command you use to run Python 3.12 (python3.12
). Or, you can provide the binary file path (usually /usr/bin/python3.12
).
Since you're using a different environment which doesn't have the packages Unifier needs to run, you will need to reinstall them. Run the bootscript while passing the --install-deps
option to run the dependency installer.
On Linux/macOS, run sh run.sh --install-deps
.
On Windows, run ./run.bat --install-deps
.
If everything goes well, the dependency installer will say that dependencies have installed.
You can now restart Unifier! Run /about
to verify that your Python version was properly changed.