I am using VSCode to write some SageMath code in a Jupyter notebook. Everything works fine and I can run my code but Pylance underlines all Sage imports and reports them as missing
I have tried adding the path (/Applications/SageMath-9-8.app/Contents/Frameworks/Sage.framework/Versions/9.8/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages
) in Python > Analysis: Extra Paths
(which worked for python's auto-complete support) but it didn't work in this case. I am aware that I can stop Pylance from reporting missing imports altogether but this is not what I want.
Thanks for your question, because it helped me find where sagemath was hiding its site-packages file.
Building on this pylance issue on github, I ended up adding the magic words from sage.all import *
to the top of my .sage
file, and then Pylance suddenly started being happy with sage builtins.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With