Use pip with JFrog CLI
Configure and run jf pip with JFrog Artifactory for Python package installs and build-info collection.
Run pip install with Artifactory integration and optional build-info collection.
This topic covers the following tasks:
When to Use
Use jf pip if your Python project uses pip with requirements.txt for dependency management. For Pipenv-based projects (with Pipfile), use jf pipenv. For Poetry-based projects (with pyproject.toml), use jf poetry. For uv-managed projects (with pyproject.toml and uv.lock), use jf uv.
Package Alias (Ghost Frog)
To run native
pipcommands without thejfprefix, see Use JFrog CLI Package Alias.
Package manager version compatibility
Before you begin, review Supported Package Manager Versions for the pip versions supported and tested with JFrog CLI.
Prerequisites
- pip must be installed (Python 3.6+), and the
pipbinary must be available in your$PATH. On macOS and Linux systems where onlypip3is installed, create a symlink before usingjf pip:sudo ln -s $(which pip3) /usr/local/bin/pip - Run
jf pip-configin the project directory before the first install. - Configure a server with
jf config addorjf c add. If your access token is a reference token (non-JWT), also supply a username to enable basic authentication for pip:jf config add --user=<username> --access-token=<token> --url=<platform-url> - Authentication to Artifactory is required.
- Using a Python virtual environment is required for accurate build-info. Packages installed outside a clean virtual environment before the first
jf pip installwill be missing from build-info records. See Recording All Dependencies for details.
Configuration: jf pip-config
Generate pip build configuration for dependency resolution and deployment. Run this once per project before your first install.
To configure pip for Artifactory:
Synopsis
jf pip-config [options]
Aliases: pipc
Configuration Options
| Flag | Default | Description |
|---|---|---|
--global | false | Set to true for global configuration (all projects). Specific projects can override. |
--repo-deploy | — | Repository for artifacts deployment |
--repo-resolve | — | Repository for dependencies resolution |
--server-id-deploy | — | Artifactory server ID for deployment. Configure with jf config add. |
--server-id-resolve | — | Artifactory server ID for resolution. Configure with jf config add. |
Configuration Examples
View Help
jf pip-config --helpNon-Interactive Configuration with Flags
jf pip-config --server-id-resolve=<server-id> --repo-resolve=<repo-name> --server-id-deploy=<server-id> --repo-deploy=<repo-name>Where:
<server-id>: The server ID configured usingjf config add<repo-name>: The name of the repository in Artifactory
For example:
jf pip-config --server-id-resolve=my-server --repo-resolve=pypi-virtual --server-id-deploy=my-server --repo-deploy=pypi-localWhy Run Config First?
You must run jf pip-config before jf pip install. The config command creates .jfrog/projects/pip.yaml which directs pip to resolve from and deploy to Artifactory repositories. Without it, jf pip does not know where to fetch packages.
Shortcut
In CI/CD, pass all flags non-interactively so the config step is fully automated and reproducible.
Configuration Notes
- Covers twine too: This config also applies to
jf twine uploadfor publishing Python packages. - Run once per project: Re-run when changing repository assignments.
- Resolution and deployment: Use
--repo-resolvefor installing packages and--repo-deployfor publishing.
Expected Output
$ jf pip-config --server-id-resolve=my-server --repo-resolve=pypi-virtual --server-id-deploy=my-server --repo-deploy=pypi-local
[Info] pip build config successfully created.
How to Verify
After running, confirm the configuration exists:
cat .jfrog/projects/pip.yamlBuild: jf pip
Run pip install with Artifactory integration and optional build-info collection.
To run pip with Artifactory integration:
Synopsis
jf pip <pip-arguments> [options]
Aliases: none
Arguments
| Argument | Required | Description |
|---|---|---|
<pip-arguments> | Yes | Arguments and options for the pip command (for example, install, freeze) |
Build Options
| Flag | Default | Description |
|---|---|---|
--build-name | — | Build name for build-info. Requires --build-number. |
--build-number | — | Build number for build-info. Requires --build-name. |
--module | — | Optional module name for build-info. Requires --build-name and --build-number. |
--project | — | JFrog Artifactory project key |
Build Examples
View Help
jf pip --helpInstall Dependencies with Build-Info
jf pip install -r requirements.txt --build-name=<build-name> --build-number=<build-number>Where:
<build-name>is a name for the build (for example,my-python-app)<build-number>is a number or identifier for the build run (for example,1)
For example:
jf pip install -r requirements.txt --build-name=my-python-app --build-number=1Install a Single Package
jf pip install <package-name>For example:
jf pip install requestsExpected Output
A successful jf pip install prints the standard pip output followed by a build-info summary when --build-name and --build-number are provided:
[Info] Running pip install
Collecting requests
Downloading requests-2.28.2-py3-none-any.whl (62 kB)
...
Successfully installed requests-2.28.2
[Info] Collecting build info...
[Info] Build info collected.
If no build-info flags are used, only the standard pip output appears.
How to Verify
After install, confirm the dependency cache was written:
cat .jfrog/projects/deps.cache.jsonTo list installed packages:
pip listRecording All Dependencies
JFrog CLI records installed packages as build-info dependencies. The recorded dependencies are packages installed during the jf pip install command execution. When running inside a Python environment that already has some packages installed, those packages will not be included in the build-info because they were not originally installed by JFrog CLI. A warning message will appear in the log.
To include all packages in the build-info:
-
Prefer a clean virtual environment so every dependency is installed during
jf pip install. -
If packages were installed before the first
jf pip install, JFrog CLI may omit them from.jfrog/projects/deps.cache.json. Re-run install with--no-cache-dirand--force-reinstallso those packages are re-downloaded, recorded in build-info, and cached:jf pip install --no-cache-dir --force-reinstall -r requirements.txt --build-name=<build-name> --build-number=<build-number>Where:
<build-name>: Your build name (must match other steps in the pipeline)<build-number>: Your build number or identifier
The details of installed packages are cached in .jfrog/projects/deps.cache.json at the project root. JFrog CLI uses this cache when assembling build-info.
Important Notes
- pip commands: All standard pip arguments work (
install,install -r requirements.txt,freeze, and others). - Build-info: Use
--build-nameand--build-numberto collect installed package info, then publish withjf rt build-publish. - Publishing:
jf pipis for installing packages. To publish Python packages to Artifactory, usejf twine.
Platform Notes
- Windows: The
.pypircconfiguration file is located at%USERPROFILE%\.pypirc. On macOS/Linux it is at~/.pypirc. - Virtual environments: On Windows, activate with
.\venv\Scripts\activate. On macOS/Linux, usesource venv/bin/activate. - pip vs pip3:
jf pipinternally invokes thepipbinary directly. On systems where onlypip3is available (standard on macOS and Ubuntu 22.04+), you must either create a symlink (sudo ln -s $(which pip3) /usr/local/bin/pip) or use a virtual environment wherepipis present alongsidepip3. Note: usingpip3in your own shell does not affect whatjf pipcalls internally.
CI/CD Example: GitHub Actions
Package Alias (Ghost Frog)
To run
pipwithout thejfprefix, enable Package Alias insetup-jfrog-cliand setJFROG_CLI_GHOST_FROG=true. If you install the tool after the action (for examplesetup-javaorsetup-node), re-pin the alias path toGITHUB_PATH. See Use JFrog CLI Package Alias.
# .github/workflows/build.yml
steps:
- uses: actions/checkout@v4
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Configure pip
run: jf pip-config --server-id-resolve=setup-jfrog-cli-server --repo-resolve=pypi-virtual
- name: Install dependencies
run: jf pip install -r requirements.txt --build-name=my-python-app --build-number=${{ github.run_number }}
- name: Publish build info
run: jf rt build-publish my-python-app ${{ github.run_number }}Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
no config file was found | jf pip-config was not run | Run jf pip-config in the project directory |
404 on jf pip install | Resolution repository does not exist or name is wrong | Verify the repo name matches an existing PyPI virtual repository in Artifactory |
| 401 / 403 errors | Invalid credentials or insufficient permissions | Re-run jf config add with a valid access token. Check repo permissions |
| Build-info missing some dependencies | Packages were installed before JFrog CLI was used | Run jf pip install --no-cache-dir --force-reinstall -r requirements.txt inside a clean virtual environment |
exec: "pip": executable file not found in $PATH when running jf pip | jf pip requires the pip binary in $PATH. On macOS/Linux, only pip3 may be installed | Create a symlink: sudo ln -s $(which pip3) /usr/local/bin/pip, or activate a virtual environment where pip is present. Using pip3 in your shell alone does not fix this. |
pip not found when running pip directly | Wrong Python/pip version or not in PATH | Use pip3 or activate the correct Python virtual environment |
[Warn] couldn't extract payload from Access Token before pip install | Access token is a reference token (non-JWT). pip requires basic auth | Re-configure the server with a username: jf config add --user=<username> --access-token=<token> --url=<url> |
| SSL certificate errors | Corporate proxy or self-signed certificates | Use --insecure-tls on jf config add, or configure your CA bundle |
Enable debug logging: export JFROG_CLI_LOG_LEVEL=DEBUG
Frequently Asked Questions
This section provides answers to frequently asked questions about using pip with JFrog CLI.
FAQs
Q: How do I run pip install with build-info using jf pip?
A: Run jf pip-config once per project to set the resolution repository, then run jf pip install -r requirements.txt --build-name=<build-name> --build-number=<build-number> and publish with jf rt build-publish. See Build: jf pip.
Q: What happens if packages were installed before the first jf pip install?
A: JFrog CLI only records packages installed during a jf pip install run, so pre-existing packages are omitted from build-info. Re-run install with --no-cache-dir --force-reinstall in a clean virtual environment to capture them. See Recording All Dependencies.
Q: What is the difference between jf pip, jf pipenv, and jf poetry?
A: Use jf pip for requirements.txt projects, jf pipenv for Pipfile projects, and jf poetry for pyproject.toml projects managed by Poetry. See When to Use.
Q: What do I need before running jf pip-config?
A: You need pip installed with the pip binary in $PATH, a JFrog CLI server configured with jf config add, and a virtual environment for accurate build-info. See Prerequisites.
Q: Why do I see a reference token warning before pip install?
A: pip requires basic authentication, and reference (non-JWT) access tokens don't carry a username. Re-configure the server with jf config add --user=<username> --access-token=<token> --url=<url>. See Troubleshooting.
Related Topics
Updated about 1 month ago
