Hello. I am getting an error `error: failed to dis...
# general
v
Hello. I am getting an error `error: failed to discover plugin requirements: calling `python -m pip list -v --format json`: exit status 1` when I ran
pulumi up
on an pulumi-aws project. I created the pulumi project a few months back, it was working well that time and I created a few resources. I am re-visiting the project again, and it throws me this error. What could have went wrong? I only updated the pulumi version.
1
e
What happens if you try and run that python command?
python -m pip list -v --format json
v
e
Is there a venv setup for this project? Would be specified in the Pulumi.yaml
v
I tried pulumi-aws version 4.38.1 (the version it was 4 months back) and also the latest version 5.10.0. I get the same error.
e
I doubt this is anything to do with the aws version. It a plain python command that's giving a bad exit code.
Pulumi will try to invoke the "right" python based on venv settings, so that might be starting a different python binary to what's the default on your path.
v
Pipfile reads, [packages] pulumi = ">=3.0.0,<4.0.0" pip = "*" pulumi-aws = "~=4.38.0" [requires] python_version = "3.9"
I tried changing the Pipfile to show python 3.9, 3.8 and 3.10. Maybe there is a mismatch between python version and pulumi-aws version.
e
Can you run with --logtostderr -v5 and see what that prints. It should include a line like
Language host launching process
which will say exactly what python is being run
v
It threw a lot of info. There was no
Language host launching process
e
Oh sorry my bad, of course that message comes from the language plugin so it needs
--logflow
added to the command to show up 🤦‍♂️ sorry
v
The output showed a venv path to python. I checked the python version. It is Python 3.10.5. Not the intended 3.9 as shown in Pipfile.
e
And if you run
-m pip list -v
with that python does it error?
👍 1
v
The path also contains python3.9 along with python(which is 3.10). How can I make pulumi use python3.9 ?
e
I think it's hardcoded to use an executable called "python", doesn't look like there's anyway to override that currently.
Annoyingly the env var PULUMI_PYTHON_CMD can change it, but it doesn't get picked up when on the venv path. Which arguably is a bug.
v
I deleted the "python" in the venv. Then recreated the "python" as a soft link to /usr/bin/python3.9. The error is gone. Thank you Fraser. A recent update of python from 3.9 to 3.10 has caused the issue in some old pulumi projects.
e
FYI I've also raised https://github.com/pulumi/pulumi/pull/10155 to allow overriding of this via envvar in the future
🙌 1