I’m trying to reconcile `Error: python projects wi...
# getting-started
d
I’m trying to reconcile `Error: python projects without a
virtualenv
project configuration are not yet supported` I’m getting from Deployments with the fact that we’re using Poetry for our dependencies like this article demonstrates. Any suggestions?
Ok… so I added virtualenv to my project yaml file and generated a requirements.txt with Poetry (
poetry export --format=requirements.txt > requirements.txt
)
but the package isn’t getting installed…?
b
which python version did you use to generate your
requirements.txt
?
d
I generated the
requirements.txt
with Poetry:
poetry export --format=requirements.txt > requirements.txt
Copy code
arpeggio==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
attrs==22.2.0 ; python_version >= "3.10" and python_version < "4.0"
dill==0.3.6 ; python_version >= "3.10" and python_version < "4.0"
grpcio==1.51.3 ; python_version >= "3.10" and python_version < "4.0"
parver==0.4 ; python_version >= "3.10" and python_version < "4.0"
protobuf==4.22.0 ; python_version >= "3.10" and python_version < "4.0"
pulumi-aws-tags==0.4.1 ; python_version >= "3.10" and python_version < "4.0"
pulumi-aws==5.30.0 ; python_version >= "3.10" and python_version < "4.0"
pulumi-awsx==1.0.2 ; python_version >= "3.10" and python_version < "4.0"
pulumi-docker==3.6.1 ; python_version >= "3.10" and python_version < "4.0"
pulumi==3.56.0 ; python_version >= "3.10" and python_version < "4.0"
pyyaml==6.0 ; python_version >= "3.10" and python_version < "4.0"
semver==2.13.0 ; python_version >= "3.10" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
ohh it ignored all of them…
because python 3.9…
b
can you modify your requirements.txt and remove the
python_version
version marker, so for example
Copy code
arpeggio==2.0.0
d
Can the requirements.txt be in the repo top-level or does it have to be in the sub-directory for the pulumi project specified in the Deployment settings?
b
for now, it’ll need to be in the same directory as your pulumi code
but it’s reasonable to want to specify the path to it
d
the repo has multiple pulumi projects:
Copy code
project-1/
project-2/
group/
  project-3a/
  project-3b/

pyproject.toml
And the top-level pyproject has the poetry deps:
It’d be nice to just be able to use that. Also, would be nice to be able to specify the python version so we can have consistent behavior locally and within the deployment context
b
totally agree, could you open an issue here? https://github.com/pulumi/service-requests/
d
sweet ok it got up and running
On a different note, has anyone ever brought up how the nouns are confusing in Pulumi, especially with the UX? The real organization is org => projects => stacks, but in the UI the “stacks” listing lists projects and then stacks within the projects. Also, from the CLI, when you’re running pulumi, you need to specify the stack for the current running project… to do that you specify
<org>/<stack>
and the project is implied… It just seems strange that projects kind of fade away even though they are a pretty important organizational principle
r
@dry-journalist-60579 I responded on the issue you created about supporting alternative dependency managers for pulumi deployments. https://github.com/pulumi/service-requests/issues/193 Please give it a try and let me know if you run into any issues!
d
Oh, thank you! I’ll take a look
@red-match-15116 any recommendations on the best way to install a specific version of python?
image.png
I guess I’m debating whether we need to pin our local and repo-specified python versions to be 3.9.x because that’s what the pulumi images use or whether there’s a good way to have the executor run with the version we’d like to use
r
Doesn't poetry install the required python version when it's specified in the pyproject file?
d
ahh, interesting, let me give it a whirl—looks like you can specify
--directory
for
poetry install
it would be nice to be able to specify all these things in some sort of yml file instead of needing to input this in the UI for each project + stack
@red-match-15116 hmm no dice on python version
r
interesting! maybe like a pre-run command to install the desired python version like
apt-get install python 3.10
?
d
hmm so I’m not having so much luck installing 3.10 (tried pyenv and apt-get) but both seem to be cumbersome and slow down the run a ton… I think I’m going to pin our version of to 3.9 for now. Do you see a world where this could somehow be configurable more easily?
r
@dry-journalist-60579 yeah for sure - we definitely want to end up in a place where these things are more easily configurable. I could imagine a future where we provide images with different python versions. It's not in our immediate timeline though. However, an option that is currently possible is to specify a custom executor that already has your required version of python. There's info here on what requirements the image must meet. You could potentially build off the pulumi image with your specific python version installed. https://www.pulumi.com/docs/reference/deployments-rest-api/#:~:text=image%20is%20used.-,executorImage,-(Optional%5Bstring%5D)%3A%20Allows
d
Thank you again! I just added a few comments to the PR for posterity