Reputation: 1
I am trying to open 4 packages to run in Python 3.12: pandas, matplotlib, audiolazy, and midiutil.
I am running the following script in IDLE:
import sys
import subprocess
for package in ['pandas','matplotlib', 'audiolazy', 'midiutil']:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
I have no problems importing pandas, matplotlib and midiutil with the following script:
import pandas as pd
import matplotlib.pylab as plt
from midiutil import MIDIFile
But when I run: from audiolazy import str2midi
or import audiolazy
to try to verify if it had installed correctly, I have the following errors:
from audiolazy import str2midi Traceback (most recent call last): File "<pyshell#9>", line 1, in from audiolazy import str2midi File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/init.py", line 67, in ).init_package(path, name, doc) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 117, in init_package modules = get_modules(package_name, module_names) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 59, in get_modules return [get_module(name) for name in module_names] File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 58, in get_module return import(".".join([package_name, name]), fromlist=[package_name]) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/lazy_analysis.py", line 23, in from collections import deque, Sequence, Iterable ImportError: cannot import name 'Sequence' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/collections/init.py)
import audiolazy Traceback (most recent call last): File "<pyshell#5>", line 1, in import audiolazy File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/init.py", line 67, in ).init_package(path, name, doc) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 117, in init_package modules = get_modules(package_name, module_names) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 59, in get_modules return [get_module(name) for name in module_names] File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/_internals.py", line 58, in get_module return import(".".join([package_name, name]), fromlist=[package_name]) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/audiolazy/lazy_analysis.py", line 23, in from collections import deque, Sequence, Iterable ImportError: cannot import name 'Sequence' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/collections/init.py)
I have tried to import Sequence from collections (having previously imported collections) with this script from collections import Sequence
but I continue having a similar problem:
Traceback (most recent call last): File "<pyshell#8>", line 1, in from collections import Sequence ImportError: cannot import name 'Sequence' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/collections/init.py)
I would really appreciate any help you may provide to be able to import audiolazy successfully in Python's IDLE.
Upvotes: 0
Views: 193
Reputation: 19219
This import error has nothing to do with IDLE. You would get the same error running your code directly with Python. The following is the IDLE shell with 3.13.0a2:
>>> from collections.abc import Sequence
>>> Sequence
<class 'collections.abc.Sequence'>
You likely have to upgrade (edit) the audiolazy code to do the same.
Upvotes: 0