I am unable to convert python file to wasm file. tried with emscripten and pyodide for conversion from python to wasm. But was unable to get the proper compilation packages. It's not clear to get to know the right package to be used rather than Emscripten and Pyodide. Also, pyodide package was the one which didn't get installed perfectly to do compilation.
So my question is like how to convert a python code to a wasm file? What are the compilers and compilation packages used for this conversion?
As far as this question is concerned, WASM can be seen as a target architecture. So a more general question would be how to convert Python to a binary executable, with a tool that supports WASM.
Pyodide builds the CPython interpreter that runs Python code, so it doesn't do a Python to WASM conversion. You can apply Cython to your code (or mypyc) convert Python to C, and then build it to WASM with the Pyodide build system (via Emscripten).
Overall though, the other question is why do you want to do this? Python is a rather complex dynamic language, and just taking Python code and compiling it generally doesn't yield huge performance improvements, without spending lots of time tuning e.g. cython types. And even if you compile your code, you still need to ship the CPython interpreter alongside it, so size-wise it's not smaller.
There are newer projects that aim to facilitate Python-like code to wasm (for instance spy) but it's still very much experimental, and it's a Python like language, not really Python.