-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry run raises FileNotFoundError without any more information (workaround found) #3592
Comments
I have encountered the same error, but found another workaround. I put the script i wanted to run in a subfolder (such as src). For example, I have also noticed that the same error occurs on my system, if I just run |
I started having this issue today (seemingly randomly, Poetry was working fine a few days ago). None of the above workarounds have helped. It's breaking every poetry project I have, not just a specific one. If I do this, everything (besides
If I give an absolute path or relative path to the script, that actually works, e.g. both of these work:
To get some visibility, I added a print in the os package on L600 just before the try/except clause for the call to exec_func() and see that it's looking in poetry's bin directory for my script, which obviously is not going to be there:
It doesn't seem to be looking in the project directory when looking for |
Tried python --version
# Python 3.8.5
python3.9 --version
# Python 3.9.5 After: python --version
# Python 3.8.5
python3 --version
# Python 3.8.5
python3.9 --version
# Command 'python3.9' not found, did you mean: ...
which python
# /usr/bin/python |
I fixed the $ poetry run -h
FileNotFoundError
[Errno 2] No such file or directory: b'/snap/bin/-h'
at ~/.pyenv/versions/3.8.6/lib/python3.8/os.py:601 in _execvpe
597│ path_list = map(fsencode, path_list)
598│ for dir in path_list:
599│ fullname = path.join(dir, file)
600│ try:
→ 601│ exec_func(fullname, *argrest)
602│ except (FileNotFoundError, NotADirectoryError) as e:
603│ last_exc = e
604│ except OSError as e:
605│ last_exc = e My PATH variable looks as follows: /home/name/.pyenv/plugins/pyenv-virtualenv/shims:/home/name/.local/bin:/home/name/.pyenv/plugins/pyenv-virtualenv/shims:/home/name/.pyenv/shims:/home/name/.pyenv/bin:/home/name/.cargo/bin:/home/name/.local/bin:/home/name/.pyenv/shims:/home/name/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin |
Finally I fixed my problem: it was the bad entry in the [tool.poetry.scripts]
poetry-test = "poetry_test.console:main" Here |
Same issue here of Ubuntu:
|
should that be?
|
Facing dvc issue with following: Note that I have already exported the path variable in my .bashrc file
|
@ThmX Can you provide more details for how to implement your suggested workaround? |
Up ;) |
I just noticed in the issue description that is not following the CI recommendations to use poetry. What ringed alarms to me is that you're installing poetry in the global python lib, not in some isolated environment (provided by I believe if you follow, you're not going to have the issue. |
Hoj, apologies for the delay in my answer. To be fully honest, I stopped using poetry since some time as we had too many open issues with cross-developement, decided to go with something smaller and closer to Anyway, I still wanted to rebase my PR but the code base seems to have changed a lot since then. Haven't tried if the issue is stop open. I am If someone has the time and will, you can base it on my commit ThmX@3d00f05 |
-vvv
option).poetry init
with a main.py and the followingscripts
section:Issue
Using the following Dockerfile as base image on our build pipeline.
poetry run main
crashes with the following error:Long story short, I've been able to work around the issue and hope this might help others. Here is what did the trick:
/workdir # ln -s /usr/bin/python3 /usr/bin/python
It seems that
poetry run
is expectingpython
to be found in the PATH (https://github.com/python-poetry/poetry/blob/master/poetry/console/commands/run.py#L40) on contrary topoetry
which is directly usingpython3
:The text was updated successfully, but these errors were encountered: