I'd ensure all your packages are up to date first; openpyxl and pillow.

Prima facie it would appear that pillow isn't installed If you add the line after the openpyxl import

print(openpyxl.drawing.image.PILImage)

it should return the path where the PIL package resides. If it returns False then openpyxl is not finding it.

Also I'd expect you will get an error on line

img.anchor('A1')

the correct syntax is

img.anchor = 'A1'

see openpyxl docs openpyxl.drawing.image module

Answer from moken on Stack Overflow
🌐
openpyxl
openpyxl.readthedocs.io › en › stable › _modules › openpyxl › drawing › image.html
openpyxl.drawing.image — openpyxl 3.1.3 documentation
Navigation · index · modules · openpyxl 3.1.3 documentation » · Module code » · openpyxl.drawing.image · Source code for openpyxl.drawing.image · # Copyright (c) 2010-2024 openpyxl from io import BytesIO try: from PIL import Image as PILImage except ImportError: PILImage = False def ...
Discussions

Python cannot import openpyxl - Stack Overflow
I am running Windows 7 and using Python 2.7. I have installed openpyxl using easy_install. It looks like the installation was successful. I changed the directory and fired up Python. >>... More on stackoverflow.com
🌐 stackoverflow.com
ImportError: cannot import name 'coordinate_from_string' from 'openpyxl.utils'
Hi , I'm using : Python : 3.7 openpyxl : 2.6.2 (Last Stable) d6tstack : 0.1.8 Traceback (most recent call last): File "/home/kedf/PycharmProjects/XLStoSQL/xlsxtosql.py", line 1, in &l... More on github.com
🌐 github.com
2
April 2, 2019
python - error> cannot import name 'load_workbook' from partially initialized module 'openpyxl' - Stack Overflow
I am trying to do 'pd.read excel' but one file can be opened but newly imported file from other folder can not be opened with error like below. For reference, same format of excel file (xls) Error More on stackoverflow.com
🌐 stackoverflow.com
python - Cannot import openpyxl properly - Stack Overflow
Hey so I'm quite new to programming. When I try to import openpyxl module to Python I get the error: Traceback (most recent call last): File "X:\*filepath*\*filename*.py", line 2, in More on stackoverflow.com
🌐 stackoverflow.com
🌐
Stack Overflow
stackoverflow.com › questions › 50147459 › name-openpyxl-not-defined-error › 50148114
python - name 'openpyxl' not defined error - Stack Overflow
Also, look at the openpyxl.utils module for a converter between numeric and alphabetic columns. ... Save this answer. ... Show activity on this post. You only import ''Workbook'' sub-module from openpyxel. Try: Copyfrom openpyxel import Workbook, drawing # also import drawing namespace [...] sheet.add_image(drawing.image.Image('square_blue.jpg'), colnum_string(col)+str(row)) [...]
🌐
GitHub
github.com › d6t › d6tstack › issues › 13
ImportError: cannot import name 'coordinate_from_string' from 'openpyxl.utils' · Issue #13 · d6t/d6tstack
April 2, 2019 - Traceback (most recent call last): File "/home/kedf/PycharmProjects/XLStoSQL/xlsxtosql.py", line 1, in <module> import d6tstack.convert_xls File "/usr/local/lib/python3.7/site-packages/d6tstack/convert_xls.py", line 12, in <module> from openpyxl.utils import coordinate_from_string ImportError: cannot import name 'coordinate_from_string' from 'openpyxl.utils' (/usr/local/lib/python3.7/site-packages/openpyxl/utils/__init__.py)
Author: d6t
🌐
Google Groups
groups.google.com › g › openpyxl-users › c › eeg61OxZpAk
ImportError: cannot import name 'Workbook'
July 23, 2017 - This may be due to the name you have put in your file, I'm not sure which one you chose, but if you chose openpyxl.py thats a poor choice. This may seem obvious... but don't name your file openpyxl.py Otherwise the it will try to load the file not the module...
🌐
Stack Overflow
stackoverflow.com › questions › 70058892 › cannot-import-openpyxl-properly
python - Cannot import openpyxl properly - Stack Overflow
Hey so I'm quite new to programming. When I try to import openpyxl module to Python I get the error: Traceback (most recent call last): File "X:\*filepath*\*filename*.py", line 2, in
Find elsewhere
🌐
GitHub
github.com › pyinstaller › pyinstaller › issues › 2383
openpyxl causing import error · Issue #2383 · pyinstaller/pyinstaller
January 15, 2017 - Description The import error is caused by the following line in openpyxl.packaging.extended: from openpyxl import __version__ The error: ImportError: cannot import name '__version__' Workaround: Editing openpyxl/packaging/extended.py, re...
Author: pyinstaller
🌐
Plus2Net
plus2net.com › python › openpyxl.php
openpyxl to read and write data add image chart to Excel file in Python
February 5, 2019 - import openpyxl print(openpyxl.__version__) To upgrade the openpyxl library to current version.
🌐
GitHub
github.com › python-pillow › Pillow › issues › 2108
ImportError: cannot import name Image · Issue #2108 · python-pillow/Pillow
September 14, 2016 - What did you do? pip install 'Pillow==3.3.1' from PIL import Image What did you expect to happen? What actually happened? ImportError: cannot import name Image What versions of Pillow and Python are you using? Pillow==3.3.1 Python==2.7.1...
Author: python-pillow
🌐
Reddit
reddit.com › r/learnpython › trying to import openpyxl but error occurs
r/learnpython on Reddit: Trying to import openpyxl but error occurs
June 17, 2022 -

