6

当我尝试在 Ubuntu 上将 libsass 安装到 Python 3.5 virtualenv 中时,我收到一个关于无法构建轮子的错误,但安装似乎仍然成功。我该如何a)成功构建轮子,以便我可以为新的virtualenvs缓存它或b)让它跳过似乎失败的编译东西?

这是该问题的示例再现:

(libsass_test)$ pip install libsass
Collecting libsass
  Using cached libsass-0.9.3.tar.gz
Collecting six (from libsass)
  Using cached six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: libsass
  Running setup.py bdist_wheel for libsass
  Complete output from command /home/cjohnson/libsass_test/bin/python3.5 -c "import setuptools;__file__='/tmp/pip-build-k8_g3p3v/libsass/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp4q_j26e6pip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  copying sass.py -> build/lib.linux-x86_64-3.5
  copying sassc.py -> build/lib.linux-x86_64-3.5
  copying sasstests.py -> build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/sassutils
  copying sassutils/distutils.py -> build/lib.linux-x86_64-3.5/sassutils
  copying sassutils/__init__.py -> build/lib.linux-x86_64-3.5/sassutils
  copying sassutils/builder.py -> build/lib.linux-x86_64-3.5/sassutils
  copying sassutils/wsgi.py -> build/lib.linux-x86_64-3.5/sassutils
  running build_ext
  building '_sass' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/libsass
  creating build/temp.linux-x86_64-3.5/libsass/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I./libsass/include -I/usr/include/python3.5m -I/home/cjohnson/libsass_test/include/python3.5m -c pysass.cpp -o build/temp.linux-x86_64-3.5/pysass.o -c -O3 -fPIC -std=c++0x -Wall -Wno-parentheses
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I./libsass/include -I/usr/include/python3.5m -I/home/cjohnson/libsass_test/include/python3.5m -c libsass/src/functions.cpp -o build/temp.linux-x86_64-3.5/libsass/src/functions.o -c -O3 -fPIC -std=c++0x -Wall -Wno-parentheses

