24

First time using pip, trying to use the python-docs-samples tutorial library. When I run the "python -m pip install -r requirements.txt" command, a lot of scripts are pulled in, but then I get a series of "Failed building wheel" errors. One of these is shown in the attached code block (please pardon the hand-entered word-wrap linebreaks).

What is the problem? Anyone seen this before? I have not altered any parts of the library or the code that uses it, and I'm using Python 2.7.12 which is supposed to have good built-in support for PIP.

  Running setup.py bdist_wheel for PyYAML ... error
  Complete output from command C:\users\owner\python-docs-samples\env\Scripts\python.exe 
-u -c "import setuptools, tokenize;__file__='c:\\users\\owner\\appdata\\local\\temp\\
pip-build-86ysrg\\PyYAML\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\owner\appdata
\local\temp\tmpljy6z0pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-2.7
  creating build\lib.win32-2.7\yaml
  copying lib\yaml\composer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\constructor.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\cyaml.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\dumper.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\emitter.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\error.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\events.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\loader.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\nodes.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\parser.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\reader.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\representer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\resolver.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\scanner.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\serializer.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\tokens.py -> build\lib.win32-2.7\yaml
  copying lib\yaml\__init__.py -> build\lib.win32-2.7\yaml
  running build_ext
  creating build\temp.win32-2.7
  creating build\temp.win32-2.7\Release
  checking if libyaml is compilable
  error: [Error 2] The system cannot find the file specified

  ----------------------------------------
  Failed building wheel for PyYAML
  Running setup.py clean for PyYAML
Steve Eklund
  • 401
  • 1
  • 4
  • 9

6 Answers6

22

Install Common Dependencies

sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-pil python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
mosleim
  • 654
  • 6
  • 19
Basil Jose
  • 1,004
  • 11
  • 13
7

For me, this issue was resolved on Ubuntu 16 by upgrading pip:

pip install --upgrade pip
Josh
  • 12,896
  • 4
  • 48
  • 49
  • 3
    Repeat after me children, "You shall not run random commands from StackOverflow without understanding what they do". Lol, for me this upgraded my system pip and caused me many further headaches. If this has happened to you, solution here: https://stackoverflow.com/a/53700609 – James Hibbard Dec 21 '19 at 13:54
6

The problem is Windows, where you'll run into dependency issues and build issues with C extensions if you don't have a compiler toolchain installed.

Manually installing the binary versions of some dependencies, such as PyYAML, is one solution (eg. with easy_install as suggested). For building binary wheels from source, you can also download the free Visual C++ Compiler for Python 2.7 here: https://www.microsoft.com/en-ca/download/details.aspx?id=44266

Adam
  • 5,697
  • 1
  • 20
  • 52
6

Like already mentioned above, the problem is Windows.

You can download compatible python packages from here:

Unofficial Windows Binaries for Python Extension Packages

then pip install the .whl file

pip install path_2_file\package.whl
Yonti
  • 1,179
  • 9
  • 8
4

I got rid of the same error by upgrading pip, setuptools, and wheel before installing pyyaml:

# Ensure pip, setuptools, and wheel are up to date before installing python packages.
pip install --upgrade pip \
    setuptools \
    wheel \

# Now install various python packages
pip install \
    pyyaml==5.3.1 \
    . . .
Milan
  • 351
  • 2
  • 4
0

Try this (not sure)

apt-get install -y pyyaml

I got an error 'Failed building wheel for subprocess32

apt-get install -y python-subprocess32

It worked for me!

Vaishnavi Bala
  • 129
  • 1
  • 4