Solving Pygame “No module called pygame.base” with Python

Pygame “No module called pygame.base” with Python is an error which occurs because of a faulty Pygame installation.

Today, I will explain why this error takes place and how to fix it, while also presenting the steps in detail and adding other solutions that could solve the error.

Exploring the Error : Pygame “No module called pygame.base” with Python

This is an error which occurs because of a faulty Pygame installation.

Beware of mixing between different errors. Please make sure you are dealing with the same error.

                                                                       #
ImportError: No module named 'pygame.base'
                                                                       #

Bellow is a number of tested solutions that I have tried and that have worked for me.

Solution 1 : Uninstall and then install pygame

Sometimes, the problem is not only with the way you install pygame but with Python itself.

This error can take place because you have the 32-bit version of python.

First, start by uninstalling the 32-bit version of python and installing the 64-bit version of python.

After that is done, you can choose to either jump to the next step and continue following the steps in order to install pygame.

If you do not want to clear the cache etc. You can just use pip3 to uninstall and then install pygame.

                                                                       #
pip3 uninstall pygame
                                                                       #

Finally, install pygame using pip3.

                                                                       #
pip3 install pygame
                                                                       #

Try the method bellow if this method does not do the job.

Solution 2 : Correctly install pygame

The error might occur sometimes when you try installing pygame using the .whl wheel file.

There are a few options which you can choose form in order to fix the issue.

The first method is to uninstall pygame using pip3, just like this

                                                                       #
pip3 uninstall pygame
                                                                       #

Then, you should use the command bellow to purge the cache.

                                                                       #
pip cache purge
                                                                       #

Now, you should install pygame using pip3 with the following command

                                                                       #
pip3 install pygame
                                                                       #

You can specify your version of pygame during the installation by using the command bellow

                                                                       #
pip3 install pygame==2.1.2
                                                                       #

In this example, I installed pygame 2.1.2 which is the latest version of pygame.

Thank you for reaching the end of this blog post. I hope the methods above guided you and you got rid of the problem.

Summing-up : 

This is the end of our article, I hope the solutions I presented worked for you and has solved the error : Pygame No module called pygame.base with Python , Learning Python is a fun journey, do not let the errors discourage you. Keep coding and cheers.

Thank you for reading my blog post to the end, If you want to learn more about the Python programming language, check out the official Python Documentation : https://docs.python.org/3/