4

When ever I try running the command pip install simpleaudio this is what it returns in Terminal:

Collecting simpleaudio
  Using cached simpleaudio-1.0.1.tar.gz
     Complete output from command python setup.py egg_info:
     Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-3N7xxl/simpleaudio/setup.py", line 40, in <module>
        encoding='utf-8') as f:
     TypeError: 'encoding' is an invalid keyword argument for this function

     ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-3N7xxl/simpleaudio/

If I try installing it with python3 -m pip install simpleaudio I get the following output:

Collecting simpleaudio
  Using cached simpleaudio-1.0.1.tar.gz
Installing collected packages: simpleaudio
  Running setup.py install for simpleaudio ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-yguvrnt6-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-intel-3.6
    creating build/lib.macosx-10.6-intel-3.6/simpleaudio
    copying simpleaudio/__init__.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
    copying simpleaudio/shiny.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
    copying simpleaudio/functionchecks.py -> build/lib.macosx-10.6-intel-3.6/simpleaudio
    creating build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/c.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/e.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/g.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/left_right.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/notes_2_16_44.wav -> build/lib.macosx-10.6-intel-3.6/simpleaudio/test_audio
    running build_ext
    building 'simpleaudio._simpleaudio' extension
    creating build/temp.macosx-10.6-intel-3.6
    creating build/temp.macosx-10.6-intel-3.6/c_src
    /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DDEBUG=0 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c c_src/simpleaudio_mac.c -o build/temp.macosx-10.6-intel-3.6/c_src/simpleaudio_mac.o -mmacosx-version-min=10.6
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command '/usr/bin/clang' failed with exit status 1

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-yguvrnt6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rm/1wlhdbc15tq591by9qnr4_180000gn/T/pip-build-1201y9fs/simpleaudio/

My Python version is

Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

How can I install simpleaudio for this Python interpreter?

Zonear
  • 71
  • 7
  • 1
    That looks like a Python 3 / Python 2 incompatibility issue. Do you have Python 3 installed on your Mac? If so, are you using the correct version of pip? – PM 2Ring Feb 28 '17 at 13:04
  • I am using Python 3, as that is what is needed for simpleaudio to run - at least from what I have gathered from their website – Zonear Feb 28 '17 at 13:07
  • I assume you're doing something like this: `pip install simpleaudio`. Instead, try this: `python3 -m pip install simpleaudio`. – PM 2Ring Feb 28 '17 at 13:12
  • I use Linux, not Mac, so I'm not certain what you need to do to do the installation properly. On Linux, you'd have to do this in root user mode (i.e. use `sudo`) or install to a virtualenv. Ideally, you'd install to a virtual env on Mac too, eg using Anaconda, but you'll need to get help from a Mac user for further details. ;) – PM 2Ring Feb 28 '17 at 13:16
  • @PM2Ring When using `python3 -m pip install simpleaudio` it still returns an error – Zonear Feb 28 '17 at 13:16
  • FWIW I have python3 installed on my macbook pro and `python3 -m pip install simpleaudio` works for me – Wayne Werner Feb 28 '17 at 13:22
  • @PM2Ring firstly, the error I get is [this](http://pastebin.com/uxXmaPvB), secondly when using `python3 -VV` returns `Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]` – Zonear Feb 28 '17 at 13:25
  • @WayneWerner Damn.. Maybe my Mac is just being janky – Zonear Feb 28 '17 at 13:28
  • @Zonear please [edit](http://stackoverflow.com/posts/42509449/edit) the new error and new attempted things into your **question** instead. Additionally, the actual error, if it is shown, is **above** that line that you copied into the pastebin. The pastebin error is utterly useless. – Antti Haapala -- Слава Україні Feb 28 '17 at 13:35
  • @AnttiHaapala Done, hope this makes it a bit clearer – Zonear Feb 28 '17 at 13:43
  • @PM2Ring Did the edit, now I just hope someone knows what is wrong :/ – Zonear Feb 28 '17 at 13:43
  • `missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun` looks rather significant. – PM 2Ring Feb 28 '17 at 13:47
  • @Zonear not "clearer", it makes it solvable. But the original message was pretty much the same as saying: "It didn't work". That much we did know before. – Antti Haapala -- Слава Україні Feb 28 '17 at 13:53
  • Take a look here: http://stackoverflow.com/a/32894314/4014959 – PM 2Ring Feb 28 '17 at 14:01
  • Thought it might be an xcode issue. It usually is :P – Wayne Werner Feb 28 '17 at 14:36
  • I found a fix, so no more need to worry, thanks guys! – Zonear Feb 28 '17 at 15:11

1 Answers1

0

@Zonear's link says to...

Disable "System Integrity Protection" so root can modify all files on your Mac:

Boot into recovery mode (hold [Command]+R during reboot)
In Terminal (from dropdown menu) run `csrutil disable`
Reboot

Fix the permissions on /usr/local:

sudo chflags norestricted /usr/local
sudo chown $(whoami):admin /usr/local
sudo chown -R $(whoami):admin /usr/local

Reinstall xcode developer tools:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Check homebrew and do what the doctor orders:

brew update
brew doctor

Upgrade all your brew-installed packages:

brew upgrade

If git --version mentions "Apple Git" you need to get rid of it:

sudo mv /usr/bin/git /usr/bin/git.xcode
sudo ln -s /usr/local/git/bin/git /usr/bin/git

Download and reinstall gpgtools

Get a Linux laptop!

hobs
  • 18,473
  • 10
  • 83
  • 106