无法安装 search-ads-360-python 库

问题描述 投票:0回答:1

我正在尝试通过 Python 脚本连接 SearchAds 360 API。我正在遵循他们的 快速入门指南,但在安装 search-ads-360-python 客户端库时遇到问题。

我已经下载了该文件,当我运行命令

pip install searchads360-py.tar.gz
时,出现以下错误:

(sa360api) lenwood@Lenwood-MBP 2024.06.19_sa360-api % pip install searchads360-py.tar.gz
Processing ./searchads360-py.tar.gz
Preparing metadata (setup.py) ... done
Requirement already satisfied: google-api-core<3.0.0dev,>=2.10.0 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (2.19.0)
Requirement already satisfied: google-auth<3.0.0dev,>=2.14.1 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-ads-searchads360==0.0.0) (2.30.0)
Requirement already satisfied: googleapis-common-protos>=1.53.0 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-ads-searchads360==0.0.0) (1.63.1)
Requirement already satisfied: grpcio>=1.10.0 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-ads-searchads360==0.0.0) (1.64.1)
Requirement already satisfied: proto-plus<2.0.0dev,>=1.22.3 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-ads-searchads360==0.0.0) (1.24.0)
Requirement already satisfied: protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (4.25.3)
Requirement already satisfied: requests<3.0.0.dev0,>=2.18.0 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (2.32.3)
Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (1.62.2)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-auth<3.0.0dev,>=2.14.1->google-ads-searchads360==0.0.0) (5.3.3)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-auth<3.0.0dev,>=2.14.1->google-ads-searchads360==0.0.0) (0.4.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from google-auth<3.0.0dev,>=2.14.1->google-ads-searchads360==0.0.0) (4.9)
Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from pyasn1-modules>=0.2.1->google-auth<3.0.0dev,>=2.14.1->google-ads-searchads360==0.0.0) (0.6.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (2.2.2)
Requirement already satisfied: certifi>=2017.4.17 in /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages (from requests<3.0.0.dev0,>=2.18.0->google-api-core<3.0.0dev,>=2.10.0->google-api-core[grpc]<3.0.0dev,>=2.10.0->google-ads-searchads360==0.0.0) (2024.6.2)
Building wheels for collected packages: google-ads-searchads360
Building wheel for google-ads-searchads360 (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
    /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
    !!
    
            ********************************************************************************
            Requirements should be satisfied by a PEP 517 installer.
            If you are using pip, you can try `pip install --use-pep517`.
            ********************************************************************************
    
    !!
        dist.fetch_build_eggs(dist.setup_requires)
    Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/setup.py", line 56, in <module>
        setuptools.setup(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 102, in setup
        _install_setup_requires(attrs)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
        _fetch_build_eggs(dist)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 80, in _fetch_build_eggs
        dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/dist.py", line 643, in fetch_build_eggs
        return _fetch_build_eggs(self, requires)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 832, in resolve
        dist = self._resolve_dist(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 868, in _resolve_dist
        dist = best[req.key] = env.best_match(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1155, in best_match
        return self.obtain(req, installer)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1170, in obtain
        return installer(requirement) if installer else None
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/installer.py", line 106, in _fetch_build_egg_no_warn
        wheel.install_as_egg(dist_location)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 122, in install_as_egg
        self._install_as_egg(destination_eggdir, zf)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 130, in _install_as_egg
        self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 175, in _convert_metadata
        os.rename(dist_info, egg_info)
    OSError: [Errno 66] Directory not empty: '/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/.eggs/libcst-1.4.0-py3.9-macosx-11.1-arm64.egg/libcst-1.4.0.dist-info' -> '/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/.eggs/libcst-1.4.0-py3.9-macosx-11.1-arm64.egg/EGG-INFO'
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for google-ads-searchads360
Running setup.py clean for google-ads-searchads360
error: subprocess-exited-with-error

× python setup.py clean did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
    /Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
    !!
    
            ********************************************************************************
            Requirements should be satisfied by a PEP 517 installer.
            If you are using pip, you can try `pip install --use-pep517`.
            ********************************************************************************
    
    !!
        dist.fetch_build_eggs(dist.setup_requires)
    Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/setup.py", line 56, in <module>
        setuptools.setup(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 102, in setup
        _install_setup_requires(attrs)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
        _fetch_build_eggs(dist)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/__init__.py", line 80, in _fetch_build_eggs
        dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/dist.py", line 643, in fetch_build_eggs
        return _fetch_build_eggs(self, requires)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 832, in resolve
        dist = self._resolve_dist(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 868, in _resolve_dist
        dist = best[req.key] = env.best_match(
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1155, in best_match
        return self.obtain(req, installer)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1170, in obtain
        return installer(requirement) if installer else None
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/installer.py", line 106, in _fetch_build_egg_no_warn
        wheel.install_as_egg(dist_location)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 122, in install_as_egg
        self._install_as_egg(destination_eggdir, zf)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 130, in _install_as_egg
        self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/lenwood/opt/anaconda3/envs/sa360api/lib/python3.9/site-packages/setuptools/wheel.py", line 175, in _convert_metadata
        os.rename(dist_info, egg_info)
    OSError: [Errno 66] Directory not empty: '/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/.eggs/libcst-1.4.0-py3.9-macosx-11.1-arm64.egg/libcst-1.4.0.dist-info' -> '/private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov/.eggs/libcst-1.4.0-py3.9-macosx-11.1-arm64.egg/EGG-INFO'
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed cleaning build dir for google-ads-searchads360
Failed to build google-ads-searchads360
ERROR: Could not build wheels for google-ads-searchads360, which is required to install pyproject.toml-based projects

我已经尝试过:

  • 运行
    pip install searchads360-py.tar.gz --use-pep517
    ,它完成时没有错误,但包没有显示在 pip 列表或 conda 列表中,当我尝试导入它时,我收到 ModuleNotFoundError 。
  • 解压 tarball,导航到文件夹并运行
    python -m pip install .
  • 将 pip、setuptools 和wheel更新到最新版本
  • 在 Python 3.8.19、3.9.19 和 3.10.14 环境中运行它
  • 在我的系统中搜索非空文件夹,
    /private/var/folders/3w/h_s63nl14p75qzww71xm_3fw0000gn/T/pip-req-build-gwhvmyov
    文件夹不存在。

我的系统是配备 macOS Sonoma 14.5 的 M1 Mac。谁能分享如何解决的指导吗?

python pip
1个回答
0
投票

我终于安装并运行了这个软件包。我不清楚的是 searchads360-py.tar.gz 是一个包,而 util_searchads360_py.tar.gz 是一个文件集合。因此,不需要“安装” util_searchads360_py 文件,只需在安装该软件包后将它们放置在 searchads360-py 文件夹中即可。我不知道这是否在任何地方都有记录,一位同事注意到 util_searchads360_py 不包含

setup.py
文件时向我指出了这一点。我确实必须使用
python -m pip install . --use-pep517
来完成安装。这是我的过程。

  1. 将 searchads360-py.tar.gz 和 util_searchads360_py.tar.gz 下载到目标文件夹。

  2. 打开终端并导航到该文件夹。激活要安装这些的虚拟环境。

  3. 在终端中输入以下命令。

     % tar -xvzf searchads360-py.tar.gz
     % cd searchads360-py
     % python -m pip install . --use-pep517
     % cd ..
     % tar -xvzf util_searchads360_py.tar.gz
    
  4. 将 util_searchads360_py 文件夹的所有内容复制到 searchads360-py 文件夹中。

完成后,文件夹结构将如下所示(为简洁起见,我没有显示子文件夹的内容)

myVirtualEnv
|___searchads360-py
|   |___interceptors
|   |___build
|   |___tests
|   |___docs
|   |___scripts
|   |___google
|   __init__.py
|   config.py
|   client.py
|   mypy.ini
|   noxfile.py
|   setup.py
|   MANIFEST.in

软件包已安装并可以使用。

    % python
    Python 3.11.9 | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from util_searchads360 import SearchAds360Client
    >>>

我现在可以使用这个库导入 Python 脚本。

© www.soinside.com 2019 - 2024. All rights reserved.