-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opencv intellisence fails #912
Comments
I am running into the same issue. However
Doesn't solve my issue. I don't know how to get tracing info. If someone can show me, I can share |
Check where your opencv is installed. |
https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue has some instructions for trace logging. |
I am on macOS. I see a folder called |
I'm most interested in trace logs if you can provide them, thanks. |
I am thinking my sys.path is a bit messed up. anyway here is the log |
That's the "Python" output window; I'm looking for the "Python Language Server" output window when you have logLevel set to Trace. This is mainly to look for log lines that show that we aren't loading our bundled native stubs. |
My mistake, thanks. |
what is your output for this?
Something is wrong with your python |
Yes, we're failing to even run python to get the normal info we need (sys.path, the python version, etc). That protobuf pth file appears to be causing issues. If we can't call python, we probably won't be able to resolve much of anything. I don't know if your issue is related to the OP. |
thanks all - I figured it out. I had a python2 package in my PYTHONPATH. And when I was testing I only reloaded the window. But you have to close the entire process to reset env for vscode. |
closing this issue since I was related to opencv being installed in a different location than the interpreter. |
The next release of Pylance will have a partial stub for opencv, and this should help fix issues where we couldn't match the native stub to the installed user version of opencv. |
I am writing a dockerfile and I have
RUN pip install opencv-python
Pip will install the opencv as sudo in the
/usr/local/lib/python3.6/site-packages/cv2
I cannot get the autocomplete feature.
Here is my tracing output:
Solution:
Opencv IntelliSense fails if it is installed in
/usr/local/lib/pythonX/site-packages
. I have to install it usingpip install --user
which is not common in many Dockerfiles.It works fine if it is installed under
$HOME/.local/lib/pythonX/site-packages
How to reproduce the issue:
/usr/local/lib/pythonX/site-packages
:python -c "import cv2;print(cv2.__file__)"
fix:
PS. I know we should never use sudo pip but sometimes this is unavoidable especially in containers and other provided images. There is something wrong with opencv package being in this directory for intellisense.
Related issue:
#138
The text was updated successfully, but these errors were encountered: