ruff executable not found in conda environment on Linux
psarka opened this issue ยท 8 comments
Describe the bug
ruff executable not found in conda environment on Linux
To Reproduce
- Wipe existing JetBrains tools & configs and install fresh Pycharm Pro (2023.2.4 at the time of filing this bug)
- Install this plugin (0.0.25 at the time of filling this bug)
- Create a new conda environment (in my case using micromamba, but any distro should work)
mamba create -n ruff ruff
- Open some project and set
ruff
as local environment
Then
- ruff is not detected by the plugin (see screenshot)
- Pycharm sees ruff installed (see screenshot)
- Clicking aut-detect ruff does nothing (and fair enough, I don't have a global ruff)
- Entering
/home/psarka/mambaforge/envs/ruff/bin/ruff
to Project Specific ruff executable does nothing, and disappears when I click OK and reopen plugin settings - Restarting Pycharm does nothing
- No messages are ever displayed
Expected behavior
ruff to be detected
Environments (please complete the following information):
- IDE: PyCharm Pro 2023.2.4
- OS: Ubuntu 22.04
- Ruff Version 0.1.5
- Plugin version 0.0.25
Additional context
I can set /home/psarka/mambaforge/envs/ruff/bin/ruff
to Global ruff executable and then it works (phew! I really need it!)
@psarka
I'm sorry for the late response.
Thank you for your sponsorship.
I would like to reproduce it, but I don't have conda on this machine and am installing it now.
One thing that concerns me is that the conda utility to find the package path that this plugin uses is deprecated to.
If you can find a better way to find a conda environment, your problem might be solved.
https://github.com/koxudaxi/ruff-pycharm-plugin/actions/runs/7070462990/job/19247160266#step:11:225
Thanks for finding time to look at this!
I'm guessing my case hits this branch: https://github.com/koxudaxi/ruff-pycharm-plugin/blob/3a02cfcb882cac902ed44eb423519b82e2d01f07/src/com/koxudaxi/ruff/Ruff.kt#L157C1-L159C18
I wonder what does sdk.homeDirectory
resolve to? The paths to ruff in my example environment looks like this:
(test-environment) psarka@xps:~$ which ruff
/home/psarka/miniforge3/envs/test-environment/bin/ruff
If sdk.homeDirectory
resolves to /home/psarka/miniforge3/envs/test-environment/
, then you probably don't need the .parent
there.
I will check it in the windows too.
OK, I understand the platform difference.
- Windows
{python_dir}/python.exe
{python_dir}/Scripts/ruff.exe
- Linux/macOS
{python_dir}/bin/python
{python_dir}/bin/ruff
Hi, sorry for the lag, yes, it works, thank you! ๐