Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: the command training/run_experiment.py could not be found within PATH or Pipfile's [scripts] #8

Closed
gitfourteen opened this issue Aug 10, 2019 · 4 comments

Comments

@gitfourteen
Copy link

gitfourteen commented Aug 10, 2019

I'm following this FSDL bootcamp with google colab and got these problems. I knew there are similar issues opened and some suggestions. But tried and failed in my case. Would you advise what to do in colab? Thanks.

Issue description

  • pwd
    '/content/gdrive/My Drive/fsdl-text-recognizer-project'

  • !pip install pipenv
    ...
    Successfully installed pipenv-2018.11.26 virtualenv-16.7.2 virtualenv-clone-0.5.3

  • !pipenv install --dev
    Creating a virtualenv for this project…
    Pipfile: /content/gdrive/My Drive/fsdl-text-recognizer-project/Pipfile
    ...

  • cd lab2_sln/
    /content/gdrive/My Drive/fsdl-text-recognizer-project/lab2_sln

  • ls
    notebooks/ readme.md tasks/ text_recognizer/ training/

  • !pipenv run training/run_experiment.py --save '{"dataset": "EmnistDataset", "model": "CharacterModel", "network": "mlp", "train_args": {"batch_size": 256}}'
    Error: the command training/run_experiment.py could not be found within PATH or Pipfile's [scripts].

@gitfourteen
Copy link
Author

gitfourteen commented Aug 10, 2019

and

!pipenv run pytest -s text_recognizer/tests/test_character_predictor.py

============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /content/gdrive/My Drive/fsdl-text-recognizer-project/lab2_sln, inifile:
collected 0 items / 1 errors

==================================== ERRORS ====================================
______ ERROR collecting text_recognizer/tests/test_character_predictor.py ______
ImportError while importing test module '/content/gdrive/My Drive/fsdl-text-recognizer-project/lab2_sln/text_recognizer/tests/test_character_predictor.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
text_recognizer/tests/test_character_predictor.py:4: in
from text_recognizer.character_predictor import CharacterPredictor
E ModuleNotFoundError: No module named 'text_recognizer'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.74 seconds ============================

@gitfourteen gitfourteen changed the title !pipenv shell not working in colab '!pipenv shell' not working in colab Aug 10, 2019
@gitfourteen gitfourteen changed the title '!pipenv shell' not working in colab Error: the command training/run_experiment.py could not be found within PATH or Pipfile's [scripts] Aug 11, 2019
@gitfourteen
Copy link
Author

gitfourteen commented Aug 11, 2019

...

  • !pipenv run training/run_experiment.py --save '{"dataset": "EmnistDataset", "model": "CharacterModel", "network": "mlp", "train_args": {"batch_size": 256}}'
    Error: the command training/run_experiment.py could not be found within PATH or Pipfile's [scripts].

the command above is copied directly from read.md

No idea why they discard python in the commands. When correct and run, another ModuleNotFoundError comes.

  • !pipenv run python training/run_experiment.py '{"dataset": "EmnistDataset", "model": "CharacterModel", "network": "mlp", "network_args": {"num_layers": 8}, "train_args": {"batch_size": 128}}'
    Traceback (most recent call last):
    File "training/run_experiment.py", line 8, in
    from training.util import train_model
    ModuleNotFoundError: No module named 'training'

Run equivalent sh command

  • !pipenv run sh tasks/train_character_predictor.sh
    Traceback (most recent call last):
    File "training/run_experiment.py", line 8, in
    from training.util import train_model
    ModuleNotFoundError: No module named 'training'

@gitfourteen
Copy link
Author

gitfourteen commented Aug 11, 2019

...

  • !pipenv run python training/run_experiment.py '{"dataset": "EmnistDataset", "model": "CharacterModel", "network": "mlp", "network_args": {"num_layers": 8}, "train_args": {"batch_size": 128}}'
    Traceback (most recent call last):
    File "training/run_experiment.py", line 8, in
    from training.util import train_model
    ModuleNotFoundError: No module named 'training'

Run equivalent sh command

  • !pipenv run sh tasks/train_character_predictor.sh
    Traceback (most recent call last):
    File "training/run_experiment.py", line 8, in
    from training.util import train_model
    ModuleNotFoundError: No module named 'training'

See docs
Prefix !PYTHONPATH='.' will address this issue
e.g.,
!PYTHONPATH='.' pipenv run sh tasks/train_character_predictor.sh

and more on pytest

  • perform sys.path.insert(0, basedir) to make the test module importable under the fully qualified import name

@sachin-suresh-rapyuta
Copy link

sachin-suresh-rapyuta commented Aug 1, 2022

I am running sphinx-versioning command and I get the same error. I tried prefixing the !PYTHONPATH='.' before and still get the same issue.

Command: !PYTHONPATH='.' pipenv run sphinx-versioning build -r version-test docs docs/_build/html.

Have you managed to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants