-
-
Notifications
You must be signed in to change notification settings - Fork 14
Getting Cannot execute /home/user/.poetry/bin/poetry error when configuring the poetry environment #196
Comments
@michaelwiles |
@koxudaxi I know its a little off topic but... When I run with ./gradlew clean runIde it works. I can use the plugin successfully. But when I do a ./gradlew clean buildPlugin after having commented out the code that causes this problem and then go to pycharm and manually install from file system the "old code" is still present - install from build/distribution. the other question is how do I log so that I can do trouble shooting? Currently I've removed the rogue code and am running pycharm and running with the first option so I can work. Thank you for this plugin. |
I don't know why the behavior. I often run How did you install poetry? |
I tested the plugin on macOS and Windows10. Also, I guess that the condition is valid. |
@michaelwiles fun validatePipEnvExecutable(pipEnvExecutable: @SystemDependent String?): ValidationInfo? {
val message = if (pipEnvExecutable.isNullOrBlank()) {
PyBundle.message("python.sdk.pipenv.executable.not.found")
}
else {
val file = File(pipEnvExecutable)
when {
!file.exists() -> PyBundle.message("python.sdk.file.not.found", file.absolutePath)
!file.canExecute() || !file.isFile -> PyBundle.message("python.sdk.cannot.execute", file.absolutePath)
else -> null
}
} |
I'm also getting this error.
I can run |
Thank you for giving me the detail. |
I might have better ignore the check that the file is executable on Linux 🤔 |
Hi, same problem here:
|
@erols |
Corrected Pycharm version to 2020.3.4 |
I just understood why the plugin show Also, I can't run poetry with a system Python interpreter. Would you please test this command? $ /usr/bin/python3 `which poetry` |
I guess Poetry should be called by an interpreter which is what you used when installing poetry.
|
Hi, I ran this command and got this error:
|
Actually I can't run poetry with system python on Ubuntu 20.04. I get this error:
|
@erols Use System Python to execute PoetryIf you don't use Python2.7 then you can make a symbolic link for Use pyenv to execute PoetryI don't know the best way. |
Hi! I did the following:
Executing |
Hi. I got it working finally. Steps from fresh ubuntu 20.04:
|
Thank you @koxudaxi - very helpful. So in a nutshell poetry must be executable as a "system" command - without the local shell being fully hydrated - for this to happen, python must be executable as a "system" command. For me this means adjusting my poetry script to actively reference the system python shell - which is python3 in my case. I want to always control the local python executable so I don't want python to resolve on the system. Or if poetry does not run via the system python this location can be adjusted to point to the python executable location that does have poetry correctly installed (could be a pyenv location). And this can be done by creating a new poetry executable crafted for pycharm with the relevant python shell specified on the first line. So my first line of this new poetry executable is #!/usr/bin/env python3 I think what might be helpful is to differentiate between the poetry file not being executable and the poetry file executing but failing to return successfully from 'poetry --version'. In this regard if we can log the output of this call we could send the user to the log messages in pycharm maybe for them to troubleshoot. You want poetry to run in a small a shell as possible and requiring it to have a virtual environment causes a bit of a chicken and egg problem as poetry is a virtual environment tool... So in other words, I don't think the plugin can fix this issue. All I think it needs to do is provide better feedback to the user to indicate that although it found the poetry executable it failed to execute it and it needs a working poetry executable in order to run. |
Hi Michael, I missed that I had to edit I agree that this cannot be fixed in the Pycharm plugin. Unfortunately the poetry team should make this work out of the box on latest ubuntu flavours, or Ubuntu should come with a python executable and pip installed. |
@erols @michaelwiles
Users use flavors of different Python interpreters for each user. Hi, @abn How should we solve the problem? |
Describe the bug
When I setup my poetry environment it correctly auto detects the poetry executable but it says it is not executable. The file is there and it is "executable".
To Reproduce
Steps to reproduce the behavior:
Expected behavior
That the poetry executable gets correctly set.
Environments (please complete the following information):
Additional context
This is the relevant method AFAICT
The text was updated successfully, but these errors were encountered: