-1

I am installing bottleneck by python3 -m pip install bottleneck. My Python version is 3.7 and my system is Mac OS. I got the following errors:

Building wheel for bottleneck (setup.py) ... error 

and

error: command 'gcc' failed with exit status 1.

I have already installed the numpy and wheel packages.

Detailed message:

Collecting bottleneck
  Using cached https://files.pythonhosted.org/packages/05/ae/cedf5323f398ab4e4ff92d6c431a3e1c6a186f9b41ab3e8258dff786a290/Bottleneck-1.2.1.tar.gz
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from bottleneck) (1.16.2)
Building wheels for collected packages: bottleneck
  Building wheel for bottleneck (setup.py) ... error
  ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/bottleneck/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-wheel-6xd7l92k --python-tag cp37:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.7
  creating build/lib.macosx-10.9-x86_64-3.7/bottleneck
  copying bottleneck/version.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
  copying bottleneck/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
  creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
  copying bottleneck/benchmark/bench_detailed.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
  copying bottleneck/benchmark/autotimeit.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
  copying bottleneck/benchmark/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
  copying bottleneck/benchmark/bench.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/benchmark
  creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  copying bottleneck/slow/reduce.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  copying bottleneck/slow/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  copying bottleneck/slow/nonreduce.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  copying bottleneck/slow/move.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  copying bottleneck/slow/nonreduce_axis.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/slow
  creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/nonreduce_axis_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/scalar_input_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/reduce_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/util.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/move_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/input_modifcation_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/nonreduce_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  copying bottleneck/tests/list_input_test.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/tests
  creating build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
  copying bottleneck/src/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
  copying bottleneck/src/template.py -> build/lib.macosx-10.9-x86_64-3.7/bottleneck/src
  copying bottleneck/LICENSE -> build/lib.macosx-10.9-x86_64-3.7/bottleneck
  running build_ext
  building 'bottleneck.reduce' extension
  creating build/temp.macosx-10.9-x86_64-3.7
  creating build/temp.macosx-10.9-x86_64-3.7/bottleneck
  creating build/temp.macosx-10.9-x86_64-3.7/bottleneck/src
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c bottleneck/src/reduce.c -o build/temp.macosx-10.9-x86_64-3.7/bottleneck/src/reduce.o -O2
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for bottleneck
  Running setup.py clean for bottleneck
Failed to build bottleneck
Installing collected packages: bottleneck
  Running setup.py install for bottleneck ... error
    ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/bottleneck/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-record-drpl_77t/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    running build_ext
    building 'bottleneck.reduce' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/bottleneck
    creating build/temp.macosx-10.9-x86_64-3.7/bottleneck/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c bottleneck/src/reduce.c -o build/temp.macosx-10.9-x86_64-3.7/bottleneck/src/reduce.o -O2
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/bottleneck/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-record-drpl_77t/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/5r/8xqw7gg166nbrf4xp234kfhw00ggg5/T/pip-install-85p6c0ma/bottleneck/

Could you kindly let me know what I can do to fix the error and install the package?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Yiyin
  • 75
  • 2
  • 9
  • Possible duplicate of [Error on "pip install -U channels" command using for otree (Running setup.py bdist\_wheel for twisted ... error)](https://stackoverflow.com/questions/47400675/error-on-pip-install-u-channels-command-using-for-otree-running-setup-py-bdi) – phd Jun 28 '19 at 12:38
  • https://stackoverflow.com/search?q=%5Bpip%5D+xcrun%3A+error%3A+invalid+active+developer+path – phd Jun 28 '19 at 12:39

3 Answers3

0

The problem seems to be this:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), 
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

It seems you don't have the Xcode command line tools installed.
(You don't need to install Xcode, just the command line tools.)

Before installing bottleneck, try doing this first:

$ xcode-select --install
$ xcrun --version  # just to check if it's installed

Then try again with python3 -m pip install bottleneck.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
0

The problem is that Xcode Command-line Tools needs to be updated.

Go back to your terminal:

xcode-select --install

You'll then receive:

xcode-select: note: install requested for command line developer tools
And be prompted in a window to update Xcode Command Line tools.

After the update is completed, open a new terminal window and your development tools should be returned.

Addition: With any major or semi-major update you'll need to update the command line tools in order to get them functioning properly again. Check Xcode with any update. This goes beyond Mojave...

After that restart your terminal

Tal Avissar
  • 10,088
  • 6
  • 45
  • 70
0

Another way to resolve this is to download Windows SDK 10 (latest version). If this alone doesn't work then download Visual Studio 2019 (again whichever is the latest version). This updates the wheel process.