0

I am still a beginner in Python.
I use Jupyter Notebook and want to import XlsxWriter, but it doesnt seem to work.

This is what I do in the Notebook which i usually open through the pycharm terminal:

import numpy as np
import pandas as pd

import sys
!{sys.executable} -m pip install --user XlsxWriter

import XlsxWriter

However i get the following error message:

Requirement already satisfied: XlsxWriter in c:\users\rober\appdata\local\programs\python\python310\lib\site-packages (3.0.3)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [8], in <cell line: 6>()
      3 import sys
      4 get_ipython().system('{sys.executable} -m pip install --user XlsxWriter')
----> 6 import XlsxWriter

ModuleNotFoundError: No module named 'XlsxWriter' 

Does anyone have an idea what is the problem here? A simple Script using XlsxWriter in PyCharm works perfectly fine.

  • @It_is_Chris Thanks for your Answer. I only have one Python version installed 3.10.4. The XlsxWriter install i did in the terminal as well as in the notebook (after it didnt work with the terminal) – ForeverNewbie May 17 '22 at 15:05
  • 1
    Sorry, I just realized that you have the wrong case on the import . . . it is `import xlsxwriter` not `import XlsxWriter` Case matters for imports – It_is_Chris May 17 '22 at 15:06
  • @It_is_Chris omg.. how coul i make such a mistake. Thank you alot !! – ForeverNewbie May 17 '22 at 15:56

1 Answers1

1

you need to install xlsxwriter first

pip install xlsxwriter

ref : https://bobbyhadz.com/blog/python-no-module-named-xlsxwriter