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.

Getting FileNotFound error running almost anything with "poetry run"

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).

  • OS version and name: Alpine linux 3.11.5 under Docker (on Windows)

  • Poetry version: 1.0.5

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/dragonpaw/c9e5fd0f920690e0a0274bb3e87f94f1

Issue

I’m kinda stumped what’s up with running black, or anything else, via poetry run while within my Docker container. When running locally, everything seems fine.

This happens:

/app $ poetry run black

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

Adding -vvv doesn’t seem to help: (Though I’m not sure where the -vvv should go)

/app $ poetry run -vvv black

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

/app $ poetry -vvv run black
USAGE
  poetry help [<command1>] ... [<commandN>]

ARGUMENTS
  <command>              The command name

GLOBAL OPTIONS
  -h (--help)            Display this help message
  -q (--quiet)           Do not output any message
  -v (--verbose)         Increase the verbosity of messages: "-v" for normal output, "-vv" for more
                         verbose output and "-vvv" for debug
  -V (--version)         Display this application version
  --ansi                 Force ANSI output
  --no-ansi              Disable ANSI output
  -n (--no-interaction)  Do not ask any interactive question

In fact, it doesn’t care if I give it a command:

/app $ poetry run -vvv

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

Black is definitely on the path…

/app $ which black
/usr/local/bin/black

But if I give the full path, then it works:

/app $ poetry run /usr/local/bin/black
No Path provided. Nothing to do 😴

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mxabcommented, Apr 14, 2020

Can you verify it is installed by running poetry install? If nothing happens try to delete the virtual env and rerun install. I might have had a similar case where I think the reinstall helped

0reactions
mitchlloydcommented, Jun 8, 2022

I believe I’m also running into this issue on version 1.1.13, but I am trying poetry for the first time.

It seems important to know that ~/go/bin just happens to be the last entry in my PATH.

> poetry run

 FileNotFoundError

  [Errno 2] No such file or directory: b'/Users/<user-name>/go/bin/run'

  at ~/.asdf/installs/python/3.9.7/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
> poetry run uvicorn

FileNotFoundError

  [Errno 2] No such file or directory: b'/Users/<username>/go/bin/uvicorn'

  at ~/.asdf/installs/python/3.9.7/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
> poetry run anything

  FileNotFoundError

  [Errno 2] No such file or directory: b'/Users/<username>/go/bin/anything'

  at ~/.asdf/installs/python/3.9.7/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

Update: I’m not sure what matters here but I reshimmed asdf (asdf reshim) then ran poetry install and things seem to be working now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

poetry run tox FileNotFoundError - python - Stack Overflow
Since tox was listed under the [tool.poetry.dev-dependencies] section of my pyproject.toml file, it wasn't automatically added. Either run ...
Read more >
Why does PyCharm not run pytest testing for my application?
When I run the test_db.py in pycharm I get: ... It's almost like pycharm is not executing the pytest. Even if I right...
Read more >
How to Publish an Open-Source Python Package to PyPI
In this step-by-step tutorial, you'll learn how to create a Python package for your project and how to publish it to PyPI, the...
Read more >
Update Packages in Python Poetry - YippeeCode
Second, I try to run poetry update again. If you still get an error, it might be a good idea to rebuild your...
Read more >
[Solved] Poetry installation in Windows doesn't work
Whenever I try to run poetry install on powershell inside a git repo, ... 36│ except FileNotFoundError: 37│ raise ValueError("Directory ...
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