Windows Python 3.10 embedded pip No module named 'src'

vlurs2pr  于 2023-10-21  发布在  Python
关注(0)|答案(1)|浏览(172)

尝试让pip使用Windows上嵌入的Python安装Spleeter。在经历了许多的兔子洞之后,我需要一些指导。我尝试过这个方法,在Python 3.7.9、3.8.10、3.9.13、3.10.11(Spleeter目前支持的所有版本)中也出现了同样的错误。我正在尝试为我的SpleeterGUI OS项目构建一个新的Python文件夹。另一个用户托管了当前的Python文件,我的一个朋友把它放在一起,但我不能用较新的Python版本复制它。在github上搜索thooore/SpleeterCore
我已经下载并解压缩https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip编辑python310._pth,在第3行添加“Lib\site-packages”下面是发生的事情.

C:\temp\spleeter>cd 3.10.11

C:\temp\spleeter\3.10.11>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
C:\temp\spleeter\3.10.11>python.exe get-pip.py
Collecting pip
  Obtaining dependency information for pip from https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl.metadata
  Using cached pip-23.2.1-py3-none-any.whl.metadata (4.2 kB)
Collecting setuptools
  Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/bb/26/7945080113158354380a12ce26873dd6c1ebd88d47f5bc24e2c5bb38c16a/setuptools-68.2.2-py3-none-any.whl.metadata
  Using cached setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
Collecting wheel
  Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl.metadata
  Using cached wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
Using cached pip-23.2.1-py3-none-any.whl (2.1 MB)
Using cached setuptools-68.2.2-py3-none-any.whl (807 kB)
Using cached wheel-0.41.2-py3-none-any.whl (64 kB)
Installing collected packages: wheel, setuptools, pip
  WARNING: The script wheel.exe is installed in 'C:\temp\spleeter\3.10.11\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip.exe, pip3.10.exe and pip3.exe are installed in 'C:\temp\spleeter\3.10.11\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip setuptools wheel

C:\temp\spleeter\3.10.11>python.exe -m pip install spleeter
Collecting spleeter
  Obtaining dependency information for spleeter from https://files.pythonhosted.org/packages/2a/59/c43fe99b90514e2444ae3aa5fdbb7bc33041aa1763c979fe74d4216dd5e4/spleeter-2.4.0-py3-none-any.whl.metadata
  Using cached spleeter-2.4.0-py3-none-any.whl.metadata (10 kB)
Collecting ffmpeg-python<0.3.0,>=0.2.0 (from spleeter)
  Using cached ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)
Collecting httpx[http2]<0.20.0,>=0.19.0 (from spleeter)
  Using cached httpx-0.19.0-py3-none-any.whl (77 kB)
Collecting norbert<0.3.0,>=0.2.1 (from spleeter)
  Using cached norbert-0.2.1-py2.py3-none-any.whl (11 kB)
Collecting pandas<2.0.0,>=1.3.0 (from spleeter)
  Using cached pandas-1.5.3-cp310-cp310-win_amd64.whl (10.4 MB)
Collecting tensorflow<2.10.0,>=2.5.0 (from spleeter)
  Using cached tensorflow-2.9.3-cp310-cp310-win_amd64.whl (444.2 MB)
Collecting typer<0.4.0,>=0.3.2 (from spleeter)
  Using cached typer-0.3.2-py3-none-any.whl (21 kB)
Collecting future (from ffmpeg-python<0.3.0,>=0.2.0->spleeter)
  Using cached future-0.18.3.tar.gz (840 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\mitch\AppData\Local\Temp\pip-install-z80119wi\future_fd492dd3e5934f9b85432f175479d227\setup.py", line 86, in <module>
          import src.future
      ModuleNotFoundError: No module named 'src'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我已经尝试过Python embedded 3.7.9,3.8.10,3.9.13,3.10.11直接调用pip。
设置环境C:\temp\spleeter\3.10.11>set PY_PIP=python-3.10.11-embed-amd 64\Lib; python-3.10.11-embed-amd64\Lib\site-packages
如果我尝试安装“src”软件包. python.exe -m pip install src

Collecting src
  Using cached src-0.0.7.zip (6.3 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: src
  Building wheel for src (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib
      creating build\lib\src
      copying src\__init__.py -> build\lib\src
      running egg_info
      writing src.egg-info\PKG-INFO
      writing dependency_links to src.egg-info\dependency_links.txt
      deleting src.egg-info\entry_points.txt
      writing requirements to src.egg-info\requires.txt
      writing top-level names to src.egg-info\top_level.txt
      reading manifest file 'src.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE.rst'
      writing manifest file 'src.egg-info\SOURCES.txt'
      C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\dist.py:947: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!

              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.

              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************

      !!
        command.initialize_options()
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\mitch\AppData\Local\Temp\pip-install-hnihey52\src_32ac933409b24581846526dac14fc81e\setup.py", line 70, in <module>
          setup(
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\dist.py", line 989, in run_command
          super().run_command(command)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\temp\spleeter\3.10.11\lib\site-packages\wheel\bdist_wheel.py", line 366, in run
          install = self.reinitialize_command("install", reinit_subcommands=True)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\__init__.py", line 216, in reinitialize_command
          cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\cmd.py", line 311, in reinitialize_command
          return self.distribution.reinitialize_command(command, reinit_subcommands)
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\dist.py", line 953, in reinitialize_command
          for sub in command.get_sub_commands():
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\cmd.py", line 329, in get_sub_commands
          if method is None or method(self):
        File "C:\temp\spleeter\3.10.11\lib\site-packages\setuptools\_distutils\command\install.py", line 787, in has_lib
          self.distribution.has_pure_modules() or self.distribution.has_ext_modules()
      AttributeError: 'NoneType' object has no attribute 'has_pure_modules'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for src
  Running setup.py clean for src
Failed to build src
ERROR: Could not build wheels for src, which is required to install pyproject.toml-based projects
nafvub8i

nafvub8i1#

解决:以防万一你遇到这个问题。python的嵌入式版本没有配置为运行pip,所以你会遇到很多问题。你需要得到windows installer和embedded [相同版本],并使用已安装的版本使用--target和目标嵌入式目录进行pip安装。

相关问题