536 questions
1
vote
1
answer
383
views
Pylance missing imports with DevContainers
I have the following folder structure
C:.
│ docker-compose.yml
│ Dockerfile
│
├───.devcontainer
│ devcontainer.json
│
└───app
__init__.py
main.py
sub.py
Dockerfile
...
3
votes
2
answers
308
views
How do define custom auto-imports for Pylance/Visual Studio Code?
When I type out something like np. I think this triggers Visual Studio Code + Pylance's (not sure) auto-import completion by suggesting that import numpy as np might be relevant.
I would like to ...
4
votes
0
answers
462
views
VSCode quick fix does not suggest imports from a Python package in the same workspace
Overview
I have a VSCode workspace which contains two directories. In one is my main application, in another is a common package used by this application and a couple of others.
# main-app.code-...
0
votes
2
answers
265
views
some python modules cannot be recognized by pylance in vscode
I have installed a python module from source with the following command
cd /path/to/ligpargen
pip install -e . --config-settings editable_mode=strict
According to this it should be the right way to ...
-1
votes
1
answer
218
views
Pylance in vsCode not activated
So I have a new installation of VSCode 1.91.1 in Win10, and installed Python and Pylance, but it's not highlighting thing like variables.
I checked my settings.json and all it has is this!
{
&...
2
votes
0
answers
129
views
PyLance Auto-Completion with Docker
I'm using PyLance in Visual Studio Code to work on a Dockerized Python project, and there are certain dependencies that is very complex to be built on MacOS, so I dockerized the project and now it ...
1
vote
0
answers
500
views
Report missing import errors in VSCODE
Im properly importing classes from main program but still getting error as Import "Book" could not resolved by pylance(report missing imports). how to solve it in VSCODE?
tried by adjusting ...
1
vote
1
answer
358
views
Why does Visual Studio Code/Python not show the docstring for functions from my PyPI package?
I have recently created my own PyPI package with a bunch of useful functions. It works great, and when I import it in any project, the functions work, but my Visual Studio Code doesn't show the ...
2
votes
1
answer
722
views
VSCode shows imported function as not defined, but the script runs correctly
I'm trying to import functions located in a Python file outside of my Visual Studio Code workspace. Let’s say my structure is:
folder/
├── workspace/
│ └── main.py
│
└── python_scripts/
└─...
2
votes
1
answer
1k
views
How to setup VS Code Pylance Intellisense with Bazel Python toolchain and detect requirements and PYTHONPATH used for Bazel rules?
I'm working on creating a Bazel Python project in VS Code, my project tree looks like:
root
scripts/main.py
src/packageA/stuff.py
Imagine src might have several packages but I'm trying to be concise!...
1
vote
3
answers
151
views
Import "module" could not be resolved (With a library I created on PyPI)
I created the library to simplify a work-related problem.
I followed the step-by-step process and successfully created the library. I used pip install on my machine (without virtual environments), and ...
0
votes
1
answer
280
views
How to find type of a Python variable when hovering the mouse cursor over a variable in Visual Studio Code?
I want to find out its type when hovering over a variable with the mouse, but this does not work. Does anyone know how to do this? For example, when hovering over x, it writes some kind of Literal, ...
0
votes
1
answer
105
views
Ensuring VSCode Python Autocompletion
How can I ensure that when I instantiate a data structure in VSCode+Jupyter+Python, the attributes of the data structure are available for autocompletion throughout the notebook.
# %% Jupyter Cell #1
...
5
votes
3
answers
4k
views
How to solve Pylance crashing in VS Code?
The following message keeps appearing when I use VS code:
Pylance has crashed. Would you like to try using a Node.js executable to run the language server?
I wanted to solve the problem so I clicked ...
0
votes
1
answer
180
views
Why doesn't parameter hint highlighting work in VS Code while unpacking Python class objects?
I've encountered a problem with argument highlighting while unpacking a class into a function: Python can't figure out amount of arguments I want to provide while unpacking a class
Let's say we have a ...
2
votes
0
answers
3k
views
Why are stub files not created while using Pylance?
While using Python, I have my Pylance settings set to "strict", which causes it to detect missing stub files and cause an error when there is no stub file present for an import. When going ...
0
votes
1
answer
358
views
Python: VSCode does not show docstring for inherited exceptions
class CustomNamedException(Exception):
"""Example docstring here."""
def __init__(self, name) -> None:
self._name = name
def __str__(self):
...
2
votes
2
answers
3k
views
VSCode not resolving installed python dependencies
I have a python project for which I have activated a virtualenv and installed everything in requirements.txt.
This has been done manually through
python -m venv /path/to/new/virtual/environment
and
...
1
vote
1
answer
215
views
Pylance in Visual Studio Code not detecting Pandas (already installed)
I'm encountering an issue with Pylance, the language server for Python in Visual Studio Code. Despite having the pandas module installed in my Python environment, Pylance is reporting
Import "...
0
votes
0
answers
99
views
How can I extract the deprecated def using pyrightconfig.json with Visual Studio Code's Pylance?
I'm currently trying to detect deprecated defs in Visual Studio Code's Pylance, as shown in the article below.
How can I make VS Code treat usage of deprecated things in Python code as Problems?
I set ...
1
vote
2
answers
180
views
pylance giving false negative import error in vscode
I succesfully connect jupyter notebook in external server linux in my organization http://100.96.0.29:8888/?token=... through vscode in my laptop windows.
I also succesfully installed some ...
0
votes
0
answers
208
views
Python Debugger No Longer Running in Old Scripts in VS Code
As said in the title, my Python Debugger in visual studio seems to only be working on new scripts I create. I must have accidentally updated something or changed a setting earlier since I got the ...
0
votes
0
answers
45
views
VSCode: "matplotlib" is not accessedPylance on Mac
When importing any module (matplotlib, geopandas, numpy, pysal, etc.) I get the message of "matplotlib" is not accessed Pylance
I have read other posts saying you need to direct VSCode to ...
0
votes
0
answers
24
views
PyQT5 Window not opening [duplicate]
When trying to finish my optimization program , the pyQT5 window isnt opening !!. Please Help
Here is my code
Did i maybe call the window wrong or smth ?
**ERROR MESSAGE : QWidget: Must construct a ...
1
vote
1
answer
112
views
Is there a way for static analyzers (e.g. VS Code Intellisense) to recognize classes created through class factories?
I have the following code.
from abc import ABC, abstractmethod
from typing import *
class ExampleClass(ABC):
@abstractmethod
def get(self):
pass
def class_factory(s: str) -> Type[...