[Browser] No module xlrd

Hello guys!

I´m using JupyterLab in the browser and I want to import an .xlsx file using pandas.
However, when I use

import pandas as pd
pd.read_excel(“filename.xlsx”)

I get:
ModuleNotFoundError: No module named ‘xlrd’
ImportError: Install xlrd >= 1.0.0 for Excel support

I have found suggestions that I should install some packages using pip … but I can´t do that online?

The interesting thing though is that when I use the same code for the same file in a Jupyter Notebook on Coursera (where I´ve taken a class) then it works. I tried JupyterLab and a Classic Notebook and it didn´t work in both. The file was in all cases imported into the file section of the notebook.

I´m not sure if this is the right forum for that but I hope you can help me :smiley:
Greetings,
Markus

You don’t actually say where you are running things other than in the browser online? If you continue to have issues after trying what I write below, you may want to discuss that.

Try in the notebook in a cell on its own, running the following code:

%pip install xlrd

It may give a warning that you need to restart the kernel. Just try running your code first. If it doesn’t work, then try restarting the kernel and try again.

Your code works on Coursera because they’ve set up the environment you get to have xlrd already installed. It isn’t anything trickier than that. There is an underlyiing computational environment to which Jupyter has access. That environment can be barebones or complex depending on how the original administrators set it up.

1 Like

It worked! Thank you so much!

1 Like