Wrong python source in activated environment on M1 in VS code terminal #252
-
Issue: In Terminal app:
In Visual studio code terminal:
Note that this method of installation is the first one where I could succesfully create a virtual environment (base) where Other failed installation attempts:
I verify that I have indeed a MacBook Air with an M1 chip. For the requested additional information, I have copy pasted the output from both terminals. The In Terminal App: Environment (
Details about conda and system ( conda info ):
In Visual studio code terminal: Environment (
Details about conda and system ( conda info ):
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
it's likely that vscode is looking for things like miniconda3 or anaconda3 and doesn't look for miniforge. You might want to specify to vscode that it should use an interactive shell, thereby running your bashrc file instead of just the bash profile file. |
Beta Was this translation helpful? Give feedback.
-
This sometimes happens to me in vscode --- though usually when using the remote ssh stuff, and I think it basically misaligns the envs somehow. Oftentimes, for me, it is messing up What I usually do to resolve this is to start the project over in vscode; and then be a little careful about selecting the interpreter when asked. Also note: the activation of the specific env doesn't always work immediately for some weird reason. You will notice when you ask it for a new terminal window (inside vscode) it goes through the motions of Not sure if this is helpful, but just giving my recollection of the countless times I faced this in the past --- but not recently |
Beta Was this translation helpful? Give feedback.
-
Can you screenshot the interpreter panel? Also note: https://code.visualstudio.com/docs/python/environments#_where-the-extension-looks-for-environments and https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter |
Beta Was this translation helpful? Give feedback.
-
So to problem is in Command line python in the build-in terminal of VS code. I had not yet gotten around to setting up any python features of VS code itself. I was just testing in the build-in bash shell. In response to the comments, I have added the miniforge conda and correct python interpreter of VS code. Not that that should matter, since I am running on a bash shell. See pictures. |
Beta Was this translation helpful? Give feedback.
-
I have run into this problem as well.. It is a VS Code Terminal issue when using conda. This issue in the vscode repo describes the problem. TLDRSet the vscode terminal setting Although I have had colleagues where this didn't work so it is not a sure thing. |
Beta Was this translation helpful? Give feedback.
-
it is clear to me that this is an issue of integration between VScode and a custom installer of conda. I think you would do well to find somebody at VSCode to help you too. however, I do not think it is a bug for us to fix. As such I've created a discussion from this to provide a space where you all can share tips among yourselves. If you do find a concrete answer, a PR to this repo would be appreciated summarizing the findings in the README |
Beta Was this translation helpful? Give feedback.
-
Confusing 😕 I never faced the issue you're facing. I misunderstood this as using the vscode while in a project --- for that, I used to have issues with the envs switching. But VSC never lost conda altogether for me like it is clearly losing it for you |
Beta Was this translation helpful? Give feedback.
I have run into this problem as well.. It is a VS Code Terminal issue when using conda.
This issue in the vscode repo describes the problem.
TLDR
Set the vscode terminal setting
terminal.integrated.inheritEnv
: FalseAlthough I have had colleagues where this didn't work so it is not a sure thing.