Replies: 1 comment 6 replies
-
This is a configuration issue, not a bug. Moving to a discussion topic. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.
Describe the bug
In Neovim when I attempt to import a 3rd party library such as NumPy I get an error 'Pyright: Import "NumPy" cannot be resolved'.
I have attempted this some other 3rd party libraries and the same thing is happening. Built in libraries don't seem to produce errors. [1]
However Numpy I am still able to get LSP suggested completions and function definitions. I have shown an example image below with
numpy.array()
[2]. But with other 3rd party libraries, for example, cv2 (OpenCV) I am shown the LSP suggested completion for importing but I do not get LSP completions or definitions when trying to use cv2 functions. [3]Another example is with PyTorch I get import cannot be resolved errors however, I still am able to get LSP suggested completions and definitions for PyTorch functions, example image shown below [4].
bs4 says "Import bs4 could not be resolved from source", however LSP suggested completions and definitions still work.
In Neovim printing
print(sys.version)
reveals: 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:29) [Clang 14.0.6 ]Pylance works in VSCode completely fine with no issues.
To Reproduce
Using within an activated Conda environment
use("neovim/nvim-lspconfig")
andrequire("lspconfig").pyright.setup(config())
Conda/pip and example libraries
Expected behavior
To not display the error and be able to import and use installed 3rd party libraries via pip and/or conda.
Screenshots or Code
Import not resolved issue [1]
Completion with definitions working for
import numpy
[2]Errors with 3rd party library imports and functions. [3]
PyTorch examples [4]
---
I'm quite new to Neovim and apologise for any ignorance I may have.
Beta Was this translation helpful? Give feedback.
All reactions