scottbez1 / splitflap

DIY split-flap display
https://scottbez1.github.io/splitflap
Other
3.09k stars 256 forks source link

ImportError: cannot import name 'MutableSequence' from 'collections' #221

Closed brandonfake69 closed 8 months ago

brandonfake69 commented 8 months ago

python3 3d/scripts/generate_fonts.py

Traceback (most recent call last):
  File "/home/me/Desktop/splitflap/3d/scripts/svg_processor.py", line 19, in <module>
    from svg.path import (
  File "/home/me/.local/lib/python3.10/site-packages/svg/path/__init__.py", line 1, in <module>
    from .path import Path, Line, Arc, CubicBezier, QuadraticBezier
  File "/home/me/.local/lib/python3.10/site-packages/svg/path/path.py", line 3, in <module>
    from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/me/Desktop/splitflap/3d/scripts/generate_fonts.py", line 27, in <module>
    from svg_processor import SvgProcessor
  File "/home/me/Desktop/splitflap/3d/scripts/svg_processor.py", line 25, in <module>
    raise RuntimeError(f'Error loading svg.path library. Run "python3 -m pip install -r {os.path.join(os.path.dirname(__file__), "requirements.txt")}" to install it')
RuntimeError: Error loading svg.path library. Run "python3 -m pip install -r /home/me/Desktop/splitflap/3d/scripts/requirements.txt" to install it

I rand the python3 -m pip install -r /home/me/Desktop/splitflap/3d/scripts/requirements.txt file:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: svg.path==2.2 in /home/me/.local/lib/python3.10/site-packages (from -r /home/me/Desktop/splitflap/3d/scripts/requirements.txt (line 1)) (2.2)
Requirement already satisfied: setuptools in /home/me/.local/lib/python3.10/site-packages (from svg.path==2.2->-r /home/me/Desktop/splitflap/3d/scripts/requirements.txt (line 1)) (67.6.1)

And get the same error when I try to run the first command again.

brandonfake69 commented 8 months ago

Same thing happens when I run the file directly ./generate_fonts.py

brandonfake69 commented 8 months ago

Tried reinstalling python3 and got the same error message. On Ubuntu.

brandonfake69 commented 8 months ago

Also tried it on Windows 11 with a brand new Python3 installation with the same error.

brandonfake69 commented 8 months ago

Editing /home/me/.local/lib/python3.10/site-packages/svg/path/path.py and change line 3 to:

from collections.abc import MutableSequence

seems to do the trick but I'm sure isn't the proper way.