I am trying to install openpyxl in pycharm using pip install openpyxl, however when I import the openpyxl module, an error occurs.

I am using Pycharm on Ubuntu tho.

What I typed in terminal to install openpyxl:

pip install openpyxl

What returned:

Traceback (most recent call last):
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/bin/pip", line 7, in <module>
    from pip._internal.cli.main import main
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/configuration.py", line 26, in <module>
    from pip._internal.utils.logging import getLogger
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 13, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 40, in <module>
    from pip._internal.locations import get_major_minor_version, site_packages, user_site
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
    from . import _distutils, _sysconfig
  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/venv/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
    from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'

And here's my code:

import openpyxl as xl

wb = xl.load_workbook('translations.xlsx')
sheet = wb['Sheet1']
cell = sheet['a1']

print(cell)

and this is what comes when it runs:

  File "/home/sheikhmugees/PycharmProjects/Python with Mosh/main.py", line 1, in <module>
    import openpyxl as xl
ModuleNotFoundError: No module named 'openpyxl'
🌐
Stack Overflow
stackoverflow.com › questions › 69136679 › why-am-i-getting-importerror-cannot-import-name-piechart-from-openpyxl
python - Why am i getting ImportError: cannot import name 'PieChart' from 'openpyxl' - Stack Overflow
What you’re doing wrong is (at least) not reading the documentation openpyxl.readthedocs.io/en/stable/charts/pie.html you’ll see PieChart isn’t in openpyxl it’s in openpyxl.chart · DisappointedByUnaccountableMod – DisappointedByUnaccountableMod · 2021-09-10 18:40:45 +00:00 Commented Sep 10, 2021 at 18:40 ... Sign up to request clarification or add additional context in comments. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... 767 What can I do about "ImportError: Cannot import name X" or "AttributeError: ...
🌐
OpenPyXL
openpyxl.readthedocs.io › en › 2.5.14 › _modules › openpyxl › cell › cell.html
openpyxl.cell.cell — openpyxl 2.5.14 documentation
""" __slots__ = ( 'row', 'col_idx', '_value', 'data_type', 'parent', '_hyperlink', '_comment', ) ERROR_CODES = ERROR_CODES TYPE_STRING = 's' TYPE_FORMULA = 'f' TYPE_NUMERIC = 'n' TYPE_BOOL = 'b' TYPE_NULL = 'n' TYPE_INLINE = 'inlineStr' TYPE_ERROR = 'e' TYPE_FORMULA_CACHE_STRING = 'str' VALID_TYPES = (TYPE_STRING, TYPE_FORMULA, TYPE_NUMERIC, TYPE_BOOL, TYPE_NULL, TYPE_INLINE, TYPE_ERROR, TYPE_FORMULA_CACHE_STRING) def __init__(self, worksheet, column=None, row=None, value=None, col_idx=None, style_array=None): super(Cell, self).__init__(worksheet, style_array) self.row = row """Row number of t
🌐
Python.org
discuss.python.org › python help
Hello. I don't understand the problem here, it is related to "openpyxl" - Python Help - Discussions on Python.org
January 6, 2024 - Hello, I am getting the following error in my code even though I downloaded the library. Traceback (most recent call last): File “C:\Users\Oyuncu\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\compat_optional.py”, line 132, in import_optional_dependency module = ...
🌐
Stack Overflow
stackoverflow.com › questions › 25665529 › import-error-for-openpyxl
python - Import error for openpyxl - Stack Overflow
April 27, 2017 - Okay so pip and easy_install are simple ways of installing python libraries, but you have to have them installed I'm assuming you don't at the moment. To install a library without them just go to the directory where you unzipped your openpyxl.
🌐
GitHub
github.com › jazzband › tablib › issues › 457
ImportError: cannot import name 'ExcelReader' from 'openpyxl.reader.excel' · Issue #457 · jazzband/tablib
February 16, 2020 - tablib [required: >=0.11.4, installed: 1.1.0] Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] Traceback (most recent call last): File ".\oneforall.py&q...
Author: jazzband