BUG: read_excel failing to check older xlrd versions properly 
State: closed

- [ ] closes #38955
- [ ] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry

Probably should be in 1.2.1 given that this occurred after the deprecation of the xlrd engine in 1.2. 
cc @rhshadrach 


Labels:
name: Regression
description: Functionality that used to work in a prior pandas version
name: IO Excel
description: read_excel, to_excel

Comments:
Hello @lithomas1! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:











There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2021-01-31 02:25:23 UTC
@lithomas1 I think we still want to use LooseVersion, can apply it to the result of `_get_version`. 
pre-commit failing

```
pandas/io/excel/_base.py:5:1: F401 'distutils.version.LooseVersion' imported but unused
pandas/tests/io/excel/__init__.py:1:1: F401 'distutils.version.LooseVersion' imported but unused
```
@lithomas1 can you merge master and update
@lithomas1 Can also remove `"_get_version"` from scripts/validate_unwatned_patterns.py
thanks @lithomas1 
@meeseeksdev backport 1.2.x
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
$ git checkout 1.2.x
$ git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
$ git cherry-pick -m1 ddbf3771db13d927bb6d862e10c08b1c14e8d005
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
$ git commit -am 'Backport PR #39355: BUG: read_excel failing to check older xlrd versions properly '
```

4. Push to a named branch :

```
git push YOURFORK 1.2.x:auto-backport-of-pr-39355-on-1.2.x
```

5. Create a PR against branch 1.2.x, I would have named this PR:

> "Backport PR #39355 on branch 1.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
hmm this is not backporting cleanly, @lithomas1 can you follow the instructions above and put up a PR
I ran into this bug on pandas-2.1

without xlrd present no problem; but when installed, excel file is not loaded:

>
    In [5]: df_ref=pd.read_excel(refprots, engine="openpyxl", na_values =[''])
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    Cell In[5], line 1
    ----> 1 df_ref=pd.read_excel(refprots, engine="openpyxl", na_values =[''])
    
      ImportError: Can't determine version for xlrd
    
    In [6]: df_ref=pd.read_excel(refprots, na_values =[''])
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    Cell In[6], line 1
    ----> 1 df_ref=pd.read_excel(refprots, na_values =[''])
    
      ImportError: Can't determine version for xlrd
    
    In [7]: import xlrd
    
    In [8]: xlrd.__version__
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    Cell In[8], line 1
    1 xlrd.__version__
    
    AttributeError: module 'xlrd' has no attribute '__version__'
    
    In [9]: xlrd.__VERSION__
    Out[9]: '1.1.0'
    
    In [10]: pd.__version__
    Out[10]: '2.1.4'
@brobr - can you raise this as a new issue