Python: Pandas pd.read_excel giving ImportError: set xlrd> = 0.9.0 to support Excel

I try to read .xlsx with pandas but I get the following error:

 data = pd.read_excel(low_memory=False, io="DataAnalysis1/temp1.xlsx").fillna(value=0) Traceback (most recent call last): File "/Users/Vineeth/PycharmProjects/DataAnalysis1/try1.py", line 9, in <module> data = pd.read_excel(low_memory=False, io="DataAnalysis1/temp1.xlsx").fillna(value=0) File "/Users/Vineeth/venv/lib/python2.7/site-packages/pandas/util/_decorators.py", line 118, in wrapper return func(*args, **kwargs) File "/Users/Vineeth/venv/lib/python2.7/site-packages/pandas/io/excel.py", line 230, in read_excel io = ExcelFile(io, engine=engine) File "/Users/Vineeth/venv/lib/python2.7/site-packages/pandas/io/excel.py", line 263, in __init__ raise ImportError(err_msg) ImportError: Install xlrd >= 0.9.0 for Excel support 

I also tried

 data = pd.read_excel("DataAnalysis1/temp1.xlsx", low_memory=False).fillna(value=0) 

And I still get the same error.

Reference Information. I am trying to extract an excel file with multiple worksheets as a data file. I installed xlrd version 0.9.0 and latest version (1.1.0), but I still get the same error. Thanks!

+37
source share
12 answers

As @COLDSPEED so eloquently pointed out, the error explicitly tells you to install xlrd.

 pip install xlrd 

And you will be fine.

+63
source

Or use:

  pip install xlrd 

And if you use conda, use

  conda install -c anaconda xlrd 

It. good luck.

+12
source

I got the error message "ImportError: Set xlrd> = 1.0.0 for Excel support" in Pycharm for the code below

 import pandas as pd df2 = pd.read_excel("data.xlsx") print(df2.head(3)) print(df2.tail(3)) 

Solution: pip install xlrd

Bug fixed after using this. Also no need to use "import xlrd"

+2
source

I don’t know if this will be useful to anyone, but I had the same problem. I wrote pip install xlrd at the anaconda prompt while in a specific environment, and he said that it was installed, but when I looked at the installed packages, it was not there. What solved the problem was “moving” (I don’t know the terminology for this) to the Scripts folder of a particular environment and executing pip install xlrd . I hope this is useful to someone: D

+1
source

Got an error when I used Jupyter.

 ModuleNotFoundError: No module named 'xlrd' ... ImportError: Install xlrd >= 0.9.0 for Excel support 

This was decided for me after use.

 !pip install xlrd 
+1
source

I ran into the same problem and took 2 hours to figure this out.

  1. pip install xlrd (latest version)
  2. pip install pandas (latest version)
  3. Go to C: \ Python27 \ Lib \ site-packages and check the xlrd folder (if there are 2), uninstall the old version
  4. open a new terminal and use pandas to read Excel. It should work.
+1
source

This happened to me after I ran the script with cProfile a la python3 -m cProfile script.py , although xlrd was already installed and never made this error before. it persisted even with python3 script.py . (Of course, I agree that this did not happen with the OP, given the obvious import error)

However, for cases like mine, the next fix is ​​for the problem, even though it was said that “the requirement has already been met” in each case.

 pip install --upgrade pandas pip install --upgrade xlrd 

Pretty confusion; not sure if cProfile was the cause or just a coincidence

The following should work, assuming your pip install running on python2.

 python3 -m pip install xlrd 
0
source

First of all, you need to install the xlrd and pandas packages. Then try the code below.

 import xlrd import pandas as pd xl = pd.ExcelFile("fileName.xlsx") print(xl.parse(xl.sheet_names[0])) 
0
source

You need to install the "xlrd" lib

For Linux (Ubuntu and Derivatives):

Installing via pip: python -m pip install --user xlrd

Install the whole system through the Linux package manager: * sudo apt-get install python-xlrd

Window:

Installation through pip: * pip install xlrd

Download files: https://pypi.org/project/xlrd/

0
source

Another possibility is that an older version of xlrd is installed separately on the machine, and it is not in the "..: \ Python27 \ Scripts .." folder.

In other words, there are 2 different versions of xlrd in the machine.

enter image description here

when you check the version below, it reads the one that is not in the "..: \ Python27 \ Scripts .." folder, regardless of how updated you made using pip.

 print xlrd.__version__ 

Delete all redundant subfolder and it works. (in addition to xlrd, I had another library meeting the same thing)

0
source

I ran into a similar problem trying to use xlrd in a jupyter laptop. I noticed that you are using a virtual environment, and that was the key to my problem. I had xlrd installed in my venv, but I did not correctly install the kernel for this virtual environment on my laptop.

To make it work, I created my virtual environment and activated it.

Then ... pip install ipykernel

And then ... ipython kernel install --user --name=myproject

Finally, run jupyter notepads and when creating a new notepad, select the name you created (in this example "myproject")

Hope this helps.

0
source

Please make sure your python or python3 can see the xlrd installation. I had a situation where python3.5 and python3.7 were installed in two different places. Although xlrd was installed with python3.5, I used python3 (from the python3.7 directory) to run my script and got the same error that was reported above. When I used the correct python (i.e. python3.5 dir) to run my script, I was able to read the Excel spreadsheet without any problems.

0
source

Source: https://habr.com/ru/post/1274449/


All Articles