RLBot / RLBotScratchInterface

A layer on top of the RLBot framework that allows the Scratch programming language to control it.
MIT License
11 stars 13 forks source link

Won't launch browser even when specified #10

Open Jah-On opened 4 years ago

Jah-On commented 4 years ago

While on linux mint, the browser doesn't open when the match is started.

tarehart commented 4 years ago

Thanks for reporting! We've never tested that functionality before, the only Linux support we vouch for is python, described at https://github.com/RLBot/RLBot/wiki/Operating-System-Support, and rust unofficially. I'll consider this a feature request 👍

Jah-On commented 4 years ago

Hey Tarehart, I don't mind attempting to get it to run on Linux, but I would need to know where the command(s) are in the code. I went through the code but couldn't see anything regarding a web request command. (BTW) Good job with this project! Almost everything works to the point of playing against AIs on Linux! There are some kinks in the main RLBot program, but it's pretty good considering I'm not using WINE.

tarehart commented 4 years ago

Thanks! Linux support was set up by @kipje13, he did a great job :)

This is the code you're probably thinking of: https://github.com/RLBot/RLBot/blob/master/src/main/python/rlbot/botmanager/scratch_manager.py#L118

There could easily be some stuff in there that's not properly cross-platform. You'll also see that Chrome is a requirement when using the spawn_browser setting.

Jah-On commented 4 years ago

OK, great news! After doing some testing, I discovered that the requirements.txt file doesn't actually do any required installs, which means that Python had missing dependencies. I made this .sh script to fill in all dependencies, including ones for the scratch-gui server.

sudo su apt-get install gcc apt-get install python-dev3.6 pip3 install psutil pip3 install inputs pip3 install PyQt5 pip3 install PyQt5-sip pip3 install py4j pip3 install websockets pip3 install dataclasses pip3 install colorama pip3 install crayons pip3 install configparser pip3 install webdriver-manager pip3 install rlbot pip3 install selenium pip3 install websockets pip3 install eel echo "Done!"

Then to keep my fellows penguins happy, I made this .sh script. python3 run.py and this one. python3 run.py gui

There is another bug that I'll make a separate report for.

kipje13 commented 4 years ago

python3 run.py should be all that is needed to install the dependencies, I am glad you got it working but I do not consider this as fixed yet.

Jah-On commented 4 years ago

OK, I added some things to the run.py file that will automatically run install/updates. It should be universal, since it uses pip, but the Windows way will still be there should it not work.

Hope that works for everyone! `import sys import os

cmd = "pip3 install websockets" returned_value = os.system(cmd) cmd = "pip3 install selenium" returned_value = os.system(cmd) cmd = "pip3 install webdriver_manager" returned_value = os.system(cmd) cmd = "pip3 install pip" returned_value = os.system(cmd) cmd = "pip3 install rlbot" returned_value = os.system(cmd)

https://stackoverflow.com/a/51704613

try: from pip import main as pipmain except ImportError: from pip._internal import main as pipmain

More pip changes breaking us.

main_fn = pipmain if hasattr(pipmain, 'main'): main_fn = pipmain.main

DEFAULT_LOGGER = 'rlbot'

if name == 'main':

try:
    from rlbot.utils import public_utils, logging_utils

    logger = logging_utils.get_logger(DEFAULT_LOGGER)
    if not public_utils.have_internet():
        logger.log(logging_utils.logging_level,
                   'Skipping upgrade check for now since it looks like you have no internet')
    elif public_utils.is_safe_to_upgrade():
        main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

        # https://stackoverflow.com/a/44401013
        rlbots = [module for module in sys.modules if module.startswith('rlbot')]
        for rlbot_module in rlbots:
            sys.modules.pop(rlbot_module)

except ImportError:
    main_fn(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

try:
    if len(sys.argv) > 1 and sys.argv[1] == 'gui':
        from rlbot.gui.qt_root import RLBotQTGui

        RLBotQTGui.main()
    else:
        from rlbot import runner

        runner.main()
except Exception as e:
    print("Encountered exception: ", e)
    print("Press enter to close.")
    input()`
Jah-On commented 4 years ago

LOL, I can't make it look right.

kipje13 commented 4 years ago

I am not able to reproduce this, python3 run.py installs the dependencies for me.

@tarehart we might want to change our approach of how we call pip from python because our current method is not officially supported. See https://stackoverflow.com/a/50255019

Jah-On commented 4 years ago

@kipje13 On Linux Mint? Hmm. Well, I think putting pip in the py file will make it more universal anyways.