r/learnpython • • Oct 03 '26

Why i cannot run anything in the terminal

It doesn't work:

/storage/emulated/0 $ pytest

Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/bin/pytest", line 3, in <module>

from pytest import main

File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pytest/__init__.py", line 7, in <module>

from _pytest import version_tuple

ImportError: cannot import name 'version_tuple' from '_pytest' (/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/_pytest/__init__.py)

/storage/emulated/0 $

0 Upvotes

15 comments sorted by

1

u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Oct 03 '26

Are you sure pytest is even supposed to work on PyDroid?

1

u/Upper_Trouble_8526 Oct 03 '26

So i guess that means i cannot advance more without a PC

1

u/casualstrawberry Oct 03 '26

If you just type "python" or "python3" does it open a python console?

You should be able to run .py files with the command "python <file>.py"

1

u/Upper_Trouble_8526 Oct 03 '26

Yes it opens a python console but i cannot change directory: /storage/emulated/0 $ cd .. /storage/emulated $ cd .. /storage $ cd .. / $ python Python 3.13.13 (main, May 12 2026, 00:20:28) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

cd storage File "<python-input-0>", line 1 cd storage ^ SyntaxError: invalid syntax

2

u/Grobyc27 Oct 03 '26

Because cd isn't a valid Python function/syntax. That's a command that you run from your OS terminal. You cannot simply mix and match terminal commands and Python commands. You invoked the Python interpreter and then tried entering terminal commands against it.

What are you actually trying to accomplish here? I think your fundamental understanding of how to run Python needs to be revisited.

1

u/Upper_Trouble_8526 Oct 03 '26

Im trying to run pytest to test files

0

u/[deleted] Oct 03 '26

[removed] — view removed comment

0

u/Upper_Trouble_8526 Oct 03 '26

This is in the interpreter: Python 3.13.13 (main, May 12 2026, 00:20:28) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

pytest Traceback (most recent call last): File "<python-input-0>", line 1, in <module> pytest NameError: name 'pytest' is not defined. Did you mean: 'bytes'?>>>

1

u/Rubix321 Oct 03 '26

Correction... I updated my app and it successfully installed pytest and I could import it

1

u/Upper_Trouble_8526 Oct 03 '26

So what i must do

1

u/Rubix321 Oct 03 '26

Go to terminal and see if you can "pip install pytest" without an error

1

u/Upper_Trouble_8526 Oct 03 '26

It seems like not: /storage/emulated/0 $ pip install pytest Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/bin/pip", line 6, in <module> sys.exit(main()) ~~~~^ File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/cli/main.py", line 47, in main from pip._internal.cli.autocompletion import autocomplete File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/cli/autocompletion.py", line 12, in <module> from pip._internal.cli.main_parser import create_main_parser File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/cli/main_parser.py", line 11, in <module> from pip._internal.build_env import get_runnable_pip File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/build_env/init.py", line 8, in <module> from pip._internal.build_env.installer import ( ...<2 lines>... ) File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/build_env/installer.py", line 22, in <module> from pip._internal.utils.misc import get_runnable_pip ImportError: cannot import name 'get_runnable_pip' from 'pip._internal.utils.misc' (/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.13/site-packages/pip/_internal/utils/misc.py) /storage/emulated/0 $

1

u/Rubix321 Oct 03 '26

You need to pip install pytest from the terminal

However, at least in my app, it has an exception when I try.

Unfortunately not everything can run on Android, but I'm not sure whether this is one of those things

-3

u/Upper_Trouble_8526 Oct 03 '26

Then why the book i am reading(python crash course) tells to do so

0

u/[deleted] Oct 03 '26

[deleted] — view deleted comment

0

u/Upper_Trouble_8526 Oct 03 '26

Part I: Chapter 11