ImportError PyBoy on termux

I tried to test my work on my phone using Termux Debian emulator. After uninstalling the pyboy module and cloning my repository, I get an import error inside your module. I don't understand what is wrong. [Thank you]
Successfully uninstalled pyboy-2.6.0
(.venv) root@localhost:/python/gameboy# pytest -vv --ignore=./tests/PyBoy
============== test session starts ===============
platform linux -- Python 3.11.2, pytest-8.4.1, pluggy-1.6.0 -- /root/.venv/bin/python3 ===================== ERRORS =====================
_______ ERROR collecting tests/test_emu.py _______
ImportError while importing test module '/sdcard/300/gameboy/tests/test_emu.py'.
Hint: make sure your test modules/packages have valid Python names. Traceback:
/root/.venv/lib/python3.11/site-packages/_pytest/python.py:498: in importtestmodule
mod = import_path(
/root/.venv/lib/python3.11/site-packages/_pytest/pathlib.py:587: in import_path

/root/.venv/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
exec(co, module.__dict__)
tests/test_emu.py:16: in <module>
from pyboy_class import GameBoyInspector
tests/pyboy_class.py:31: in <module>
from PyBoy.pyboy.pyboy import PyBoy
tests/PyBoy/pyboy/__init__.py:15: in <module>
from .pyboy import PyBoy, PyBoyMemoryView, PyBoyRegisterFile
tests/PyBoy/pyboy/pyboy.py:16: in <module> from pyboy.api.constants import TILES, TILES_CGB
E ModuleNotFoundError: No module named 'pyboy'
============ short test summary info =============
ERROR tests/test_emu.py !!!!! Interrupted: 1 error during collection !!!!!
================ 1 error in 5.51s ================
Successfully uninstalled pyboy-2.6.0
(.venv) root@localhost:/python/gameboy# pytest -vv --ignore=./tests/PyBoy
============== test session starts ===============
platform linux -- Python 3.11.2, pytest-8.4.1, pluggy-1.6.0 -- /root/.venv/bin/python3 ===================== ERRORS =====================
_______ ERROR collecting tests/test_emu.py _______
ImportError while importing test module '/sdcard/300/gameboy/tests/test_emu.py'.
Hint: make sure your test modules/packages have valid Python names. Traceback:
/root/.venv/lib/python3.11/site-packages/_pytest/python.py:498: in importtestmodule
mod = import_path(
/root/.venv/lib/python3.11/site-packages/_pytest/pathlib.py:587: in import_path

/root/.venv/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
exec(co, module.__dict__)
tests/test_emu.py:16: in <module>
from pyboy_class import GameBoyInspector
tests/pyboy_class.py:31: in <module>
from PyBoy.pyboy.pyboy import PyBoy
tests/PyBoy/pyboy/__init__.py:15: in <module>
from .pyboy import PyBoy, PyBoyMemoryView, PyBoyRegisterFile
tests/PyBoy/pyboy/pyboy.py:16: in <module> from pyboy.api.constants import TILES, TILES_CGB
E ModuleNotFoundError: No module named 'pyboy'
============ short test summary info =============
ERROR tests/test_emu.py !!!!! Interrupted: 1 error during collection !!!!!
================ 1 error in 5.51s ================
full trace: https://github.com/Baekalfen/PyBoy/issues/403
GitHub
ImportError PyBoy on termux · Issue #403 · Baekalfen/PyBoy
I tried to test my work on my phone using Termux Debian emulator. After uninstalling the pyboy module and cloning my repository, I get an import error inside your module. I don&#39;t understand wha...
7 Replies
Sky
Sky2w ago
Isn't this expected with pyboy being uninstalled? I think you should at least install it via pip install . for it to work
pichenka007gd
pichenka007gdOP2w ago
Ohh, for full context please check my issue on GitHub https://github.com/Baekalfen/PyBoy/issues/401
I need to use the source code without CPython
in order to directly control pyboy.mb
GitHub
how to execute 1 processor instructions · Issue #401 · Baekalfen/...
Hello, I have a question: why doesn&#39;t the PyBoy class have a method that performs just one CPU step/instruction? I wanted to build my own basic emulator and decided to create a test by comparin...
Sky
Sky2w ago
While making some failed tests for the link-cable serial connection, I ended up editing the cython declaration to expose the whole mb and perform one instruction at a time with a new method, basically running two equal instances of the same game in sync one instruction at a time But yeah, it's also possible to use the hook method to make an abstraction of that and do a "run_until_hook()" function that returns in a way similar to tick(), with functions that just sets a bool exit condition
pichenka007gd
pichenka007gdOP2w ago
Thank you for the response on issue 401,
but we've moved away from the context of issue 403.
I have already found a way to do single instruction stepping.
The problem is that module import doesn't work in Termux (Debian).
See the trace in issue 403.
Bækalfen
Bækalfen2w ago
I think your problem is a generic Python issue. You're importing a module that you have not installed, and it is not in your path. You placed it in a subdirectory, while you are executing Python somewhere else
pichenka007gd
pichenka007gdOP2w ago
I double-checked the run on my laptop, and yes, the same error occurs. I thought I made a commit when everything was working. Alright, I will figure it out. Thanks. How to close a topic?
Bækalfen
Bækalfen2w ago
Just leave it as is

Did you find this page helpful?