Pyplanet startup error: ModuleNotFoundError: No module named '_bz2'

Python 3 Server Controller for Trackmania and Shootmania for script-only modes.

Moderators: TheM, toffe, NADEO

Post Reply
User avatar
Posts: 1
Joined: 16 Sep 2011, 18:34
Location: Bonn

Pyplanet startup error: ModuleNotFoundError: No module named '_bz2'

Post by JaeMcBean » 12 Oct 2019, 20:06

Hey guys,

I just followed the tutorial to set up pyplanet as a server controller for my private tm2-server. Unfortunately, right after starting, pyplanet dies to this:

Code: Select all

[pyplanet@free-tm2 tm2]$ ./ start
INFO     [Main][] Initiated configuration and environment...
INFO     [Main][] -------------------------------[  PyPlanet v0.7.0  ]-------------------------------
INFO     [Main][pyplanet.god.process] Starting pool process for 'default'...
Process Process-1:
Traceback (most recent call last):
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/", line 244, in import_app
    module = importlib.import_module(module_path)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/core/pyplanet/", line 7, in <module>
    from pyplanet.apps.core.pyplanet.setting import SettingComponent
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/core/pyplanet/", line 4, in <module>
    from pyplanet.apps.core.pyplanet.views.setting import SettingMenuView
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/core/pyplanet/views/", line 8, in <module>
    from pyplanet.views.generics import ManualListView
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/views/generics/", line 2, in <module>
    from .list import ListView, ManualListView
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/views/generics/", line 4, in <module>
    import pandas as pd
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/", line 55, in <module>
    from pandas.core.api import (
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/", line 24, in <module>
    from pandas.core.groupby import Grouper, NamedAgg
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/groupby/", line 1, in <module>
    from pandas.core.groupby.generic import (  # noqa: F401
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/groupby/", line 44, in <module>
    from pandas.core.frame import DataFrame
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/", line 88, in <module>
    from pandas.core.generic import NDFrame, _shared_docs
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/", line 70, in <module>
    from import DataFrameFormatter, format_percentiles
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/io/formats/", line 48, in <module>
    from import _expand_user, _stringify_path
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/io/", line 3, in <module>
    import bz2
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/", line 19, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/multiprocessing/", line 297, in _bootstrap
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/multiprocessing/", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/god/", line 46, in _run
    instance = Controller.prepare(name).instance
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/core/", line 18, in prepare
    self.__instance = Instance(name)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/core/", line 90, in __init__
    self.apps.populate(settings.MANDATORY_APPS, in_order=True)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/", line 58, in populate
    app = AppConfig.import_app(entry, self.instance)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/apps/", line 257, in import_app
    'Can\'t load the app {}. Can\'t find the app config!'.format(entry)
pyplanet.core.exceptions.ImproperlyConfigured: Can't load the app Can't find the app config!
CRITICAL [Main][pyplanet.god.pool] The instance 'default' just died. We will not restart!
CRITICAL [Main][pyplanet.god.pool] All instances died. Quitting now...
Do i have to add the somehow missing bz2 module on my own or is there anything else I have missed? I followed the tutorial straight ahead, just skipped the virtual Environment Thing because I'll only launch one instance of pyplanet.

For the record, the system I am using:

OS: Oracle Linux 7.7 (like CentOS or RH)
Kernel: 4.14.35-1902.5.2.2.el7uek.x86_64 GNU/Linux

I disabled SELinux, but the error shows up again.

pyplanet config -

Code: Select all

This file contains the basic settings and overrides the default ones that are defined in the core.

If you want to use other configuration methods like YAML or JSON files, take a look at and head to the
configuration pages.
import os

# Set the root_path to the root of our project.
ROOT_PATH = os.path.dirname(os.path.dirname(__file__))

# Set the temporary location for the project.
TMP_PATH = os.path.join(ROOT_PATH, 'tmp')

# Create temporary folder if not exists.
if not os.path.exists(TMP_PATH):

# Enable debug mode to get verbose output, not report any errors and dynamically use the DEBUG in your code
# for extra verbosity of logging/output.
DEBUG = bool(os.environ.get('PYPLANET_DEBUG', False))

# Add your pools (the controller instances per dedicated here) or leave as it is to use a single instance only.

# Owners are logins of the server owners, the owners always get *ALL* the permissions in the system.
        'default': [

# Allow self-upgrading the installation. Disable on shared servers with one installation (hosting environment)!

# Databases configuration holds an dictionary with information of the database backend.
# Please refer to the documentation for all examples.
        'default': {
                'ENGINE': 'peewee_async.MySQLDatabase',
                'NAME': 'pyplanet',
                'OPTIONS': {
                        'host': 'xxx',
                        'user': 'pyplanet',
                        'password': 'xxx',
                        'charset': 'utf8mb4',

# Dedicated configuration holds the different dedicated servers that the instances will run on including the names of
# the instances.
        'default': {
                'HOST': '',
                'PORT': '5000',
                'USER': 'SuperAdmin',
                'PASSWORD': 'xxx',

# Map configuration is a set of configuration options related to match settings etc.
# Matchsettings filename.
        'default': 'autosave.txt',

# Blacklist file is managed by the dedicated server and will be loaded and writen to by PyPlanet once a
# player gets blacklisted. The default will be the filename Maniaplanet always uses and is generic.
        'default': 'blacklist.txt'

# The storage configuration contains the same instance mapping of the dedicated servers and is used
# to access the filesystem on the dedicated server location.
# Please refer to the documentation for more information.
        'default': {
                'DRIVER': '',
                'OPTIONS': {},

# Define any cache backends that can be used by the core and the plugins to cache data.
# This is not yet implemented. As soon as it's implemented you can activate it with the documentation, available on
# CACHE = {
#       'default': {
#       }
# }

# Songs is a list of URLs to .ogg files of songs to be played by the music server.
        'default': []

Code: Select all

This file contains the apps & apps settings and overrides the default ones that are defined in the core.

If you want to use other configuration methods like YAML or JSON files, take a look at and head to the
configuration pages.

# In the apps dictionary and array you configure the apps (or plugins) are loaded for specific pools (controllers).
# Be aware that the list will *ALWAYS* be prepended after the mandatory defaults are loaded in place.
# The mandatory defaults are specific per version, refer to the documentation:
APPS = {
        'default': [
                'pyplanet.apps.contrib.dedimania',  # Will be disabled in Shootmania automatically.

                # You can optionally enable one of the following apps. Please look at this page for more information:

                # Live Ranking App. Useful when playing in Laps, Rounds and all sort of Trackmania game modes.
                # 'pyplanet.apps.contrib.live_rankings',

                # Best CP Widget on top of the screen for the Trackmania game.
                # 'pyplanet.apps.contrib.best_cps',

                # Use chat-based votes instead of the callvotes of the dedicated server with the voting app.
                # '',

                # Dynamic Points Limit is meant for Shootmania Royal.
                # 'pyplanet.apps.contrib.dynamic_points',

                # Waiting Queue. Enable on limited player servers to fairly queue players.
                # 'pyplanet.apps.contrib.queue',

                # Music Server App. Enable to queue your music together on the server.
                # 'pyplanet.apps.contrib.music_server',
Any help would be appreciated - thanks in advance!

User avatar
Posts: 698
Joined: 15 Jun 2013, 10:57
Location: The Netherlands

Re: Pyplanet startup error: ModuleNotFoundError: No module named '_bz2'

Post by toffe » Yesterday, 13:25


Due to changes in a used library (pandas) it now requires Python to be build with bz2 support. If you have used PyEnv without installing bz2 libraries of your operating system it's not installed with bz2 support.

If you are running Ubuntu/Debian this would require the libbz2-dev package. As I can see you run RHEL, for this Linux distribution you need to install the following packages with yum:
- bzip2
- bzip2-devel

After doing this, you have to reinstall the python version with pyenv and reinstall PyPlanet inside the new environment. This will solve the problem you currently have. If you get stuck, please tell me so I can help you.


Post Reply

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 1 guest