Hi, everyone. Just starting with Pulumi, and hopin...
# getting-started
w
Hi, everyone. Just starting with Pulumi, and hoping to work in PyCharm. Unfortunately, PyCharm doesn't see an interpreter in the
venv
created by
pulumi new
, and it also doesn't have documentation for the pulumi modules. Does anyone have experience getting these set up?
In case it's relevant, I'm on a Windows 10 machine, but am running Pulumi in Ubuntu on WSL.
g
Yep! I use PyCharm exclusively for Python work here. If I've run
pulumi new
in a different terminal and then opened the directory in PyCharm, it finds the venv, but if I try to create it in PyCharm, I have to add the interpreter myself to the project. Once you do that, the documentation and code completion all pop up. I've got screenshots; one sec
Bottom right corner, you can select the interpreter. If the right one doesn't appear, you need to add it. Add it in this part of preferences shown in the screenshot.
If that's not helping, I'm happy to walk you through it if you want to drop a screenshot
w
Thanks, @great-queen-39697! I've been trying to add the interpreter this way, but either PyCharm isn't finding it or I'm looking in the wrong place.
My understanding is I should use the interpreter in
<project_root>/venv/bin
, but Pycharm doesn't find it there.
g
Hmmm.... can you go into a terminal, navigate to your project root, and run
source venv/bin/activate
and then
which python
for me?
w
Copy code
/mnt/c/dev/code/ussf-services/venv/bin/python
That file does exist, along with a
python3
file. But I think they're just symlinks.
FWIW, I was able to use the WSL global python interpreter, and get the warning to disappear. But obviously it would be nice to use what's in the venv (if it's anything other than a link).
Adding the interpreter didn't add documentation pulumi though, so it looks like pycharm isn't picking up the packages in the venv.
g
Huh. It kinda looks like PyCharm isn't refreshing its cache of the file system or something. Give me a moment; I haven't really used PyCharm on Windows in a long time so I want to check to ensure there's not a known issue
w
Thanks, @great-queen-39697. I'll try searching in parallel too. I've also tried refreshing the file explorer window and restarting PyCharm.
g
That's really odd ๐Ÿ˜• So WSL is apparently odd? https://youtrack.jetbrains.com/issue/PY-32853
There's apparently a
On WSL...
option
Does PyCharm work for you with other venvs?
w
I actually haven't used it yet. I'm primarily a C# developer, but chose python for pulumi because it's more friendly to the team at large.
I do have the professional version of PyCharm though, and I've tried finding the interpreter in the WSL option. It see more in the
venv/bin
folder, but not the
python
file.
Seems like we may be running into PyCharm issues though. I can play around with it, and consider foregoing WSL if I have to.
Thank you very much for your help, @great-queen-39697!
g
You're welcome! I'm so sorry I can't figure that out. I'll see if I can find a Windows machine to test it on if you get stuck.
I've heard good things about VSCode for WSL, and it should have the code completion and documentation for Python. I unfortunately just don't use it myself, or I would explain how to set it up.
I could ask and find out if anyone here has Windows and can explain it, though, if you end up wanting to use it
w
For anyone who finds this ๐Ÿงต in the future, it looks like PyCharm does not currently support virtual environments in WSL. Hopefully, they'll add support soon.
Thanks, @great-queen-39697. I've used VS Code before. Especially now that you've given me some direction, I should be able to figure it out, but I'll resurrect the thread if there's a problem. I really appreciate your help!
๐ŸŽ‰ 2