0

I have a problem with the following setup:

  • the volume of a remote machine is mounted using sshfs
  • nvim is opened on the mounted volume to ensure all my plugins and settings work
  • ~/anaconda3/envs/.. is interpreter path on the mounted volume I want to use

Unfortunately I can't get pyright to use the interpreter on the remote volume.

So far I tried:

return {
  settings = {
    python = {
      pythonPath = "~/anaconda3/envs/env/bin/python3"
    }
  }
}

setting venvPath and venv in the pyright language server config

return {
  settings = {
    python = {
      venvPath = "~/anaconda3/envs",
      venv = "clthesis"
    }
  }
}

configuring the global python host to

   vim.g.python_host_prog = "~/anaconda3/envs/env/bin/python"
   vim.g.python3_host_prog = "~/anaconda3/envs/env/bin/python3"

I know it's a finicky setup so any help appreciated

6
  • Third paragraph here says shell variables are not supported, including ~. Try specifying the absolute path or have lua expand it for you.
    – frippe
    Jul 31, 2022 at 10:07
  • Changed it to /home/<user>/anaconda3/envs/<env>/bin/python3 in both the pyright config and the host_prog's but unfortunately it still does not work. :checkhealth shows ``` ## Python 3 provider (optional) - INFO: Using: g:python3_host_prog = "/home/<user>/anaconda3/envs/<env>/bin/python3" - WARNING: No Python executable found that can import neovim. Using the first available executable for diagnostics. - INFO: Executable: Not found ```
    – cal
    Jul 31, 2022 at 12:13
  • Doesn't g:python3_host_prog point to the interpreter you expect? Did you install neovim for that interpreter? Besides, it's pyright you're configuring, not neovim itself, so unless pyright integrates with :checkhealth (which I don't recall it does, but I may be mistaken), I wouldn't expect to be able to use checkhealth to see if pyright picked up the correct config.
    – frippe
    Jul 31, 2022 at 13:20
  • I assume g:python3_host_prog would do what I need. I also pip install neovim into the conda environment I want to use and the host_prog points to the correct interpreter. pyright is still not finding my package imports etc.
    – cal
    Aug 3, 2022 at 7:42
  • That's not what it's used for. Check :h provider or simply press K while the cursor is over g:python3_host_prog to see the documentation. It's used for python plugins, whereas pyright is a standalone language server that the built-in LSP client in nvim is communicating with.
    – frippe
    Aug 3, 2022 at 8:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.