Skip to content

Pyright 1.1.405 cannot resolve extension module symlinked to virtualenv #10906

@vlaci

Description

@vlaci

Describe the bug

We have a virtualenv composed of symlinked packages (using uv2nix but that's irrelevant). After upgrading from 1.1.404 to 1.1.405 a package import is no longer recognized. It looks like, symlinking files is the issues, symlinked code directories work fine.

Code or Screenshots

  • Using cpp_demangle as an example. This package puts its extension immediately under site-packages (.venv/lib/python3.11/site-packages/cpp_demangle.cpython-311-x86_64-linux-gnu.so in my case). Also using pyright 1.1.404, as the last working version:
python3 --version
Python 3.11.13python3 -m venv .venvsource .venv/bin/activatepip install cpp_demangle pyright==1.1.404
Collecting cpp_demangle
  Using cached cpp_demangle-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.7 kB)
Collecting pyright==1.1.404
  Using cached pyright-1.1.404-py3-none-any.whl.metadata (6.6 kB)
[...]echo "import cpp_demangle" > test.py
  • pyright works as expected:
pyright test.py
WARNING: there is a new pyright version available (v1.1.404 -> v1.1.405).
Please install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`

0 errors, 0 warnings, 0 informations
  • moving the extension module out and symlinking it back, no error with 1.1.404
mv .venv/lib/python3.11/site-packages/cpp_demangle.cpython-311-x86_64-linux-gnu.so /tmp/ln -s /tmp/cpp_demangle.cpython-311-x86_64-linux-gnu.so .venv/lib/python3.11/site-packages/pyright test.py
WARNING: there is a new pyright version available (v1.1.404 -> v1.1.405).
Please install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`

0 errors, 0 warnings, 0 informations
  • error is here after updating pyright
pip install -U pyright==1.1.405
Collecting pyright==1.1.405
  Using cached pyright-1.1.405-py3-none-any.whl.metadata (6.6 kB)
[...]
Successfully installed pyright-1.1.405pyright test.py
/tmp/tmp.1zKCH7jPWl/test.py
  /tmp/tmp.1zKCH7jPWl/test.py:1:8 - error: Import "cpp_demangle" could not be resolved (reportMissingImports)
1 error, 0 warnings, 0 informations
  • moving back the library, error goes away on 1.1.405
rm .venv/lib/python3.11/site-packages/cpp_demangle.cpython-311-x86_64-linux-gnu.somv /tmp/cpp_demangle.cpython-311-x86_64-linux-gnu.so  .venv/lib/python3.11/site-packagespyright test.py
0 errors, 0 warnings, 0 informations

Metadata

Metadata

Assignees

Labels

addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't workingregression

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions