-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pylint extension-pkg-whitelist=cv2 not working only when through the extension (Anaconda) #10444
Comments
@kimadeline It could be that when we are running pylint it is running in an unactivated environment. It is likely that |
This solves the issue for me: |
@ychechik I'm afraid it's not the cure but crashing pylint by a nonexistent parameter, that obviously prevents from detecting any errors. |
Hi @747, thank you for reaching out and your detailed research! Just to confirm what @karthiknadig said, does it work if you run |
@kimadeline Hi, I believe your comment contains an important keyword but I don't think I fully understand it. Namely, what should I do when I have to run something "in a terminal instance that doesn't have an activated environment"? Is this a Python term or Anaconda's?
Oh, I include my workspace settings (which were in the original issue). "python.pythonPath": "My\\Path\\to\\Anaconda3\\envs\\cv\\python.exe",
"python.autoComplete.extraPaths": [
"My\\Path\\to\\Anaconda3\\Lib\\site-packages"
],
"python.linting.pylintArgs": [
"--generated-members=cv2.*",
"--extension-pkg-whitelist=cv2"
] |
Environments are a Python concept, and conda/Anaconda have their own spin on it. From the conda documentation:
There are good online resources explaining the difference between Python and conda environments, for example this one, but I disgress, let's get back to our issue 🙂 In the terminal output you copied:
The first line shows that the However, when the extension runs commands on behalf of the user like linting or formatting, it doesn't do so inside an environment, which is what we're trying to replicate here. 👉 When you open a terminal, does the And from there, run the same command as what the extension was running, namely |
@kimadeline Thank you for your kind instruction. So I have tried it:
Now I can confirm that it outputs exactly same errors the extension does. |
What happens if you add |
It still seems to print the same errors.
|
Hmmm 🤔 I will try to replicate your issue, see if we can walk through this together. Which command(s) did you use to install OpenCV? Do you also have a sample repo or sample code I could use to reproduce your pylint issue? Thanks! |
If my record is complete, this is all I have done to set up the environment (using Anaconda Prompt, IIRC).
|
Sorry I didn't get back to you sooner @747! Can you try opening VS Code from inside a terminal ( |
Hi, do you mean opening VSCode from external terminal (prompt)? I tried launching VSCode from Anaconda Prompt:
When I call my workspace inside the new VSCode, pylint complains no more about missing members 😮 |
Hurray it worked 🥳 Yes, you should be launching VS Code from the Anaconda prompt. On our side we should make it more explicit in the docs (microsoft/vscode-docs#3481), and we will work towards telling users directly while in the extension as well (#10626). You are more than welcome to upvote these 2 issues to bump up their visibility and priority. Using Closing in favour of microsoft/vscode-docs#3481 and #10626. Thank you for your patience! |
Thank you for all your time and support, otherwise I'd not ever realize that problem. I'm going to support those issues. |
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): Jedipython.languageServer
setting: MicrosoftExpected behaviour
If I set argument
"python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"]
, the linter should look up members in thecv2
module.Actual behaviour
Steps to reproduce:
cv2
in VSCode.Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)This was originally posted as a pylint issue but they diverted me here. It is really weird that running the same exe (I hope) with the same arguments results in different outputs. My terminal is set to Anaconda Prompt in the workspace.
Similar issues I found: #99, #606, #1648, #1993, #2879, #3562, #3802, #5257
The text was updated successfully, but these errors were encountered: