Fail: AttributeError: module 'collections' has no attribute 'Container'
Asked Answered
T

1

16

I try to start python-pptx, but I have Error:

AttributeError: module 'collections' has no attribute 'Container'
in File "...\lib\site-packages\pptx_init_.py", line 14 

Use Python 3.10, python-pptx (0.6.21), lxmx (4.6.3).

Thadthaddaus answered 6/10, 2021 at 14:59 Comment(1)
Please include the full stack trace.Nika
N
31

It's a known issue for Python 3.10 as discussed in this issue. The workaround is to import both modules collections and collections.abc before importing pptx. For example:

import collections 
import collections.abc
from pptx import Presentation

This should resolve this error

Neubauer answered 8/1, 2022 at 10:12 Comment(1)
I am not seeing the collections in pypi.org. What is the pip install?Raccoon

© 2022 - 2024 — McMap. All rights reserved.