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
JaeMcBean
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]$ ./manage.py start
INFO     [Main][pyplanet.core.management.commands.start] Initiated configuration and environment...
INFO     [Main][pyplanet.core.management.commands.start] -------------------------------[  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/config.py", line 244, in import_app
    module = importlib.import_module(module_path)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/importlib/__init__.py", 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/app.py", 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/setting.py", 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/setting.py", 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/__init__.py", 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/list.py", line 4, in <module>
    import pandas as pd
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/__init__.py", line 55, in <module>
    from pandas.core.api import (
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/core/api.py", 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/__init__.py", 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/generic.py", 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/frame.py", 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/generic.py", line 70, in <module>
    from pandas.io.formats.format import DataFrameFormatter, format_percentiles
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/io/formats/format.py", line 48, in <module>
    from pandas.io.common import _expand_user, _stringify_path
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pandas/io/common.py", line 3, in <module>
    import bz2
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/bz2.py", 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/process.py", line 297, in _bootstrap
    self.run()
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/multiprocessing/process.py", 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/process.py", line 46, in _run
    instance = Controller.prepare(name).instance
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/core/controller.py", line 18, in prepare
    self.__instance = Instance(name)
  File "/home/pyplanet/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pyplanet/core/instance.py", 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/apps.py", 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/config.py", 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 pyplanet.apps.core.pyplanet.app.PyPlanetConfig. 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 - base.py:

Code: Select all

"""
This file contains the basic settings and overrides the default ones that are defined in the core.
Documentation: http://pypla.net/

If you want to use other configuration methods like YAML or JSON files, take a look at http://pypla.net/ 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):
        os.mkdir(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.
POOLS = [
        'default'
]

# Owners are logins of the server owners, the owners always get *ALL* the permissions in the system.
OWNERS = {
        'default': [
                'jaemcbean'
        ]
}

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

# Databases configuration holds an dictionary with information of the database backend.
# Please refer to the documentation for all examples. http://pypla.net/
DATABASES = {
        '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.
DEDICATED = {
        'default': {
                'HOST': '127.0.0.1',
                'PORT': '5000',
                'USER': 'SuperAdmin',
                'PASSWORD': 'xxx',
        }
}

# Map configuration is a set of configuration options related to match settings etc.
# Matchsettings filename.
MAP_MATCHSETTINGS = {
        '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.
BLACKLIST_FILE = {
        '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. http://pypla.net/
STORAGE = {
        'default': {
                'DRIVER': 'pyplanet.core.storage.drivers.local.LocalDriver',
                '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
# http://pypla.net/
# CACHE = {
#       'default': {
#
#       }
# }

# Songs is a list of URLs to .ogg files of songs to be played by the music server.
SONGS = {
        'default': []
}
apps.py:

Code: Select all

This file contains the apps & apps settings and overrides the default ones that are defined in the core.
Documentation: http://pypla.net/

If you want to use other configuration methods like YAML or JSON files, take a look at http://pypla.net/ 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:
# DOCUMENTATION: http://pypla.net/
APPS = {
        'default': [
                'pyplanet.apps.contrib.admin',
                'pyplanet.apps.contrib.jukebox',
                'pyplanet.apps.contrib.karma',
                'pyplanet.apps.contrib.local_records',
                'pyplanet.apps.contrib.dedimania',  # Will be disabled in Shootmania automatically.
                'pyplanet.apps.contrib.players',
                'pyplanet.apps.contrib.info',
                'pyplanet.apps.contrib.mx',
                'pyplanet.apps.contrib.transactions',
                'pyplanet.apps.contrib.sector_times',
                'pyplanet.apps.contrib.clock',

                # You can optionally enable one of the following apps. Please look at this page for more information:
                # http://pypla.net/#app-docs

                # 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.
                # 'pyplanet.apps.contrib.voting',

                # 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!
JMB

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

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

Post by toffe » Yesterday, 13:25

Hi,

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.

Toffe

Post Reply

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 1 guest