linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
388 stars 41 forks source link

Configuring "venv-selector" to use Conda Environment cannot find pyhon.exe #153

Closed 123abch closed 1 week ago

123abch commented 1 week ago

Issue Description

When using venv-selector with Conda environments on Windows, the plugin looks for python.exe in the Scripts directory by default. However, Conda environments place python.exe directly in the environment directory, not in Scripts.

Steps to Reproduce

  1. Configure venv-selector to use a Conda environment.
  2. Try to activate the environment.
  3. Observe the error message indicating python.exe could not be found in the Scripts directory.

Suggested Fix

Modify the system.lua to look for python.exe directly in the environment directory. Here is the modified code:


function M.get_python_parent_path()
  local config = require 'venv-selector.config'
  local parent_dir = config.settings.anaconda.python_parent_dir

  if M.sysname == 'Linux' or M.sysname == 'Darwin' then
    return parent_dir or 'bin'
  else
    return parent_dir or '.\\'
  end
end

This change allows the plugin to correctly locate python.exe in Conda environments.
Environment Details
OS: Windows 11
Neovim Version: 0.10.0
Plugin Version: latest
linux-cultist commented 1 week ago

Hi,

This should be fixed in a much better way in the regexp version of the plugin. It doesn't attempt to combine paths and guess where things are anymore. Also it lets you create your own searches if you need them. Please try it, there is info in the github readme at the top.