You installed pyserial in your Python39 environment. It's not there in your Python311 environment. So either you need to run your program in the Python39 environment or install pyserial in the Python311 environment.