vishnubob / python-midi

Python MIDI library
MIT License
1.51k stars 370 forks source link

Problems loading python midi with Python 3.5.3 #126

Open TonyElvidge opened 7 years ago

TonyElvidge commented 7 years ago

Hi,

I have installed a new version of Raspbian on my Raspberry Pi B+ and attempted to install python-midi. It started loading and then came up with an error message. See below.

pi@raspberrypi:~ $ pip install git+https://github.com/vishnubob/python-midi@feature/python3 Collecting git+https://github.com/vishnubob/python-midi@feature/python3 Cloning https://github.com/vishnubob/python-midi (to feature/python3) to /tmp/pip-jnzoqJ-build Installing collected packages: midi Running setup.py install for midi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-jnzoqJ-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-o1cGZT-record/install-record.txt --single-version-externally-managed --compile --user --prefix=: /usr/lib/python2.7/dist-packages/setuptools/dist.py:333: UserWarning: Normalizing 'v0.2.3' to '0.2.3' normalized_version, running install running build running build_py file src/sequencer_alsa/sequencer_alsa.py (for module midi.sequencer.sequencer_alsa) not found creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/midi copying src/init.py -> build/lib.linux-armv6l-2.7/midi copying src/containers.py -> build/lib.linux-armv6l-2.7/midi copying src/events.py -> build/lib.linux-armv6l-2.7/midi copying src/util.py -> build/lib.linux-armv6l-2.7/midi copying src/fileio.py -> build/lib.linux-armv6l-2.7/midi copying src/constants.py -> build/lib.linux-armv6l-2.7/midi creating build/lib.linux-armv6l-2.7/midi/sequencer copying src/sequencer_alsa/init.py -> build/lib.linux-armv6l-2.7/midi/sequencer copying src/sequencer_alsa/sequencer.py -> build/lib.linux-armv6l-2.7/midi/sequencer file src/sequencer_alsa/sequencer_alsa.py (for module midi.sequencer.sequencer_alsa) not found running build_ext building '_sequencer_alsa' extension swigging src/sequencer_alsa/sequencer_alsa.i to src/sequencer_alsa/sequencer_alsa_wrap.c swig -python -o src/sequencer_alsa/sequencer_alsa_wrap.c src/sequencer_alsa/sequencer_alsa.i unable to execute 'swig': No such file or directory error: command 'swig' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-jnzoqJ-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-o1cGZT-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-jnzoqJ-build/ pi@raspberrypi:~ $

Any suggestions gratefully received. Regards Tony

ajakk commented 7 years ago

This seems to be caused by python being unable to execute the command 'swig'. I believe the command to install it is sudo apt-get install swig on Raspbian. Try running the setup file again after installing this.

TonyElvidge commented 7 years ago

Thanks for this.

I managed to get a bit further after installing swig, but came up with a new error.

pi@raspberrypi:~ $ pip install git+https://github.com/vishnubob/python-midi@feature/python3 Collecting git+https://github.com/vishnubob/python-midi@feature/python3 Cloning https://github.com/vishnubob/python-midi (to feature/python3) to /tmp/pip-S5tTI-build Installing collected packages: midi Running setup.py install for midi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-S5tTI-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-VMIbYy-record/install-record.txt --single-version-externally-managed --compile --user --prefix=: /usr/lib/python2.7/dist-packages/setuptools/dist.py:333: UserWarning: Normalizing 'v0.2.3' to '0.2.3' normalized_version, running install running build running build_py file src/sequencer_alsa/sequencer_alsa.py (for module midi.sequencer.sequencer_alsa) not found creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/midi copying src/init.py -> build/lib.linux-armv6l-2.7/midi copying src/containers.py -> build/lib.linux-armv6l-2.7/midi copying src/events.py -> build/lib.linux-armv6l-2.7/midi copying src/util.py -> build/lib.linux-armv6l-2.7/midi copying src/fileio.py -> build/lib.linux-armv6l-2.7/midi copying src/constants.py -> build/lib.linux-armv6l-2.7/midi creating build/lib.linux-armv6l-2.7/midi/sequencer copying src/sequencer_alsa/init.py -> build/lib.linux-armv6l-2.7/midi/sequencer copying src/sequencer_alsa/sequencer.py -> build/lib.linux-armv6l-2.7/midi/sequencer file src/sequencer_alsa/sequencer_alsa.py (for module midi.sequencer.sequencer_alsa) not found running build_ext building '_sequencer_alsa' extension swigging src/sequencer_alsa/sequencer_alsa.i to src/sequencer_alsa/sequencer_alsa_wrap.c swig -python -o src/sequencer_alsa/sequencer_alsa_wrap.c src/sequencer_alsa/sequencer_alsa.i creating build/temp.linux-armv6l-2.7 creating build/temp.linux-armv6l-2.7/src creating build/temp.linux-armv6l-2.7/src/sequencer_alsa arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/sequencer_alsa/sequencer_alsa_wrap.c -o build/temp.linux-armv6l-2.7/src/sequencer_alsa/sequencer_alsa_wrap.o src/sequencer_alsa/sequencer_alsa_wrap.c:3073:28: fatal error: alsa/asoundlib.h: No such file or directory

include <alsa/asoundlib.h>

                            ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-S5tTI-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-VMIbYy-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-S5tTI-build/ pi@raspberrypi:~ $

Any more help gratefully received.

Regards Tony

Rick-Majpruz commented 6 years ago

You need libasound2-dev to get the development files for ALSA applications. Just run apt-get install libasound2-dev. In general, google the error asoundlib.h: No such file or directory and you'll get some forum webpage that tells you to install libsound2-dev.

RogerLevy commented 3 years ago

I'm also having trouble importing this module.

Traceback (most recent call last):
  File "mididumphw.py", line 5, in <module>
    import midi.sequencer as sequencer
  File "/usr/local/lib/python3.7/dist-packages/midi/sequencer/__init__.py", line 1, in <module>
    from .sequencer import *
  File "/usr/local/lib/python3.7/dist-packages/midi/sequencer/sequencer.py", line 2, in <module>
    from . import sequencer_alsa as S
ImportError: cannot import name 'sequencer_alsa' from 'midi.sequencer' (/usr/local/lib/python3.7/dist-packages/midi/sequencer/__init__.py)