1

I'm using Python 3.7 and I recently upgraded to Spyder 4.2.0 from Spyder 4.1.5. Now when I run my code (which was working fine before) I get the following error:

ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

So apparently Spyder thinks 'xlrd' ('Excel Reader'?) is not installed. So I went to the Anaconda prompt and tried pip install xlrd, but it replied with

Requirement already satisfied: xlrd in c:\users\michael\anaconda3\lib\site-packages (2.0.1)

I tried uninstalling and reinstalling xlrd anyways, using pip, but it didn't change anything. How do I resolve this error?

Also, I'm not sure if this matters or not, but I originally installed Spyder via Anaconda, whereas now I just downloaded Spyder 4.2.0 by itself, through this link: https://github.com/spyder-ide/spyder/releases.

Also, on the linked github page, it says: "If you are new to Python or the Scientific Python ecosystem, we strongly recommend you to install and use Anaconda. It comes with Spyder and all its dependencies, along with the most important Python scientific libraries (i.e. Numpy, Pandas, Matplotlib, IPython, etc) in a single, easy to use environment."

I had at first assumed this was meant for people downloading Python/Anaconda for the very first time, but now I'm thinking this applies to a semi newbie at Python such as me? As someone who is not very familiar with how packages and dependencies work, should I be downloading Anaconda every time I want to update Python or Spyder?

Apologies for the (probably) silly newbie question...

Leonidas
  • 613
  • 1
  • 6
  • 23
  • 1
    Update: Reading the Github page further, it suggests the command "conda install spyder=4.2.0" into the Anaconda command prompt (for people who already have anaconda installed). I tried this and my issue seems to be resolved! Though I would still be interested to hear further input or comments, if people have them. – Leonidas Dec 12 '20 at 19:14

1 Answers1

2

This sounds like you needed to re-start Spyder for it to pick up the package you installed.

However, as the author of xlrd, I would suggest you do the following:

  1. Stop Spyder
  2. conda install openpyxl
  3. Start Spyder.
  4. Change your pandas code to be pd.read_excel(..., engine='openpxyl')
Chris Withers
  • 10,837
  • 4
  • 33
  • 51