fedden / poker_ai

πŸ€– An Open Source Texas Hold'em AI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EOFError after Pip install

zanussbaum opened this issue Β· comments

Describe the bug
Installed poker_ai via pip then tried to run poker_ai --help and poker_ai cluster and was met with an EOFError

To Reproduce
Steps to reproduce the behavior:

  1. pip install poker_ai
  2. poker_ai --help

Error Message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/poker_ai", line 2, in <module>
    from poker_ai.cli.runner import cli
  File "/usr/local/lib/python3.8/site-packages/poker_ai/__init__.py", line 12, in <module>
    from . import ai
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/__init__.py", line 1, in <module>
    from . import multiprocess
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/multiprocess/__init__.py", line 1, in <module>
    from . import server
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/multiprocess/server.py", line 10, in <module>
    from poker_ai.ai.agent import Agent
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/agent.py", line 8, in <module>
    manager = mp.Manager()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 57, in Manager
    m.start()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/managers.py", line 579, in start
    self._process.start()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Traceback (most recent call last):
  File "/usr/local/bin/poker_ai", line 2, in <module>
    from poker_ai.cli.runner import cli
  File "/usr/local/lib/python3.8/site-packages/poker_ai/__init__.py", line 12, in <module>
    from . import ai
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/__init__.py", line 1, in <module>
    from . import multiprocess
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/multiprocess/__init__.py", line 1, in <module>
    from . import server
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/multiprocess/server.py", line 10, in <module>
    from poker_ai.ai.agent import Agent
  File "/usr/local/lib/python3.8/site-packages/poker_ai/ai/agent.py", line 8, in <module>
    manager = mp.Manager()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/context.py", line 57, in Manager
    m.start()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/managers.py", line 583, in start
    self._address = reader.recv()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
    buf = self._recv(4)
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/connection.py", line 383, in _recv
    raise EOFError
EOFError

Expected behavior
CLI help message

Desktop (please complete the following information):

  • OS: Max
  • Python 3.8.3

Thanks for your bug report @zanussbaum . I did test this on a few machines before deploying but I must have not captured your specific case - sorry about that.

Would you be able to try pip installing into a conda, virtualenv or something similar, environment and seeing if that works? I'll install python 3.8 on my Mac and see if I can replicate your problem

conda create -n pluribus
conda activate pluribus
pip install poker_ai
poker_ai
I don't have a ton of experience with conda, but still getting the same error when doing above.

Thanks so much for this @zanussbaum

I've just tried on Linux and Mac OS X, and it's a OS X issue.

If you have a linux distro you can use in the meantime, then please use that (it should be fine on that 🀞), otherwise we'll try to find some time to look into supporting OS X. Although just heads up, we are currently focusing on other projects so PRs are very welcome here and we can't guarentee a timely response πŸ™‚

commented

I wonder if trying python 3.7 would work in the meantime?

hm i'll test it out. either way, i'm excited to try it out!

can you try again with a Linux OS please @johanpettersson1 ?

can you try again with a Linux OS please @johanpettersson1 ?

I don't have a linux machine at home sorry :(

I was facing similar issues on my Macbook. The fix for this bug was straightforward as indicated here:

I've implemented a fix for it in PR123. Could you please merge?

Great Alex. This worked. What is the result of running clustering, my computer needs 6 hours to finish this, does this need to be ran every time or the results can be saved?

12 hrs and still only here, do I need to run this on a server?
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py:127: RuntimeWarning: 'poker_ai.clustering.runner' found in sys.modules after import of package 'poker_ai.clustering', but prior to execution of 'poker_ai.clustering.runner'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
31%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 181277/581400 [4:32:32<15:19, 435.23it/s]

24 hrs and still going on a Core i5 vPro CPU, does anyone know how long this will take? I can see a few .joblib files have been created, couldn't someone just copy these files rather than everyone creating these?

I see this is eventully created after 1.5days card_info_lut.joblib.
This should have been really shared.

This repo seem to have too many issues, this works like a charm:
https://github.com/datamllab/rlcard

Found a simple fix for this, see.