-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conda environment is not recognized #348
Comments
When conda create --name envnumpy python numpy
conda activate envnumpy
subl . , what's the output of |
The issue is that I check for Update: It looks like Conda doesn't follow pep405. I will implement another way for finding Conda venv soon. |
Why do you need to find |
You can get the name of the conda environment from the path without having to use |
Using just Python, this gets the name of the activated conda environment: import os
os.getenv("CONDA_DEFAULT_ENV") And this gets the path to the activated conda environment: import os
os.getenv("CONDA_PREFIX") |
You can use this to get the Python version of the activated conda environment: from platform import python_version
python_version() |
Thanks. But the issue is not I don't know how to get those. Refactoring is required. |
Could you try this PR: #349 It's based on my Ubuntu virtual machine so I am not sure whether it will be different on MacOS, but hopefully it won't. |
The |
I copied your changes in the
|
I have made a new release 1.4.13, which should be available on Package Control within hours. You can remove those override when it comes. |
sublimelsp/LSP-pyright#348 Signed-off-by: Jun-Fei Cherng <[email protected]>
The LSP-pyright package isn't finding my conda environment. But it seems to be working with a Python virtual environment. I'm using the following configuration:
Working with Python venv
I created and activated a Python virtual environment, installed NumPy, then opened Sublime Text as shown below:
I have a simple example of using NumPy:
Everything works fine and LSP-pyright finds the venv environment as shown in the status bar:
Not working with conda
I created and activated a Python conda environment with NumPy installed and opened Sublime Text using:
I have a simple example of using NumPy:
I can run the example without any problems but LSP-pyright is not able to resolve the NumPy source as shown below. This does not happen when I use a Python virtual environment.
I am also not seeing anything regarding the conda environment in the LSP-pyright status bar:
The text was updated successfully, but these errors were encountered: