New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerized runs of poke-env fail to access port 8000 during imports #151
Comments
Hey @nacharya114, Thanks for opening this issue. This sounds like an exciting project! I think I need more information to help you out efficiently, in particular regarding the way you are using docker compose. $ docker pull nacharya114/pokemonshowdown
$ docker run -p 8000:8000 nacharya114/pokemonshowdown
RESTORE CHATROOM: lobby
RESTORE CHATROOM: staff
Worker 1 now listening on 0.0.0.0:8000
Test your server at http://localhost:8000 And, in my $ PYTHONPATH=src python examples/cross_evaluate_random_players.py
-------------- -------------- ---------------
RandomPlayer 1 RandomPlayer 2
RandomPlayer 1 1.0
RandomPlayer 2 0.0
-------------- -------------- -------------- Are you sure that port 8000 is being forwarded as intended? |
I've been able to run poke-env using a Docker compose file: version: "3.9"
services:
notebook:
image: jupyter/datascience-notebook
user: root
environment:
- GRANT_SUDO=yes
volumes:
- <path>
ports:
- "8888:8888"
ps:
image: nacharya114/pokemonshowdown
ports:
- "8000:8000"
from poke_env.player.random_player import RandomPlayer
from poke_env.player.utils import cross_evaluate
from tabulate import tabulate
from poke_env.server_configuration import ServerConfiguration
server_config = ServerConfiguration(
"ps:8000",
"authentication-endpoint.com/action.php?"
)
async def main():
# We create three random players
players = [RandomPlayer(max_concurrent_battles=10, server_configuration=server_config) for _ in range(3)]
# Now, we can cross evaluate them: every player will player 20 games against every
# other player.
cross_evaluation = await cross_evaluate(players, n_challenges=20)
# Defines a header for displaying results
table = [["-"] + [p.username for p in players]]
# Adds one line per player with corresponding results
for p_1, results in cross_evaluation.items():
table.append([p_1] + [cross_evaluation[p_1][p_2] for p_2 in results])
# Displays results in a nicely formatted table.
print(tabulate(table))
await main() Let me know if that helps, or if you still have this issue :) |
Okay, weird. I can run your cell, but when I run my cell (the only difference is my own class import) it fails with the same socket error. Which shouldn't be running anything since nothing is being instantiated and the only import statements in that class are:
|
If you can share the code causing the issue and a full traceback, I could take a deeper look at what is going on :) |
For sure, thanks so much for the amazing help :) Here's the notebook: And here's the stack trace ( I wish it showed more):
|
Are you sure this is the code you are using? I was able to run the code below successfully: import asyncio
from poke_env.player.random_player import RandomPlayer
from poke_env.player.utils import cross_evaluate
from tabulate import tabulate
from poke_env.server_configuration import ServerConfiguration
from pokebot import BotPlayer
class BotPlayer(BotPlayer):
def choose_move(self, battle):
return self.choose_random_move(battle)
def _battle_finished_callback(*args, **kwargs):
pass
server_config = ServerConfiguration(
"ps:8000",
"authentication-endpoint.com/action.php?"
)
async def main():
# We create three random players
players = [
RandomPlayer(max_concurrent_battles=10, server_configuration=server_config),
BotPlayer(max_concurrent_battles=10, server_configuration=server_config),
]
# Now, we can cross evaluate them: every player will player 20 games against every
# other player.
cross_evaluation = await cross_evaluate(players, n_challenges=20)
# Defines a header for displaying results
table = [["-"] + [p.username for p in players]]
# Adds one line per player with corresponding results
for p_1, results in cross_evaluation.items():
table.append([p_1] + [cross_evaluation[p_1][p_2] for p_2 in results])
# Displays results in a nicely formatted table.
print(tabulate(table))
await main() I needed to redefine some of the |
Okay, thank you SO much for your help. Seriously. I just copied the code you had up there and everything works. I still get those weird OS errors but everything does run now. I appreciate your dedication to keeping issues cleared on this repo and all the ground work you've done for this! |
Hello! This is my first time submitting an issue on Github so I'm a bit scared 馃槗
I'm basically trying to dockerize the training process of a DQN bot to keep my local environment clean. I've made a dockerized version of the pokemon showdown server that runs with the '--no-security' flag (docker.io/nacharya114/pokemonshowdown), and I've created a jupyter notebook docker stack that mounts to my working directory that runs pokebot. I'm getting errors at import that read:
All the cell is doing is:
I've run these two docker containers via compose and have used ping to verify that they can talk to eachother via tcp. I'm a little bit stuck on why the process of importing is causing a block due to localhost 8000 being unavailable. Thanks to anyone whom this concerns!
The text was updated successfully, but these errors were encountered: