Skip to content
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

Python: console picks up virtualenv automatically but terminal does not #2288

Open
nealrichardson opened this issue Feb 19, 2024 · 5 comments

Comments

@nealrichardson
Copy link

nealrichardson commented Feb 19, 2024

Positron Version:

Positron Version: 2024.02.0 (Universal) build 1537
Code - OSS Version: 1.86.0
Commit: 9f49f1d
Date: 2024-02-16T18:29:32.651Z (2 days ago)
Electron: 27.2.3
ElectronBuildId: undefined
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.3.0

Steps to reproduce the issue:

I opened a python project that I'd previously used with Positron, and had previously created a virtualenv from the command palette. Positron detected the virtualenv in the .venv directory and started the python console with that python.

Then I switched to the terminal tab because I needed to pip install something else. I was confused for a minute because the virtualenv was not active there. I had to type the usual . .venv/bin/activate in order to install into it.

What did you expect to happen?

Since everything else about Positron was telling me that I was using this virtualenv, I would have expected it already to have been activated in the terminal too.

Were there any error messages in the output or Developer Tools console?

I didn't look.

@seeM
Copy link
Contributor

seeM commented Feb 21, 2024

When Positron selected the virtualenv interpreter, it should also have marked the terminal as "stale" and shown a little warning sign next to the terminal icon:

image

Is that showing in your case? Admittedly, it's not very noticeable.

If you hover over it, it should say:

The following extensions want to relaunch the terminal to contribute to its environment:

  • Positron Python: Activated environment for ~/.pyenv/versions/3.12.1/bin/python

And a clickable "Relaunch terminal" link.

@nealrichardson
Copy link
Author

Yeah I see that now. Never would have occurred to me to click on it.

@petetronic
Copy link
Collaborator

Perhaps we can record an enhancement to make Terminal warnings more obvious, perhaps they print a message to the Terminal instead of just a subtle icon change?

@nealrichardson Also note that because our Console is ipython based, you should be able to pip install from the Console without switching to a terminal.

@nealrichardson
Copy link
Author

Is there a reason not to just send . path/to/virtualenv/bin/activate to the Terminal when you activate a virtualenv?

@nealrichardson
Copy link
Author

For what it's worth, I just opened my project in regular VS Code and the virtualenv seemed to be activated in the terminal automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants