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'
The text was updated successfully, but these errors were encountered:
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
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?
sndmnska commentedApr 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.
The text was updated successfully, but these errors were encountered: