question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.0.0b4] poetry run fails with FileNotFoundError

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option). poetry run -vvv does not change anything about the output

  • OS version and name: Linux x86_64 (Elementary OS)

  • Poetry version: 1.0.0b4

  • Link of a Gist with the contents of your pyproject.toml file: Link (generated with poetry new)

Issue

Running poetry run without additional argument fails with

[FileNotFoundError]
[Errno 2] No such file or directory

Executing poetry run pip list for example works fine. It’s just with either no argument or when the first argument is not found as an executable.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:22
  • Comments:28 (4 by maintainers)

github_iconTop GitHub Comments

28reactions
mattwelkecommented, Jan 12, 2021

I’m getting this error even after I run poetry install.

Steps to reproduce:

  • Create new Poetry project with poetry init.
  • Create file app.py with contents print('hello').
  • Run poetry run app.py.

Something I notice is that poetry can’t run my program but using python directly can:

poetry run app.py 

  FileNotFoundError

  [Errno 2] No such file or directory

  at ~/.pyenv/versions/3.9.1/lib/python3.9/os.py:607 in _execvpe
       603│         path_list = map(fsencode, path_list)
       604│     for dir in path_list:
       605│         fullname = path.join(dir, file)
       606│         try:
    →  607│             exec_func(fullname, *argrest)
       608│         except (FileNotFoundError, NotADirectoryError) as e:
       609│             last_exc = e
       610│         except OSError as e:
       611│             last_exc = e
python app.py 
hello

EDIT:

Oh wait, I’m just stupid. I misunderstood how to use the poetry run command. Checking the docs helped me:

poetry run python app.py
hello
25reactions
technilloguecommented, Dec 25, 2020

it would be awfully nice if poetry told you to run poetry install or something instead of just FileNotFoundError

Read more comments on GitHub >

github_iconTop Results From Across the Web

poetry run worker.py | FileNotFound [Errno 2] No such file or ...
poetry run means "run the following command in the venv managed by poetry". So the correct way of using it in your case...
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry Install.
Read more >
History | Poetry - Python dependency management and ...
Fix an issue where poetry install fails because of missing hashes for url dependencies (#6389). Fix an issue where Poetry was not able...
Read more >
poetry install [errno 2] no such file or directory: 'python'
Running poetry fails with /usr/bin/env: 'python': No such file or directory ... poetry run means "run the following command in the venv managed...
Read more >
[Errno 2] No such file or directory | by Aurora - Medium
If you run into problems uninstalling Poetry due to previous issues dealing ... install-poetry.py --uninstall and only to return an error of.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found