Cannot install openpyxl

Hi, I’m trying to install openpyxl from for a project with Excel files. I’ve typed pip install openpyxl in the terminal and installed it sucessfully. I have then import it with import openpyxl as xl. But when I run it I get the following error:

Traceback (most recent call last):
File “F:\backup.desktop\Bogdan\Python\automation”, line 3, in
import openpyxl as xl
ModuleNotFoundError: No module named ‘openpyxl’

Process finished with exit code 1

I checked the External Libraries\Python 3.10\ site packages, where it should be and indeed it’s not there. But if I try to install it again I get the following message on the terminal:

PS C:\Users\Ioana\PycharmProjects\pythonProject> pip install openpyxl
Requirement already satisfied: openpyxl in c:\users\ioana\appdata\local\programs\python\python310\lib\site-packages (3.0.10)
Requirement already satisfied: et-xmlfile in c:\users\ioana\appdata\local\programs\python\python310\lib\site-packages (from openpyxl) (1.1.0)

It says it’s already there. Any ideas?

Does the version of pip you are running match the version of python you are running?
Suggest you avoid using pip instead do this:

py -3 -m pip install openpyxl

Then try running your program.

Python is 3.10 and pip is 3.0.10

I have uninstalled the openpyxl and then instaleed it with your method. Still doesn’t work

That is a very old version of pip here is what I get when I using openpyxl.
You can see that it just works. Check that you see the versions that are like what I have.

: 18:00:25.83 C:\Users\barry> py -3
Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> impoer openpyxl
  File "<stdin>", line 1
    impoer openpyxl
SyntaxError: invalid syntax
>>> ^Z

: 18:00:42.67 C:\Users\barry> py -3 -m pip --version
pip 22.0.4 from C:\Program Files\Python310\lib\site-packages\pip (python 3.10)

: 18:00:48.94 C:\Users\barry> py -3 -m pip install --user openpyxl
Collecting openpyxl
  Downloading openpyxl-3.0.10-py2.py3-none-any.whl (242 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 242.1/242.1 KB 7.2 MB/s eta 0:00:00
Collecting et-xmlfile
  Downloading et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Installing collected packages: et-xmlfile, openpyxl
Successfully installed et-xmlfile-1.1.0 openpyxl-3.0.10
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command.

: 18:01:09.31 C:\Users\barry> py -3
Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl
>>> ^Z