BabakAkbari / Slither.io-AI

Reinforcement learning environment based on openAI gym
MIT License
15 stars 2 forks source link

when remote.py is ran it just shows this #2

Open godpow opened 2 years ago

godpow commented 2 years ago

image

BabakAkbari commented 2 years ago

Hello @godpow Try running test1.py or TrainPPO.py after running remote.py and see if it works.

godpow commented 2 years ago

@BabakAkbari this is what happens when I try running it I have to install the pip modules manually for some reason repeatedly apps@4109d8750504:~$ python3 TrainPPO.py WARNING: CPU random generator seem to be failing, disabling hardware random number generation WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff Traceback (most recent call last): File "TrainPPO.py", line 11, in from baselines.common.cmd_util import atari_arg_parser File "/home/apps/.local/lib/python3.8/site-packages/baselines/common/cmd_util.py", line 7, in from gym.wrappers import FlattenDictWrapper ImportError: cannot import name 'FlattenDictWrapper' from 'gym.wrappers' (/home/apps/.local/lib/python3.8/site-packages/gym/wrappers/init.py)

godpow commented 2 years ago

I had to edit the docker file to get this far since the download was dead and other stuff FROM ubuntu

RUN apt-get update && apt-get clean && apt-get install -y \ x11vnc \ xvfb \ fluxbox \ wmctrl \ wget \ gnupg \ gnupg2 \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ && apt-get update && apt-get -y install google-chrome-stable

RUN apt-get update && apt-get install -y \ python3 \ python3-setuptools \ python3-pip\ unzip \ curl

RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

RUN pip3 install selenium

RUN cd /home RUN wget https://store2.gofile.io/download/28350cc4-13cf-40c2-90c9-9c5e3e90afc8/tigervnc-1.10.1.x86_64.tar.gz RUN ls -all RUN tar xzf tigervnc-1.10.1.x86_64.tar.gz RUN cd /tigervnc-1.10.1.x86_64 && chown -R root:root usr && ls && mv usr local && tar czf local.tgz local && tar xzf local.tgz -C /usr/ && update-icon-caches /usr/local/share/icons/*

RUN useradd apps \ && mkdir -p /home/apps \ && chown -v -R apps:apps /home/apps RUN chmod 777 /home/apps

RUN export DISPLAY=:0

COPY bootstrap.sh /

RUN chmod 777 /bootstrap.sh

COPY . /home/apps RUN chmod 777 /home/apps

CMD '/bootstrap.sh'

RUN apt-get install libopenmpi-dev -y RUN apt-get update && apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev -y RUN apt-get install golang -y RUN pip install mpi4py RUN pip install gym RUN pip install mujoco-py RUN pip install opencv-python

godpow commented 2 years ago

Would it be possible for you to export a working copy of the image of the ai? @BabakAkbari

BabakAkbari commented 2 years ago

@godpow Sure, I can share the built image. I have tested my image and there isn't any problem. It seems there is no problem with yours as well. You just need to do as follows after running remote.py in your docker container:

I should definitely update the readme it is so confusing. Let me know if there is any problem.

godpow commented 2 years ago

