Pipenv not in path (bash: pipenv: command not found)

Hello folks, I’m trying to install a Python dependency via Pipenv as described here: Manage build dependencies | Netlify Docs

Unfortunately it doesn’t seem to work, or better said, the djlint package seems to be installed correctly by the build system but the pipenv command is not available in the default PATH and not sure how to find it / invoke the command:

Site name: cocky-morse-eb7890

Build logs:

9:12:00 AM: Build ready to start
9:12:05 AM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
9:12:05 AM: build-image tag: v4.5.3
9:12:05 AM: buildbot version: 6aae4d21fd1b7e33a10a9c03ca8e663d0c79b21d
9:12:06 AM: Fetching cached dependencies
9:12:06 AM: Starting to download cache of 135.5MB
9:12:07 AM: Finished downloading cache in 1.633433863s
9:12:07 AM: Starting to extract cache
9:12:12 AM: Finished extracting cache in 4.796508446s
9:12:12 AM: Finished fetching cache in 6.447011159s
9:12:12 AM: Starting to prepare the repo for build
9:12:12 AM: Preparing Git Reference refs/heads/master
9:12:13 AM: Parsing package.json dependencies
9:12:14 AM: Starting build script
9:12:14 AM: Installing dependencies
9:12:14 AM: Found Pipfile restoring Pipenv virtualenv
9:12:14 AM: Started restoring cached python virtualenv
9:12:14 AM: Finished restoring cached python virtualenv
9:12:15 AM: Started restoring cached node version
9:12:17 AM: Finished restoring cached node version
9:12:17 AM: v16.14.0 is already installed.
9:12:18 AM: Now using node v16.14.0 (npm v8.3.1)
9:12:18 AM: Started restoring cached build plugins
9:12:18 AM: Finished restoring cached build plugins
9:12:19 AM: Attempting ruby version 2.7.2, read from environment
9:12:21 AM: Using ruby version 2.7.2
9:12:21 AM: Using PHP version 8.0
9:12:21 AM: Installing dependencies from Pipfile
9:12:23 AM: Installing dependencies from Pipfile.lock (f73ca9)...
9:12:23 AM: To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
9:12:23 AM: Pipenv dependencies installed
9:12:24 AM: Python version set to Python 3.8.10
9:12:24 AM: Started restoring cached node modules
9:12:24 AM: Finished restoring cached node modules
9:12:25 AM: Started restoring cached go cache
9:12:25 AM: Finished restoring cached go cache
9:12:25 AM: go version go1.16.5 linux/amd64
9:12:25 AM: go version go1.16.5 linux/amd64
9:12:25 AM: Installing missing commands
9:12:25 AM: Verify run directory
9:12:27 AM: ​
9:12:27 AM: ────────────────────────────────────────────────────────────────
9:12:27 AM:   Netlify Build                                                 
9:12:27 AM: ────────────────────────────────────────────────────────────────
9:12:27 AM: ​
9:12:27 AM: ❯ Version
9:12:27 AM:   @netlify/build 26.3.14
9:12:27 AM: ​
9:12:27 AM: ❯ Flags
9:12:27 AM:   baseRelDir: true
9:12:27 AM:   buildId: 6220bea081a321d240dec9c6
9:12:27 AM:   deployId: 6220bea081a321d240dec9c8
9:12:27 AM: ​
9:12:27 AM: ❯ Current directory
9:12:27 AM:   /opt/build/repo
9:12:27 AM: ​
9:12:27 AM: ❯ Config file
9:12:27 AM:   No config file was defined: using default values.
9:12:27 AM: ​
9:12:27 AM: ❯ Context
9:12:27 AM:   production
9:12:27 AM: ​
9:12:27 AM: ────────────────────────────────────────────────────────────────
9:12:27 AM:   1. Build command from Netlify app                             
9:12:27 AM: ────────────────────────────────────────────────────────────────
9:12:27 AM: ​
9:12:27 AM: $ make build && pipenv run djlint _site/
9:12:27 AM: rm -rf _site
9:12:27 AM: npx @11ty/eleventy --config=eleventy.js
9:12:29 AM: [11ty] Writing _site/index.html from ./index.njk
9:12:29 AM: [11ty] Copied 1 file / Wrote 1 file in 0.20 seconds (v1.0.0)
9:12:29 AM: bash: pipenv: command not found
9:12:29 AM: ​
9:12:29 AM: ────────────────────────────────────────────────────────────────
9:12:29 AM:   "build.command" failed                                        
9:12:29 AM: ────────────────────────────────────────────────────────────────
9:12:29 AM: ​
9:12:29 AM:   Error message
9:12:29 AM:   Command failed with exit code 127: make build && pipenv run djlint _site/
9:12:29 AM: ​
9:12:29 AM:   Error location
9:12:29 AM:   In Build command from Netlify app:
9:12:29 AM:   make build && pipenv run djlint _site/
9:12:29 AM: ​
9:12:29 AM:   Resolved config
9:12:29 AM:   build:
9:12:29 AM:     command: make build && pipenv run djlint _site/
9:12:29 AM:     commandOrigin: ui
9:12:29 AM:     publish: /opt/build/repo/_site
9:12:29 AM:     publishOrigin: ui
9:12:30 AM: Caching artifacts
9:12:30 AM: Started saving node modules
9:12:30 AM: Finished saving node modules
9:12:30 AM: Started saving python virtualenv
9:12:30 AM: Finished saving python virtualenv
9:12:30 AM: Started saving build plugins
9:12:30 AM: Finished saving build plugins
9:12:30 AM: Started saving pip cache
9:12:30 AM: Creating deploy upload records
9:12:30 AM: Finished saving pip cache
9:12:30 AM: Started saving emacs cask dependencies
9:12:30 AM: Finished saving emacs cask dependencies
9:12:30 AM: Started saving maven dependencies
9:12:30 AM: Finished saving maven dependencies
9:12:30 AM: Started saving boot dependencies
9:12:30 AM: Finished saving boot dependencies
9:12:30 AM: Started saving rust rustup cache
9:12:30 AM: Finished saving rust rustup cache
9:12:30 AM: Started saving go dependencies
9:12:30 AM: Finished saving go dependencies
9:12:30 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:12:31 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:12:30 AM: Failing build: Failed to build site
9:12:31 AM: Finished processing build request in 26.084147427s

Hey there, @al3x :wave:

My apologies for the delay-- we appreciate your patience.

Are you still encountering this error since you first wrote in? If so, can you please share what additional debugging steps you have taken in the past week? Lastly, if you are still encountering this, could you share your project repo with us so that we could look into this further?

thanks so much!

Hello @hillary , yeah unfortunately the error seems still to be there. I’m following the build recommendations and the docs but it appears pipenv is not available in the default path:

From https://app.netlify.com/sites/cocky-morse-eb7890/deploys/62440b3acc0958496b8c316b build:

3:48:27 AM: To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
[cut]
3:48:30 AM: bash: pipenv: command not found

Hey there, @al3x :wave:

Thanks for your patience here while the Support team looked into this.

Can you share why you are using this environment? I believe that you should be able to install your packages directly instead of using Pipenv.

Here are the djlint docs: djlint · PyPI, as well as our docs: Manage build dependencies | Netlify Docs

If installing packages directly doesn’t work, please link us to your logs so that we can continue debugging.