pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.27k stars 626 forks source link

No matching distribution found for pantsbuild.pants #19447

Closed dijonkitchen closed 1 year ago

dijonkitchen commented 1 year ago

Describe the bug When running pants in a devcontainer, the proper version can't be found. I don't see a lot of v2 versions in the list of versions either. My repo had no problems previously with a local macOS install or on linux with linuxbrew in Github Codespaces.

$ pants
Bootstrapping Pants 2.15.0 using cpython 3.9.16
Installing pantsbuild.pants==2.15.0 into a virtual environment at /home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/bindings/venvs/2.15.0
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.15.0 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 2.16.0.dev5, 2.16.0.dev6, 2.16.0.dev7, 2.16.0a0, 2.16.0a1, 2.16.0rc0, 2.16.0rc1, 2.16.0rc2, 2.16.0rc3, 2.16.0rc4, 2.16.0rc5, 2.16.0rc6, 2.16.0rc7, 2.16.0, 2.17.0.dev0, 2.17.0.dev1, 2.17.0.dev2, 2.17.0.dev3, 2.17.0.dev4, 2.17.0.dev5, 2.17.0a1, 2.17.0rc0, 2.17.0rc1, 2.18.0.dev0, 2.18.0.dev1, 2.18.0.dev3, 2.18.0.dev4)
ERROR: No matching distribution found for pantsbuild.pants==2.15.0
Install failed: Command '['/home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/bindings/venvs/2.15.0/bin/python', '-sE', '-m', 'pip', '--disable-pip-version-check', '--no-python-version-warning', '--log', PosixPath('/home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/bindings/venvs/2.15.0/pants-install.log'), 'install', '--quiet', '--find-links', 'file:///home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/bindings/find_links/2.15.0/214abc14/index.html', '--progress-bar', 'off', 'pantsbuild.pants==2.15.0']' returned non-zero exit status 1.
More information can be found in the log at: /home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/bindings/logs/install.log

Error: Isolates your Pants from the elements.

Please select from the following boot commands:

scie-pants
bootstrap-tools
pants
pants-debug
update

You can select a boot command by passing it as the 1st argument or else by setting the SCIE_BOOT environment variable.

ERROR: Failed to establish atomic directory /home/vscode/.cache/nce/0de72f83a1a3c7d9abfa1aec200d81e160d3aea11423c652ee05b24a44adb298/locks/install-d67a102e081abafc9504e8dd671c45344e668ab42e633984734ee90cb19ec39f. Population of work directory failed: Boot binding command failed: exit status: 1

Pants version 2.15.0

OS Are you encountering the bug on MacOS, Linux, or both? I'm on macOS, but running this in a linux container.

Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. My .devcontainer file:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
    "name": "Python 3",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",

    // Features to add to the dev container. More info: https://containers.dev/features.
    // "features": {},

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    "postCreateCommand": "curl --proto '=https' --tlsv1.2 -fsSL https://static.pantsbuild.org/setup/get-pants.sh | bash",

    // Configure tool-specific properties.
    // "customizations": {},

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"
}

On startup, it looks successful. I also added it to my PATH.

Running the postCreateCommand from devcontainer.json...

[7865 ms] Start: Run in container: /bin/sh -c curl --proto '=https' --tlsv1.2 -fsSL https://static.pantsbuild.org/setup/get-pants.sh | bash
Downloading and installing the pants launcher ...
Installed the pants launcher from https://github.com/pantsbuild/scie-pants/releases/latest/download/scie-pants-linux-aarch64 to /home/vscode/bin/pants
/home/vscode/bin/pants is not on the PATH.
You'll either need to invoke /home/vscode/bin/pants explicitly or else add /home/vscode/bin to your shell's PATH.

Running `pants` in a Pants-enabled repo will use the version of Pants configured for that repo.
In a repo not yet Pants-enabled, it will prompt you to set up Pants for that repo.
Done. Press any key to close the terminal.
WorkerPants commented 1 year ago

Welcome to the Pantsbuild Community. This looks like your first issue here. Thanks for taking the time to write it.

If you haven't already, feel free to come say hi on Slack.

If you have questions, or just want to surface this issue, check out the #development channel. (If you want to check it out without logging in, check out our Linen mirror)

Thanks again, and we look forward to your next Issue/PR :smile:!

huonw commented 1 year ago

Sorry for the trouble.

What's the output of uname -a within the container? I'm guessing it's Linux ARM64?

Pants has some platform-specific native code, and, 2.16.0 is the first stable release that includes support for Linux ARM64: previous releases only support:

(Compare the various wheels files between https://pypi.org/project/pantsbuild.pants/2.15.0/#files and https://pypi.org/project/pantsbuild.pants/2.16.0/#files)

Thus, assuming my guess is correct, 2.15.0 will not work on the local container. Approaches to fix this:

  1. continue using Pants 2.15, but only run it natively on macOS
  2. continue using Pants 2.15, but run it within a x86-64 Linux container, instead of ARM (likely to be very slow, if your experience of running emulated x865-64 containers on ARM Mac is anything like mine!)
  3. upgrade to Pants 2.16, and hopefully be able to run within the Linux container 'normally'

I'd recommend 3! 😄

dijonkitchen commented 1 year ago
# uname -a
Linux 9bfbeff5f3e7 5.15.49-linuxkit-pr #1 SMP PREEMPT Thu May 25 07:27:39 UTC 2023 aarch64 GNU/Linux

Yes, I'm on an Apple Silicon (ARM) M1 Macbook Pro.

Looks like bumping up to 2.16.0 in the pants.toml did the trick. Maybe this should be included in the docs somewhere?

Thanks!

kaos commented 1 year ago

Maybe this should be included in the docs somewhere?

Yes we agree, so it is (but maybe could be in more places?)

image

Closing as answered.