Skip to content
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

Missing import from specified "python.analysis.extraPaths" in Notebook #3097

Closed
0nyr opened this issue Jul 25, 2022 · 3 comments
Closed

Missing import from specified "python.analysis.extraPaths" in Notebook #3097

0nyr opened this issue Jul 25, 2022 · 3 comments
Assignees
Labels
bug Something isn't working needs investigation Could be an issue - needs investigation notebooks waiting for user response Requires more information from user

Comments

@0nyr
Copy link

0nyr commented Jul 25, 2022

I have a Missing Import Error while importing a custom package inside a Notebook, despite specifying the path inside python.analysis.extraPaths.

Screenshot_from_2022-07-25_13-04-51

Environment data

  • Pylance v2022.7.40,

  • Pylance language server 2022.7.40 (pyright bd00e0d1)

  • Ubuntu 20.04.4 LTS

  • Python 3.10.5 using Conda

  • Conda 4.13.0

Code Snippet

Inside a Notebook:

import sys
sys.path.append("/home/onyr/missing_import_custom_package/src")

from src.test_package import TestObject
obj_1 = TestObject("HelloWorld")
obj_1.print_name()

Repro Steps

  1. Just download this repo where I have setup a custom example : 0nyr/pylance_issue_illustration_missing_import
  2. Create a conda venv.
  3. Load the notebook in VSCode and select the conda venv.
  4. You should see the MissingImport error.

Expected behavior

No import error. And type hinting.

Actual behavior

Missing Import error and no type hinting.

Logs

See https://github.com/0nyr/pylance_issue_illustration_missing_import/blob/main/python.log

@heejaechang
Copy link
Contributor

we don't support dynamic behavior like below.

import sys
sys.path.append("/home/onyr/missing_import_custom_package/src")

but, we should provide a way to add extraPath in notebook.

@heejaechang heejaechang added the bug Something isn't working label Jul 25, 2022
@judej judej added the needs decision Do we want this enhancement? label Jul 25, 2022
@debonte debonte added notebooks needs investigation Could be an issue - needs investigation and removed needs decision Do we want this enhancement? labels Sep 1, 2022
@debonte debonte self-assigned this Sep 6, 2022
@debonte
Copy link
Contributor

debonte commented Oct 18, 2022

This doesn't repro for me anymore. My guess is that you were hitting #3208.

extraPaths also appears to be working fine in notebooks, but is unnecessary in your sample.

@0nyr, can you upgrade to the latest Pylance and see if this is also fixed for you?

@debonte debonte added the waiting for user response Requires more information from user label Oct 18, 2022
@0nyr
Copy link
Author

0nyr commented Oct 19, 2022

Ok, I did new tests. I have no more problems.

Capture no more error

Thank you, you can close the issue.

@debonte debonte closed this as completed Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Could be an issue - needs investigation notebooks waiting for user response Requires more information from user
Projects
None yet
Development

No branches or pull requests

4 participants