首页 > 解决方案 > 错误:安装 requirements.txt 时命令出错,退出状态为 1

问题描述

我一直在尝试从 requirements.txt 文件安装软件包,但出现错误。我创建了一个虚拟环境来安装软件包,但得到了他的巨大阵列。我的机器在 python 3.8 上运行

以下是我尝试在虚拟环境中安装 requirements.txt 文件时在终端中遇到的错误

 Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\user\Documents\demoProjectwebapp-v3\venv\Scripts\python.exe' 'C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\user\AppData\Local\Temp\tmpzo50rwzk'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-dpmca2i7\scipy
    Complete output (170 lines):
    lapack_opt_info:
    lapack_mkl_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries mkl_rt not found in ['C:\\Users\\user\\Documents\\demoProjectwebapp-v3\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    openblas_lapack_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries openblas not found in ['C:\\Users\\user\\Documents\\demoProjectwebapp-v3\\venv\\lib', 'C:\\']
    get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
    customize GnuFCompiler
    Could not locate executable g77
    Could not locate executable f77
    customize IntelVisualFCompiler
    Could not locate executable ifort
    Could not locate executable ifl
    customize AbsoftFCompiler
    Could not locate executable f90
    customize CompaqVisualFCompiler
    Could not locate executable DF
    customize IntelItaniumVisualFCompiler
    Could not locate executable efl
    customize Gnu95FCompiler
    Could not locate executable gfortran
    Could not locate executable f95
    customize G95FCompiler
    Could not locate executable g95
    customize IntelEM64VisualFCompiler
    customize IntelEM64TFCompiler
    Could not locate executable efort
    Could not locate executable efc
    customize PGroupFlangCompiler
    Could not locate executable flang
    don't know how to compile Fortran code on platform 'nt'
      NOT AVAILABLE

    openblas_clapack_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries openblas,lapack not found in ['C:\\Users\\user\\Documents\\demoProjectwebapp-v3\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries tatlas,tatlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries tatlas,tatlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries satlas,satlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries satlas,satlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries ptf77blas,ptcblas,atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries ptf77blas,ptcblas,atlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries f77blas,cblas,atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries f77blas,cblas,atlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack not found in ['C:\\Users\\user\\Documents\\demoProjectwebapp-v3\\venv\\lib', 'C:\\']
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    setup.py:111: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
      import imp
    setup.py:386: UserWarning: Unrecognized setuptools command ('dist_info --egg-base C:\Users\user\AppData\Local\Temp\pip-modern-metadata-fv_m7gz4'), proceeding with generating Cython sources and expanding templates
      warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
    Running from scipy source directory.
    C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\numpy\distutils\system_info.py:624: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\numpy\distutils\system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\numpy\distutils\system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
    Traceback (most recent call last):
      File "C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
        main()
      File "C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\setuptools\build_meta.py", line 157, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\setuptools\build_meta.py", line 248, in run_setup
        super(_BuildMetaLegacyBackend,
      File "C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 505, in <module>
      File "setup.py", line 501, in setup_package
        setup(**metadata)
      File "C:\Users\user\AppData\Local\Temp\pip-build-env-glp1ljn7\overlay\Lib\site-packages\numpy\distutils\core.py", line 135, in setup
        config = configuration()
        raise NotFoundError(msg)
    numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\user\Documents\demoProjectwebapp-v3\venv\Scripts\python.exe' 'C:\Users\user\Documents\demoProjectwebapp-v3\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\user\AppData\Local\Temp\tmpzo50rwzk' Check the logs for full command output.

标签: pythonpython-3.xmachine-learningpip

解决方案


尝试隔离哪一行 requirements.txt 给你一个错误,你可以尝试注释掉 torch 看看没有它的安装是如何进行的。

要复制您的错误消息,请尝试 pip install torch,我认为它会给您您遇到的错误消息。

之后有两件事:

  • 转到 torch 文档,了解手动安装
  • 尝试使用另一个包管理器 conda 安装

此外,如果大多数库都在那里,您可能需要安装 Anaconda 软件包来尝试。

作为旁注 - 安装一些重度依赖项的糟糕体验经常发生,所以把它当作练习,这不是你做错了什么,这是你尝试使用的依赖项的一种性质。祝你好运!


推荐阅读