You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地运行App Engine导入BigQuery库报DistributionNotFound错误求助

Fixing DistributionNotFound for google-cloud-bigquery in Local App Engine

The error you're encountering happens because the local App Engine development server runs in an isolated environment and doesn't automatically recognize globally installed Python packages. Even though you installed google-cloud-bigquery via pip, the App Engine SDK's setuptools can't locate it. Here's how to resolve this:

Step 1: Install the package into your project's local lib directory

Instead of installing globally, install the package directly into a lib folder within your project. This ensures App Engine can access it. Since you're using Python 2.7 (evident from the traceback), use pip2.7 to target the correct Python version:

pip2.7 install --upgrade google-cloud-bigquery==1.28.0 -t lib

Note: Version 1.28.0 is the last release of google-cloud-bigquery that supports Python 2.7. Newer versions drop Python 2.7 compatibility, so specifying this version is critical.

Step 2: Configure App Engine to use the local lib folder

Create an appengine_config.py file in the root directory of your project (same level as app.yaml). Add the following code to tell App Engine to load libraries from the lib folder:

from google.appengine.ext import vendor

# Add libraries installed in the "lib" folder to the Python path
vendor.add('lib')

Step 3: Verify the setup

Ensure the lib folder exists in your project and contains the google directory (along with other dependencies). Restart your local App Engine dev server, and the import should work correctly.

Additional Checks

  • If you're using a virtual environment, activate it before running the pip command to ensure you're installing into the right context.
  • Double-check that your project's app.yaml doesn't exclude the lib folder (it should be included by default unless you've added it to a skip list).

内容的提问来源于stack exchange,提问作者Manuel Godoy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:30:57