pythonpycharmopenpyxl

Cannot install openpyxl


When I attempt to run my python code, I get this error message

ImportError: Missing optional dependency 'openpyxl'.  Use pip or conda to install openpyxl.

So I try to install openpvxl

pip install --upgrade openpyxl         
WARNING: Ignoring invalid distribution -orch (d:\anaconda\lib\site-packages)
Requirement already satisfied: openpyxl in d:\anaconda\lib\site-packages (3.1.2)
Requirement already satisfied: et-xmlfile in d:\anaconda\lib\site-packages (from openpyxl) (1.1.0)
WARNING: Ignoring invalid distribution -orch (d:\anaconda\lib\site-packages)

This makes no difference, I still get the same error message.

I am using PyCharm and Python files.


Solution

  • Your PyCharm probably sees another environment from the one that pip installs your libraries in. You can try downloading the library from PyCharm settings:

    1. File -> Settings
    2. then, Project: -> Python Interpreter
    3. Click a '+' sign to the right,
    4. Search for the openpyxl library,
    5. and finally, press 'Install Package'.