simonw / datasette-publish-vercel

Datasette plugin for publishing data using Vercel
Apache License 2.0
44 stars 7 forks source link

Failed to run "pip3.9 install --disable-pip-version-check --target . werkzeug==1.0.1" | Error: spawn pip3.9 ENOENT #67

Open tddschn opened 5 months ago

tddschn commented 5 months ago

datasette, version 1.0a12

datasette-publish-vercel: latest version

Vercel CLI 33.6.1 (can successfully deploy any other python serverless projects, just doesn't work with datasette-publish-vercel)

# get test.db
echo '{"1": 2}' | sqlite-utils insert test.db test -
datasette publish vercel --project test-db test.db --debug
(node:39238) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
> [debug] [2024-04-03T12:37:23.772Z] Found config in file "/private/var/folders/km/6sczydd546n7xmy21z8yndzw0000gn/T/tmp4i1laanb/datasette-now-v2/vercel.json"
Vercel CLI 33.6.1
> [debug] [2024-04-03T12:37:23.793Z] user supplied a possible target for deployment or an extension
> [debug] [2024-04-03T12:37:23.836Z] failed to find extension command with name "vercel---confirm"
WARN! `--confirm` is deprecated, please use `--yes` instead
> [debug] [2024-04-03T12:37:23.875Z] Setting target to production
> [debug] [2024-04-03T12:37:23.881Z] Aborting search for repo root
> [debug] [2024-04-03T12:37:23.884Z] Spinner invoked (Loading scopes…) with a 1000ms delay
> [debug] [2024-04-03T12:37:23.900Z] #1 → GET https://api.vercel.com/v2/user
> [debug] [2024-04-03T12:37:23.903Z] #2 → GET https://api.vercel.com/v1/teams
> [debug] [2024-04-03T12:37:24.236Z] #2 ← 200 OK: sfo1::wzjtt-1712147844252-49579b8c26ac [333ms]
> [debug] [2024-04-03T12:37:24.239Z] #1 ← 200 OK: sfo1::pww66-1712147844254-52a280f48866 [339ms]
> [debug] [2024-04-03T12:37:24.245Z] Spinner invoked (Searching for existing projects…) with a 1000ms delay
> [debug] [2024-04-03T12:37:24.247Z] #3 → GET https://api.vercel.com/v9/projects/test-db
> [debug] [2024-04-03T12:37:24.372Z] #3 ← 200 OK: sfo1::pww66-1712147844364-ecba411e64f8 [125ms]
> [debug] [2024-04-03T12:37:24.381Z] Aborting search for repo root
🔗  Linked to tddschn/test-db (created .vercel and added it to .gitignore)
❗️  The `name` property in vercel.json is deprecated (https://vercel.link/name-prop)
> [debug] [2024-04-03T12:37:24.389Z] Error while parsing repo data: ENOENT: no such file or directory, open '/private/var/folders/km/6sczydd546n7xmy21z8yndzw0000gn/T/tmp4i1laanb/datasette-now-v2/.git/config'
> [debug] [2024-04-03T12:37:24.464Z] Failed to get last commit. The directory is likely not a Git repo, there are no latest commits, or it is corrupted.
Error: this does not look like a git repo
> [debug] [2024-04-03T12:37:24.466Z] Spinner invoked (Deploying tddschn/test-db) with a 0ms delay
[client-debug] 2024-04-03T12:37:24.466Z Creating deployment...
[client-debug] 2024-04-03T12:37:24.467Z Provided 'path' is a directory.
[client-debug] 2024-04-03T12:37:24.469Z Found 24 rules in .vercelignore
[client-debug] 2024-04-03T12:37:24.469Z Building file tree...
[client-debug] 2024-04-03T12:37:24.473Z Found 4 files in the specified directory
[client-debug] 2024-04-03T12:37:24.475Z Yielding a 'hashes-calculated' event with 4 hashes
[client-debug] 2024-04-03T12:37:24.475Z Using provided API URL: https://api.vercel.com
[client-debug] 2024-04-03T12:37:24.475Z Using provided user agent: vercel 33.6.1 node-v21.7.1 darwin (x64)
[client-debug] 2024-04-03T12:37:24.475Z Setting platform version to harcoded value 2
[client-debug] 2024-04-03T12:37:24.475Z Creating the deployment and starting upload...
[client-debug] 2024-04-03T12:37:24.475Z Determining necessary files for upload...
[client-debug] 2024-04-03T12:37:24.476Z Creating deployment
[client-debug] 2024-04-03T12:37:24.476Z Sending deployment creation API request
[client-debug] 2024-04-03T12:37:25.618Z Deployment response: {"alias":["test-db-tddschn.vercel.app"],"aliasAssigned":false,"bootedAt":1712147845071,"buildingAt":1712147845071,"createdAt":1712147845071,"creator":{"uid":"ntFqYOqK9UsoheLT0RcyiOYx","username":"tddschn"},"id":"dpl_F8sfNbHFvnpYCPLiv87Sofdsb4cZ","lambdas":[{"id":"bld_eos928p0c","createdAt":1712147845473,"entrypoint":".","readyState":"READY","readyStateAt":1712147845473,"output":[]}],"name":"test-db","meta":{},"public":false,"readyState":"QUEUED","regions":["iad1"],"source":"cli","status":"QUEUED","type":"LAMBDAS","url":"test-f63rqqmp9-tddschn.vercel.app","version":2,"build":{"env":["CI","VERCEL","VERCEL_ENV","TURBO_REMOTE_ONLY","TURBO_RUN_SUMMARY","NX_DAEMON","VERCEL_URL","VERCEL_GIT_PROVIDER","VERCEL_GIT_PREVIOUS_SHA","VERCEL_GIT_REPO_SLUG","VERCEL_GIT_REPO_OWNER","VERCEL_GIT_REPO_ID","VERCEL_GIT_COMMIT_REF","VERCEL_GIT_COMMIT_SHA","VERCEL_GIT_COMMIT_MESSAGE","VERCEL_GIT_COMMIT_AUTHOR_LOGIN","VERCEL_GIT_COMMIT_AUTHOR_NAME","VERCEL_GIT_PULL_REQUEST_ID","VERCEL_DEPLOYMENT_ID","VERCEL_DISCOVER_FOLDER_SIZES","VERCEL_NEXT_BUNDLED_SERVER","VERCEL_SERVERLESS_FUNCTION_FAILOVER","VERCEL_ALLOW_RUBY32","VERCEL_LAYER_LAUNCHER","VERCEL_EDGE_FUNCTIONS_BUNDLE_BATCHES","VERCEL_IGNORE_BUILD_STEP_PACKAGE_MANAGER_DETECT","VERCEL_ENABLE_NPM_DEFAULT","ENABLE_VC_BUILD","VERCEL_BUILD_OUTPUTS_EDGE_FUNCTION","VERCEL_EDGE_FUNCTIONS_REGIONAL_INVOCATION","VERCEL_EDGE_FUNCTIONS_EMBEDDED_SOURCEMAPS","VERCEL_EDGE_FUNCTIONS_STRICT_MODE","USE_OUTPUT_FOR_EDGE_FUNCTIONS","NEXT_PRIVATE_MULTI_PAYLOAD","VERCEL_RICHER_DEPLOYMENT_OUTPUTS","VERCEL_EDGE_SUSPENSE_CACHE","VERCEL_SERVERLESS_SUSPENSE_CACHE","VERCEL_BUILD_MONOREPO_SUPPORT","VERCEL_USE_NODE_BRIDGE_PRIVATE_LATEST","VERCEL_USE_EDGE_FUNCTIONS_BRIDGE_LATEST","VERCEL_ENABLE_NODE_COMPATIBILITY","VERCEL_ENABLE_EXTENDED_FALLBACK_PAYLOAD","VERCEL_NEXT_PRELOAD_COMMON","VERCEL_WAKE_UP_DEPLOYMENT"]},"builds":[{"src":"index.py","use":"@vercel/python@3.0.7"}],"createdIn":"sfo1","env":["VERCEL","VERCEL_ENV","TURBO_REMOTE_ONLY","TURBO_RUN_SUMMARY","NX_DAEMON","VERCEL_URL","VERCEL_GIT_PROVIDER","VERCEL_GIT_PREVIOUS_SHA","VERCEL_GIT_REPO_SLUG","VERCEL_GIT_REPO_OWNER","VERCEL_GIT_REPO_ID","VERCEL_GIT_COMMIT_REF","VERCEL_GIT_COMMIT_SHA","VERCEL_GIT_COMMIT_MESSAGE","VERCEL_GIT_COMMIT_AUTHOR_LOGIN","VERCEL_GIT_COMMIT_AUTHOR_NAME","VERCEL_GIT_PULL_REQUEST_ID","DATASETTE_SECRET","VERCEL_DEPLOYMENT_ID"],"functions":null,"ownerId":"<id>","plan":"hobby","projectId":"prj_xvwubM3VOCXxRWmeg22IjYnCvUtK","routes":[{"src":"^(.*)$","dest":"index.py"}],"target":"production","inspectorUrl":"https://vercel.com/tddschn/test-db/F8sfNbHFvnpYCPLiv87Sofdsb4cZ"}
[client-debug] 2024-04-03T12:37:25.618Z Deployment created with a warning:  Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[client-debug] 2024-04-03T12:37:25.618Z Yielding a 'warning' event
[client-debug] 2024-04-03T12:37:25.618Z Deployment created
[client-debug] 2024-04-03T12:37:25.618Z Yielding a 'created' event
> [debug] [2024-04-03T12:37:25.619Z] Aborting search for repo root
🔍  Inspect: https://vercel.com/tddschn/test-db/<deployment_id> [1s]
✅  Production: https://test-<id>-tddschn.vercel.app [1s]
> [debug] [2024-04-03T12:37:25.684Z] Spinner invoked (Queued) with a 0ms delay
[client-debug] 2024-04-03T12:37:25.684Z Waiting for deployment to be ready...
[client-debug] 2024-04-03T12:37:25.686Z Waiting for builds and the deployment to complete...
[client-debug] 2024-04-03T12:37:26.994Z Deployment state changed to BUILDING
[client-debug] 2024-04-03T12:37:26.994Z Yielding a 'building' event
> [debug] [2024-04-03T12:37:26.994Z] Spinner invoked (Building) with a 0ms delay
[client-debug] 2024-04-03T12:37:31.512Z Yielding a 'error' event
> [debug] [2024-04-03T12:37:31.512Z] Error: Error: spawn pip3.9 ENOENT
Error: spawn pip3.9 ENOENT
    at Now.handleDeploymentError (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:165696:16)
    at processDeployment (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:165456:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Now.create (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:165585:28)
    at async createDeploy (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:165182:12)
    at async deploy_default (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:172734:22)
    at async main13 (/Users/tscp/.bun/install/global/node_modules/vercel/dist/index.js:199272:18)
Error: spawn pip3.9 ENOENT
Error: Command '['vercel', '--confirm', '--debug', '--prod', '--env', 'DATASETTE_SECRET=<sec>']' returned non-zero exit status 1.
tddschn commented 5 months ago

I tried to deploy sqlite databases in other projects and I found that in new projects the plugin don't work anymore, while in old projects they still work. I don't know why, I haven't reach any usage limit on Vercel. I think one possible explanation is that my new projects are somehow marked to use a new build env on Vercel, but there's no way for me to know for sure.

All my new projects failed like this:

datasette publish vercel --project rick-n-morty-datasette-vercel data/rnm.db --install datasette-search-all --install datasette-render-timestamps --install datasette-render-images --install datasette-uptime --install datasette-render-html \
--install datasette-pretty-json --metadata data/metadata.yml
(node:48325) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Vercel CLI 33.6.1
WARN! `--confirm` is deprecated, please use `--yes` instead
❗️  The `name` property in vercel.json is deprecated (https://vercel.link/name-prop)
🔗  Linked to tddschn/rick-n-morty-datasette-vercel (created .vercel and added it to .gitignore)
🔍  Inspect: https://vercel.com/tddschn/<proj>/MUoFFHYUaqGqNVkEF7PYTntQ5eBY [4s]
✅  Production: https://rick-n-morty-datasette-vercel-h7l7l8hry-tddschn.vercel.app [4s]
Error: spawn pip3.9 ENOENT
Error: Command '['vercel', '--confirm', '--prod', '--env', 'DATASETTE_SECRET=<sec>']' returned non-zero exit status 1.
tddschn commented 5 months ago

Failed to run "pip3.9 install --disable-pip-version-check --target . werkzeug==1.0.1" is in the deployment log on Vercel dashboard. I find it extremely weird since any of the dependencies listed in requirements.txt in the generated dir doesn't reply on werkzeug either directly or indirectly, and the deployment log doesn't show more information.

tddschn commented 5 months ago

@simonw Could you take a look at this issue please?

AleksiKnuutila commented 4 months ago

I had the same problem. It seems like changing the Node.js version from the Project Settings (under General) to 18.x solves it.

willingc commented 3 months ago

Confirming that changing Node.js to 18.x solved the problem.

aewshopping commented 3 weeks ago

I experienced the same issue and before reading this found a different solution, which was to change the vercel.json output in the plugin options to "use": "@vercel/python@4.3.1" (the default setting is current "use": "@vercel/python@3.0.7"). It doesn't seem like a great idea to supply my own vercel.json file because then any other vercel.json updates are not propogated but it works.

I chose 4.3.1 because it seemed to be the most popular option here: https://www.npmjs.com/package/@vercel/python?activeTab=versions

This would be a simple change to the _init_.py file... but not sure if it would break the solutions above?

Node version on Vercel remains 20.x