When I try to install go-vncdriver more errors apps@f3db13689e89:~$ dir Dockerfile README.md TrainPPO.py google615d65718871c1f2.html remote.py LICENSE RemoteEnv.py pycache gym_slitherio slither.io apps@f3db13689e89:~$ cd gym_slitherio/ apps@f3db13689e89:~/gym_slitherio$ cd envs/ apps@f3db13689e89:~/gym_slitherio/envs$ dir init.py init.pyc pycache slitherio_env.py slitherio_env.pyc slitherio_extrahard_env.py test1.py apps@f3db13689e89:~/gym_slitherio/envs$ python3 test1.py Traceback (most recent call last): File "test1.py", line 1, in from slitherio_env import SlitherioEnv File "/home/apps/gym_slitherio/envs/slitherio_env.py", line 3, in import go_vncdriver ModuleNotFoundError: No module named 'go_vncdriver' apps@f3db13689e89:~/gym_slitherio/envs$ pip install go-vncdriver Collecting go-vncdriver Downloading go_vncdriver-0.4.19.tar.gz (638 kB) |████████████████████████████████| 638 kB 1.6 MB/s Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from go-vncdriver) (1.21.4) Building wheels for collected packages: go-vncdriver Building wheel for go-vncdriver (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"'; file='"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9r0ymr26 cwd: /tmp/pip-install-p2d78mvk/go-vncdriver/ Complete output (40 lines): running bdist_wheel running build Running new build Could not build go_vncdriver: Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX Traceback (most recent call last): File "/tmp/pip-install-p2d78mvk/go-vncdriver/build.py", line 54, in build output = subprocess.check_output(['ld', '-ljpeg', '--trace-symbol', 'jpeg_CreateDecompress', '-e', '0'], stderr=subprocess.STDOUT) File "/usr/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ld', '-ljpeg', '--trace-symbol', 'jpeg_CreateDecompress', '-e', '0']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 67, in setup(name='go_vncdriver', File "/usr/lib/python3/dist-packages/setuptools/init.py", line 144, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 223, in run self.run_command('build') File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 23, in run self.build() File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 61, in build build.build() File "/tmp/pip-install-p2d78mvk/go-vncdriver/build.py", line 57, in build raise BuildException("Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX") build.BuildException: Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX

ERROR: Failed building wheel for go-vncdriver Running setup.py clean for go-vncdriver Failed to build go-vncdriver Installing collected packages: go-vncdriver Running setup.py install for go-vncdriver ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"'; file='"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-fzpw66ro/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/apps/.local/include/python3.8/go-vncdriver cwd: /tmp/pip-install-p2d78mvk/go-vncdriver/ Complete output (42 lines): running install running build Running new build Could not build go_vncdriver: Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX Traceback (most recent call last): File "/tmp/pip-install-p2d78mvk/go-vncdriver/build.py", line 54, in build output = subprocess.check_output(['ld', '-ljpeg', '--trace-symbol', 'jpeg_CreateDecompress', '-e', '0'], stderr=subprocess.STDOUT) File "/usr/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ld', '-ljpeg', '--trace-symbol', 'jpeg_CreateDecompress', '-e', '0']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 67, in <module>
    setup(name='go_vncdriver',
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/lib/python3.8/distutils/command/install.py", line 589, in run
    self.run_command('build')
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 23, in run
    self.build()
  File "/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py", line 61, in build
    build.build()
  File "/tmp/pip-install-p2d78mvk/go-vncdriver/build.py", line 57, in build
    raise BuildException("Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX")
build.BuildException: Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX
----------------------------------------

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"'; file='"'"'/tmp/pip-install-p2d78mvk/go-vncdriver/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-fzpw66ro/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/apps/.local/include/python3.8/go-vncdriver Check the logs for full command output.

godpow commented 2 years ago

nvm ignore the error above I was blind

godpow commented 2 years ago

It worked for a second! but then this happened apps@9a226a481524:~/gym_slitherio/envs$ python3 test1.py WARNING: CPU random generator seem to be failing, disabling hardware random number generation WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff 2021/11/12 13:57:34 I1112 13:57:34.787526 2328 gymvnc.go:417] [conn1:localhost:5900] opening connection to VNC server reset Traceback (most recent call last): File "test1.py", line 3, in obs = env.reset() File "/home/apps/gym_slitherio/envs/slitherio_env.py", line 106, in reset observation = np.fromstring(observations['conn1'], dtype=np.uint8, sep='') TypeError: a bytes-like object is required, not 'NoneType' apps@9a226a481524:~/gym_slitherio/envs$

BabakAkbari commented 2 years ago

@godpow First of all, why are you trying to run test1.py on a docker container? The only thing you need to run on the container is remote.py. After running remote.py on your container, try to run test1.py on your local machine.

godpow commented 2 years ago

It popped up entered the name and clicked play moved for a second then broke.

BabakAkbari commented 2 years ago

@godpow Not sure why you get that. Also, you may want to do a pull request if you think it needs improvements. I guess you got a feel for how it works by now.