-
-
Notifications
You must be signed in to change notification settings - Fork 54
Description
What's the output of :CocCommand pyright.version
[coc.nvim] coc-pyright 1.1.296 with Pyright 1.1.298
What's the output of :CocCommand workspace.showOutput Pyright
Workspace: /home/agentx3/projects/sandbox/python
Using python from /home/agentx3/projects/sandbox/python/venv/bin/python
[Info - 00:35:15.606] Pyright language server 1.1.298 starting
[Info - 00:35:15.607] Server root directory: /nix/store/qknanwbd9qgmal10myk8ixg7aagdnbd8-vimplugin-coc-pyright-1.1.296/node_modules/pyright/dist/
[Info - 00:35:15.609] Starting service instance "python"
[Info - 00:35:15.616] Starting service instance ""
[Info - 00:35:15.620] No configuration file found.
[Info - 00:35:15.620] No pyproject.toml file found.
[Info - 00:35:15.620] Setting pythonPath for service "python": "/home/agentx3/projects/sandbox/python/venv/bin/python"
[Warn - 00:35:15.624] stubPath /home/agentx3/projects/sandbox/python/typings is not a valid directory.
[Info - 00:35:15.644] Assuming Python version 3.10
[Info - 00:35:15.644] Assuming Python platform Linux
[Info - 00:35:15.703] Searching for source files
[Info - 00:35:15.704] Auto-excluding /home/agentx3/projects/sandbox/python/venv
[Info - 00:35:15.705] Found 1 source file
[Info - 00:35:15.706] No pyproject.toml file found.
[Info - 00:35:15.706] Setting pythonPath for service "": "/home/agentx3/projects/sandbox/python/venv/bin/python"
[Warn - 00:35:15.706] stubPath typings is not a valid directory.
[Info - 00:35:15.730] Assuming Python version 3.10
[Info - 00:35:15.730] Assuming Python platform Linux
[Info - 00:35:15.759] Searching for source files
[Info - 00:35:15.759] No source files found.
Short: Pyright tries to import rope from the virtualenv instead of the system python or the nvim python provider. It should either 1) look in those places instead or 2) look in those places in addition to the virtualenv.
Context: If rope is not installed inside the virtualenv when trying to use the code actions for auto-imports, I get the ModuleError Rope not installed error.
Extraneous Info:I noticed for certain packages nvim can pull from multiple places. Ex: black is called by the python provider in g:python3_host_prog while mypy/pylint are called with the python packages available to the system python !python. I found this out by installing rope in different places until it worked. Might be related to #344 (comment) It would be nice to not have to install rope inside every virtualenv that I would like to use rope in. Also maybe worth noting that the virtualenv is getting activated once inside nvim regardless of whether or not the virtualenv was activated within the shell first.
Many thanks
EDIT: More info:
Results of running :python import rope in nvim
| Directory has venv? | rope on system? | rope in venv? | python import rope success |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
| ✅ | ✅ | ❌ | ❌ |
| ✅ | ❌ | ✅ | ✅ |
| ✅ | ❌ | ❌ | ❌ |
| ❌ | ✅ | N/A | ✅ |
| ❌ | ❌ | N/A | ❌ |