Python

How to fix Modulenotfounderror : No module named xlsxwriter error in Python ?

We can fix the No module named xlsxwriter error by reinstalling the xlsxwriter module. Sometimes this error generates because of incompatibility. In case of incompatibility versioning, We need to remove/ uninstall the xlsxwriter module and reinstall the compatible version of it. In this article, we will explore various methods to fix this error.

 

Modulenotfounderror : No module named xlsxwriter –

Let’s see different ways of installing the xlsxwriter module. The successful installation for xlsxwriter, will automatically fix this error.

Method 1: Using pip to install xlsxwriter –

Firstly, We will cover the most adapted way. That is pip package manager. Simply we need to run the below command.

Modulenotfounderror No module named xlsxwriter

For Windows-

pip install xlsxwriter

For Linux-

sudo pip install xlsxwriter

Sudo provides admin rights in Linux-based OS. Also of windows is asking for admin rights while using the above command. Then we need to open the cmd as administrator.

No module named xlsxwriter

 

Method 2: Using easy_install to install xlsxwriter –

We can also use easy_install package manager in place of pip as in the above section. Please refer to the below easy_install statement for fixing the bug.

easy_install xlsxwriter

 

Method 3: Using Souce Code to install xlsxwriter –

Here, We will use the source code for installation. We can use git tool with the below commands.

$ git clone https://github.com/jmcnamara/XlsxWriter.git
$ cd XlsxWriter
$ python setup.py install

If we do want to use the git tool, We can use the only terminal with CURL command. Let’s see how can we do the installation using CURL.

$ curl -O -L http://github.com/jmcnamara/XlsxWriter/archive/master.tar.gz
$ tar zxvf master.tar.gz
$ cd XlsxWriter-master/
$ python setup.py install

It will use the master branch which contains the most stable code in the repository. CURL will basically download the tar file from the URL. Then it will untar it and change the directory to call the setup.py install command.

 

Conclusion –

No module named xlsxwriter error is very common. We can easily fix this error by following any of the above methods. Still if you are stuck and not able to fix this error, please comment below in the comment box. Data Science Learner Team must help you.

Similar Articles :

modulenotfounderror: no module named ‘transformers’ ( Solved )

Importerror no module named typing : Tricks to Fix

Importerror no module named simple_salesforce : Tricks to Fix

 

Thanks

Data Science Learner Team