so after going through everything, python versions, jdk versions etc. I finally found the solution. All thanks to @samkart, for providing the link for the similar question. there I got to know that it works with python 3.11.8 and I gave it a try and it works now. In browser as well as in vscode.
Thanks man