剪掉一些警告……如果有帮助的话,我可以把完整的转储放在一个要点中。

  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I./libsass/include -I/usr/include/python3.5m -I/home/cjohnson/libsass_test/include/python3.5m -c libsass/src/extend.cpp -o build/temp.linux-x86_64-3.5/libsass/src/extend.o -c -O3 -fPIC -std=c++0x -Wall -Wno-parentheses
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/pysass.o build/temp.linux-x86_64-3.5/libsass/src/functions.o build/temp.linux-x86_64-3.5/libsass/src/plugins.o build/temp.linux-x86_64-3.5/libsass/src/error_handling.o build/temp.linux-x86_64-3.5/libsass/src/node.o build/temp.linux-x86_64-3.5/libsass/src/source_map.o build/temp.linux-x86_64-3.5/libsass/src/remove_placeholders.o build/temp.linux-x86_64-3.5/libsass/src/constants.o build/temp.linux-x86_64-3.5/libsass/src/emitter.o build/temp.linux-x86_64-3.5/libsass/src/environment.o build/temp.linux-x86_64-3.5/libsass/src/utf8_string.o build/temp.linux-x86_64-3.5/libsass/src/inspect.o build/temp.linux-x86_64-3.5/libsass/src/file.o build/temp.linux-x86_64-3.5/libsass/src/sass_values.o build/temp.linux-x86_64-3.5/libsass/src/prelexer.o build/temp.linux-x86_64-3.5/libsass/src/to_value.o build/temp.linux-x86_64-3.5/libsass/src/cencode.o build/temp.linux-x86_64-3.5/libsass/src/listize.o build/temp.linux-x86_64-3.5/libsass/src/sass2scss.o build/temp.linux-x86_64-3.5/libsass/src/c99func.o build/temp.linux-x86_64-3.5/libsass/src/values.o build/temp.linux-x86_64-3.5/libsass/src/bind.o build/temp.linux-x86_64-3.5/libsass/src/to_string.o build/temp.linux-x86_64-3.5/libsass/src/context.o build/temp.linux-x86_64-3.5/libsass/src/eval.o build/temp.linux-x86_64-3.5/libsass/src/output.o build/temp.linux-x86_64-3.5/libsass/src/to_c.o build/temp.linux-x86_64-3.5/libsass/src/sass_functions.o build/temp.linux-x86_64-3.5/libsass/src/sass_util.o build/temp.linux-x86_64-3.5/libsass/src/parser.o build/temp.linux-x86_64-3.5/libsass/src/ast.o build/temp.linux-x86_64-3.5/libsass/src/memory_manager.o build/temp.linux-x86_64-3.5/libsass/src/json.o build/temp.linux-x86_64-3.5/libsass/src/util.o build/temp.linux-x86_64-3.5/libsass/src/lexer.o build/temp.linux-x86_64-3.5/libsass/src/position.o build/temp.linux-x86_64-3.5/libsass/src/cssize.o build/temp.linux-x86_64-3.5/libsass/src/units.o build/temp.linux-x86_64-3.5/libsass/src/sass_context.o build/temp.linux-x86_64-3.5/libsass/src/expand.o build/temp.linux-x86_64-3.5/libsass/src/sass_interface.o build/temp.linux-x86_64-3.5/libsass/src/sass.o build/temp.linux-x86_64-3.5/libsass/src/base64vlq.o build/temp.linux-x86_64-3.5/libsass/src/color_maps.o build/temp.linux-x86_64-3.5/libsass/src/extend.o -L./libsass/src -o build/lib.linux-x86_64-3.5/_sass.cpython-35m-x86_64-linux-gnu.so -fPIC -lstdc++
  running build_scripts
  creating build/scripts-3.5
  copying and adjusting sassc.py -> build/scripts-3.5
  changing mode of build/scripts-3.5/sassc.py from 664 to 775
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  copying build/lib.linux-x86_64-3.5/sassc.py -> build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/sassutils
  copying build/lib.linux-x86_64-3.5/sassutils/distutils.py -> build/bdist.linux-x86_64/wheel/sassutils
  copying build/lib.linux-x86_64-3.5/sassutils/__init__.py -> build/bdist.linux-x86_64/wheel/sassutils
  copying build/lib.linux-x86_64-3.5/sassutils/builder.py -> build/bdist.linux-x86_64/wheel/sassutils
  copying build/lib.linux-x86_64-3.5/sassutils/wsgi.py -> build/bdist.linux-x86_64/wheel/sassutils
  copying build/lib.linux-x86_64-3.5/_sass.cpython-35m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel
  copying build/lib.linux-x86_64-3.5/sasstests.py -> build/bdist.linux-x86_64/wheel
  copying build/lib.linux-x86_64-3.5/sass.py -> build/bdist.linux-x86_64/wheel
  running install_egg_info
  running egg_info
  writing top-level names to libsass.egg-info/top_level.txt
  writing libsass.egg-info/PKG-INFO
  writing requirements to libsass.egg-info/requires.txt
  writing dependency_links to libsass.egg-info/dependency_links.txt
  writing entry points to libsass.egg-info/entry_points.txt
  warning: manifest_maker: standard file '-c' not found

  reading manifest file 'libsass.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'libsass.egg-info/SOURCES.txt'
  Copying libsass.egg-info to build/bdist.linux-x86_64/wheel/libsass-0.9.3-py3.5.egg-info
  running install_scripts
  creating build/bdist.linux-x86_64/wheel/libsass-0.9.3.data
  creating build/bdist.linux-x86_64/wheel/libsass-0.9.3.data/scripts
  copying build/scripts-3.5/sassc.py -> build/bdist.linux-x86_64/wheel/libsass-0.9.3.data/scripts
  changing mode of build/bdist.linux-x86_64/wheel/libsass-0.9.3.data/scripts/sassc.py to 775
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-k8_g3p3v/libsass/setup.py", line 273, in <module>
      cmdclass={'upload_doc': upload_doc}
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/cjohnson/libsass_test/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 213, in run
      archive_basename = self.get_archive_basename()
    File "/home/cjohnson/libsass_test/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 161, in get_archive_basename
      impl_tag, abi_tag, plat_tag = self.get_tag()
    File "/home/cjohnson/libsass_test/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 155, in get_tag
      assert tag == supported_tags[0]
  AssertionError

  ----------------------------------------
  Failed building wheel for libsass
Failed to build libsass
Installing collected packages: six, libsass
  Running setup.py install for libsass
Successfully installed libsass-0.9.3 six-1.10.0
4

1 回答 1

13

问题是 wheel < 0.25.0 与 Python 3.5 和 pip 二进制发行版不兼容。

这是关于它的问题跟踪器:https ://bitbucket.org/pypa/wheel/issues/146/wheel-building-fails-on-cpython-350b3

一个棘手的问题是在安装其他任何东西之前需要升级轮子,所以你不能只在你的 requirements.txt 中说 wheel==whatever。

(libsass_test)$ pip install --upgrade wheel
Collecting wheel
  Using cached wheel-0.26.0-py2.py3-none-any.whl
Installing collected packages: wheel
  Found existing installation: wheel 0.24.0
    Uninstalling wheel-0.24.0:
      Successfully uninstalled wheel-0.24.0
Successfully installed wheel-0.26.0
(libsass_test)$ pip install libsass
Collecting libsass
  Using cached libsass-0.9.3.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six in ./lib/python3.5/site-packages (from libsass)
Building wheels for collected packages: libsass
  Running setup.py bdist_wheel for libsass
  Stored in directory: /home/cjohnson/.cache/pip/wheels/23/fa/f8/ff89658d6dd1abcd7bc6791f856bb36cc6e578a707f6b41d67
Successfully built libsass
Installing collected packages: libsass
Successfully installed libsass-0.9.3
于 2015-12-10T18:37:34.040 回答