Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues running python-docx on Macbook M1 #1077

Open
sndmnska opened this issue Apr 19, 2022 · 2 comments
Open

Issues running python-docx on Macbook M1 #1077

sndmnska opened this issue Apr 19, 2022 · 2 comments

Comments

@sndmnska
Copy link

sndmnska commented Apr 19, 2022

Hi there,

I'm pretty new to coding, and I'm using PyCharm Community version, Build 11.0.14.1+1-b2043.25 aarch64 for a class I'm taking on python. We've been directed to use this library for assignments. My main work/school/coding computer is a 2020 Macbook M1 with Apple Silicon.

Whenever I try to run any python-docx code using PyCharm after python-docx has been installed, including the simple request import docx, I get the error log below.

I have tried updating everything I could see mentioned, including lxml, _xmlFree, pip, even Python itself.... just to see if anything helped. Nothing seemed to.

My question is: Is this a known issue with running on MacBook M1? I dug out my other old Macbook (Intel) and python-docx worked just fine. Is there a workaround for the newer silicon architecture?

Thanks for your time. Sorry if this post happens to be in the wrong place. Again, I'm new at this, but am thoroughly enjoying getting into programming.

Traceback (most recent call last):
  File "/Users/[username]/PycharmProjects/week12_word_excel/word_doc_read.py", line 1, in <module>
    import docx
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/__init__.py", line 3, in <module>
    from docx.api import Document  # noqa
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/api.py", line 14, in <module>
    from docx.package import Package
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/package.py", line 9, in <module>
    from docx.opc.package import OpcPackage
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/opc/package.py", line 9, in <module>
    from docx.opc.part import PartFactory
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/opc/part.py", line 12, in <module>
    from .oxml import serialize_part_xml
  File "/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/docx/opc/oxml.py", line 12, in <module>
    from lxml import etree
ImportError: dlopen(/Users/[username]/PycharmProjects/week12_word_excel/venv/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_xmlFree'

@ReneKriest
Copy link

ReneKriest commented May 5, 2022

I am running into the same issue. This seems lxml specific, as docx depends on it. Folks also have trouble getting lxml running on Macs with M1: eerohele/sublime-lxml#11

@sayebms1
Copy link

sayebms1 commented Aug 5, 2022

I am also having trouble getting lxml work on my M1 MacBook Air. I am using it with Beautiful soup package to remove html tags and I get an feature not fund error: FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants