Is it possible that because sympy-stubs does not have 'combinatorics/init.pyi', Pylance could not find the logical path sympy.combinatorics.Permutation?
In VSCode-insiders, Pylance was reporting Permutation and PermutationGroup could not be found with this statement:
from sympy.combinatorics import Permutation, PermutationGroup
I was three-times confused because 1) the SymPy documentation uses that logical path, 2) the installed package seemed to be re-exporting from that logical path (see __init__.py), and 3) my personally generated stubs for SymPy re-export on that path (see here; I didn't find sympy-stubs in this repo until today). So I used the following statements, which worked fine.
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.permutations import Permutation
But I was still confused, so I started poking around the stub files and the installed package files--while using VSCode to navigate and open the files. It seems that I somehow caused Pylance to stop using "%USERPROFILE%.vscode-insiders\extensions\ms-python.vscode-pylance-2025.8.100\dist\bundled\stubs\sympy-stubs\combinatorics..." and start using my stubs. Now, from sympy.combinatorics import Permutation works as expected.
I think that adds up to Pylance reporting it couldn't find from sympy.combinatorics import Permutation because the bundled stubs don't have __init__.pyi to re-export those symbols.
BUT, I could be completely wrong. There are a lot of moving parts in this system, and my knowledge is minuscule.
I know y'all aren't Pylance, but there is a non-zero chance this log could be useful to you.
Python Language Server.log
Is it possible that because
sympy-stubsdoes not have 'combinatorics/init.pyi', Pylance could not find the logical pathsympy.combinatorics.Permutation?In VSCode-insiders, Pylance was reporting
PermutationandPermutationGroupcould not be found with this statement:I was three-times confused because 1) the SymPy documentation uses that logical path, 2) the installed package seemed to be re-exporting from that logical path (see
__init__.py), and 3) my personally generated stubs for SymPy re-export on that path (see here; I didn't find sympy-stubs in this repo until today). So I used the following statements, which worked fine.But I was still confused, so I started poking around the stub files and the installed package files--while using VSCode to navigate and open the files. It seems that I somehow caused Pylance to stop using "%USERPROFILE%.vscode-insiders\extensions\ms-python.vscode-pylance-2025.8.100\dist\bundled\stubs\sympy-stubs\combinatorics..." and start using my stubs. Now,
from sympy.combinatorics import Permutationworks as expected.I think that adds up to Pylance reporting it couldn't find
from sympy.combinatorics import Permutationbecause the bundled stubs don't have__init__.pyito re-export those symbols.BUT, I could be completely wrong. There are a lot of moving parts in this system, and my knowledge is minuscule.
I know y'all aren't Pylance, but there is a non-zero chance this log could be useful to you.
Python Language Server.log