fannheyward / coc-pyright

Pyright extension for coc.nvim
MIT License
1.29k stars 47 forks source link

Import not found if a module is installed with pip install -e #900

Closed rkimoakbioinformatics closed 1 year ago

rkimoakbioinformatics commented 1 year ago

What's the output of :CocCommand pyright.version

[coc.nvim] coc-pyright 1.1.260 with Pyright 1.1.260

What's the output of :CocCommand workspace.showOutput Pyright

Workspace: /home/ubuntu/projects/test-project
Using python from /home/ubuntu/mambaforge/envs/test/bin/python

[Info - 2:40:49 PM] Pyright language server 1.1.260 starting [Info - 2:40:49 PM] Server root directory: /home/ubuntu/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/ [Info - 2:40:49 PM] No configuration file found. [Info - 2:40:49 PM] No pyproject.toml file found. [Info - 2:40:49 PM] Setting pythonPath for service "test-project": "/home/ubuntu/mambaforge/envs/test/bin/python" [Warn - 2:40:49 PM] stubPath /home/ubuntu/projects/test-project/typings is not a valid directory.
[Info - 2:40:49 PM] Assuming Python version 3.8 [Info - 2:40:49 PM] Assuming Python platform Linux [Info - 2:40:49 PM] Searching for source files [Info - 2:40:49 PM] Found 4 source files

I have a module which I am developing locally. I installed it with pip install -e /path/to/module in the test conda env. This module is not recognized by pyright. However, if I install the same module from PyPI using pip install without -e, it is recognized by pyright. In the same conda env.

fannheyward commented 1 year ago

Got your question, try python.analysis.extraPaths, additional import search resolution paths.

Or extraPaths in pyrightconfig.json https://microsoft.github.io/pyright/#/configuration

rkimoakbioinformatics commented 1 year ago

Thanks. extraPaths solved the issue.