Hello, I am facing issue with pants installation o...
# general
f
Hello, I am facing issue with pants installation on my
mac M1 silicon
. I have done the following: Python3 via pyenv -
3.11.7
pants.tomal has version ->>
2.26
I am installing pants via
brew install pants
when i do
pants --version
--> getting verison as
2
. When trying to run any command i am getting below error :
Copy code
usage: /opt/homebrew/bin/pants [-h] [-V] {bootstrap-cache-key,bootstrap-version,help} ...
/opt/homebrew/bin/pants: error: argument {bootstrap-cache-key,bootstrap-version,help}: invalid choice: 'export' (choose from 'bootstrap-cache-key', 'bootstrap-version', 'help')
Can someone please help me here what should i do?
w
In the pants.toml, you're using
2.26
or
2.26.0
?
f
2.26.0
w
Can you create a new empty (unrelated to any of your projects) somewhere and run
pants --version
in there? It should ask to create a pants.toml
Copy code
⏺ scratch/testpants % pants --version
No Pants configuration was found at or above /Users/sj/Developer/scratch/testpants.
Would you like to configure /Users/sj/Developer/scratch/testpants as a Pants project? (Y/n): y
Fetching latest stable Pants version since none is configured
Creating /Users/sj/Developer/scratch/testpants/pants.toml and configuring it to use Pants 2.26.0
07:52:37.62 [INFO] Initializing scheduler...
07:52:37.71 [INFO] Scheduler initialized.
2.26.0
f
I have creates a new folder outside of the current project and then ran
pants --version
. It started downloading .. Downloading https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.9.18%2B20240107-aarch64-apple-darwin-install_only No Pants configuration was found at or above /Users/yyadav/testpants. Would you like to configure /Users/yyadav/testpants as a Pants project? (Y/n): Y Fetching latest stable Pants version since none is configured Creating /Users/yyadav/testpants/pants.toml and configuring it to use Pants 2.26.0 Downloading https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9%2B20240415-aarch64-apple-darwin-install_only 2 yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $ pants --version 2 yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $
w
What;'s the result of
ls -a
and
cat pants.toml
?
f
cat pants.toml >> [GLOBAL] pants_version = "2.26.0"
-rw-r--r--@ 1 yyadav staff 34 May 26 13:56 pants.toml
w
34 May 26?
I'm guessing that's size
This is bizarre
f
34 - yes thats the file size
w
PANTS_BOOTSTRAP_VERSION=report pants
?
f
Shall i run it or export it ?
w
if you run that command, you get the version of scie-pants
f
Copy code
PANTS_BOOTSTRAP_VERSION=report pants
usage: /Users/yyadav/.local/bin/pants [-h] [-V] {bootstrap-cache-key,bootstrap-version,help} ...

positional arguments:
  {bootstrap-cache-key,bootstrap-version,help}
    bootstrap-cache-key
                        Print an opaque value that can be used as a key for accurate and safe caching of the pants bootstrap directories. (Added in
                        bootstrap version 1.)
    bootstrap-version   Print a version number for the bootstrap script itself. Distributed scripts (such as reusable CI formulae) that use these
                        bootstrap tools should set PANTS_BOOTSTRAP_TOOLS to the minimum script version for the features they require. For example,
                        if 'some-tool' was added in version 123: PANTS_BOOTSTRAP_TOOLS=123 ./pants some-tool (Added in bootstrap version 1.)
    help                Show this help.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
w
Hmm, was hoping for something more like:
Copy code
scratch/testpants % PANTS_BOOTSTRAP_VERSION=report pants
0.12.3
Though I'm confused why, above, you have
usage: /opt/homebrew/bin/pants
and here you have
usage: /Users/yyadav/.local/bin/pants
f
Could be due to 1. Initially installed via brew --> opt/ 2. later tried with curl -->.local/bin
Copy code
PANTS_BOOTSTRAP_VERSION=report pants
0.12.3
usage: /Users/yyadav/.local/bin/pants [-h] [-V] {bootstrap-cache-key,bootstrap-version,help} ...

positional arguments:
  {bootstrap-cache-key,bootstrap-version,help}
    bootstrap-cache-key
                        Print an opaque value that can be used as a key for accurate and safe caching of the pants bootstrap directories. (Added in
                        bootstrap version 1.)
    bootstrap-version   Print a version number for the bootstrap script itself. Distributed scripts (such as reusable CI formulae) that use these
                        bootstrap tools should set PANTS_BOOTSTRAP_TOOLS to the minimum script version for the features they require. For example,
                        if 'some-tool' was added in version 123: PANTS_BOOTSTRAP_TOOLS=123 ./pants some-tool (Added in bootstrap version 1.)
    help                Show this help.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
zsh: command not found: 0.12.3
w
What was the difference between this most recent one, where you had the 0.12.3 appear, and the previous one, where it didn;t?
f
Reactivated the virtual env
Copy code
pyenv versions
  system
  3.11.7
  3.11.7/envs/venv_sbp_datalake
* venv_sbp_datalake --> /Users/yyadav/.pyenv/versions/3.11.7/envs/venv_sbp_datalake (set by PYENV_VERSION environment variable)

 python --version
Python 3.11.7
waiut
I don't think that is the case
w
zsh: command not found: 0.12.3
You also got this, which would happen if 0.12.3 was written down. In either case, pants comes with its own interpreter
f
some how when i rerun it.. now doesn't show anythin
Copy code
export ARCHFLAGS="-arch x86_64"

# Path to your oh-my-zsh installation.  
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will  
# load a random theme each time oh-my-zsh is loaded, in which case,  
# to know which specific one was loaded, run: echo $RANDOM_THEME  
# See <https://github.com/ohmyzsh/ohmyzsh/wiki/Themes>  
ZSH_THEME="maran"

# Set list of themes to pick from when loading at random  
# Setting this variable when ZSH_THEME=random will cause zsh to load  
# a theme from this variable instead of looking in $ZSH/themes/  
# If set to an empty array, this variable will have no effect.  
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.  
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.  
# Case-sensitive completion must be off. _ and - will be interchangeable.  
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior  
# zstyle ':omz:update' mode disabled # disable automatic updates  
# zstyle ':omz:update' mode auto # update automatically without asking  
# zstyle ':omz:update' mode reminder # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).  
# zstyle ':omz:update' frequency 13

# Uncomment the following line if pasting URLs and other text is messed up.  
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.  
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.  
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.  
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.  
# You can also set it to another string to have that shown instead of the default red dots.  
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"  
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)  
# COMPLETION_WAITING_DOTS="true"

source $ZSH/oh-my-zsh.sh

alias pycharm='open -na "PyCharm CE.app" --args "$@"'
if command -v pyenv 1>/dev/null 2>&1; then
 eval "$(pyenv init -)"
fi

export SCIE_BOOT=bootstrap-tools
export PATH="$(pwd):$PATH"
This is what i have in my .zshrc
w
export SCIE_BOOT=bootstrap-tools
can you delete this?
f
Shall i delete the cache before re running?
rm -rf $HOME/Library/Caches/nce
w
Delete that line, re-load your zsh, and then try using pants again
Shouldn't need to delete any files
f
pants --version 2 yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $ yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $ pants tailor usage: /opt/homebrew/bin/pants [-h] [-V] {bootstrap-cache-key,bootstrap-version,help} ... /opt/homebrew/bin/pants: error: argument {bootstrap-cache-key,bootstrap-version,help}: invalid choice: 'tailor' (choose from 'bootstrap-cache-key', 'bootstrap-version', 'help')
w
did you re-load zsh?
f
yes, did source it
w
Run
printenv
and look for anything related to SCIE or PANTS
Copy code
scratch/testpants % SCIE_BOOT=bootstrap-tools pants --version 
2
This is certainly the problem
f
Copy code
PATH=/Users/yyadav/repos/sbp-datalake:/Users/yyadav/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/yyadav/repos/sbp-datalake:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/yyadav/.cargo/bin
__CFBundleIdentifier=com.jetbrains.pycharm.ce
SHELL=/bin/zsh
TERM=xterm-256color
COMMAND_MODE=unix2003
TERMINAL_EMULATOR=JetBrains-JediTerm
LC_CTYPE=UTF-8
XPC_SERVICE_NAME=0
IDEA_INITIAL_DIRECTORY=/
HOME=/Users/yyadav
SHLVL=1
PWD=/Users/yyadav/repos/sbp-datalake
OLDPWD=/Users/yyadav/repos/sbp-datalake
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:
ARCHFLAGS=-arch x86_64
ZSH=/Users/yyadav/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43
PYENV_SHELL=zsh
_=/usr/bin/printenv
w
You might have to delete the
.pants.d
and yeah, maybe even wipe out the
~/.cache/pants
and ``~/Library/Caches/nce` ` I'd also probably remove the pants from ~/.local and I'd also brew remove pants, and then re-install it
Something seems to be borked, and having SCIE stuff in your envs seems like the culprit, especially as when I ran that, I received the same result
Copy code
scratch/testpants % SCIE_BOOT=bootstrap-tools pants tailor   
usage: /opt/homebrew/bin/pants [-h] [-V] {bootstrap-cache-key,bootstrap-version,help} ...
/opt/homebrew/bin/pants: error: argument {bootstrap-cache-key,bootstrap-version,help}: invalid choice: 'tailor' (choose from 'bootstrap-cache-key', 'bootstrap-version', 'help')
f
aah.. thank you. Let me try this
w
This is what happened basically (though I can't recall which command lists everything)
Copy code
scratch/testpants % SCIE_BOOT=list pants
Error: `SCIE_BOOT=list` was found in the environment but "list" does not correspond to any scie-pants commands.

Isolates your Pants from the elements.

Please select from the following boot commands:

<default> (when SCIE_BOOT is not set in the environment)  Detects the current Pants installation and launches it.
bootstrap-tools                                           Introspection tools for the Pants bootstrap process.
update                                                    Update scie-pants.

You can select a boot command by setting the SCIE_BOOT environment variable.
Copy code
scratch/testpants % SCIE=list pants       
scie-pants
bootstrap-tools
pants
pants-debug
update
f
1. I uninstalled pants 2. created new folder 3. reinstalled pants via brew install pants now receiving below
SCIE=list pants
`No valid Python interpreter found. For
pants_version = "2.26.0"
, Pants requires Python 3.7, 3.8, or 3.9 to run. Please check that a valid interpreter is installed and on your $PATH.`
same for
pants --version
Copy code
python --version 
Python 3.11.7
w
Yeah, go generally, don't add anything like
SCIE_
to the start/env unless you know what's going on.
pants
alone should be enough. Pants also comes bundled with a python version that it needs.... It feels like yours is running the old bash script, but maybe brew install python 3.9 and try that? Shouldn't be required, but maybe there is a bug
f
Umm this is very weird... tries to bootstrap and now after it complains for version not available
Copy code
Bootstrapping Pants using /opt/homebrew/bin/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Installing pantsbuild.pants==2.26.0 into a virtual environment at /Users/yyadav/.cache/pants/setup/bootstrap-Darwin-arm64/2.26.0_py39
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.26.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.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rc0, 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.16.1rc0, 2.16.1rc3, 2.16.1rc4, 2.16.1, 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.17.0rc2, 2.17.0rc3, 2.17.0rc4, 2.17.0rc5, 2.17.0, 2.17.1rc0, 2.17.1rc1, 2.17.1rc2, 2.17.1rc3, 2.17.1, 2.18.0.dev0, 2.18.0.dev1, 2.18.0.dev3, 2.18.0.dev4, 2.18.0.dev5, 2.18.0.dev6, 2.18.0.dev7, 2.18.0a0)
ERROR: No matching distribution found for pantsbuild.pants==2.26.0
w
Are you in your project folder? Or the empty one?
f
empty one
w
Is there a
pants
file? This all looks like it's trying to build using the old script
f
How can i update the script? Or use new one ?
w
The script shouldn't be used - the scie-pants is the runner now, and what you're seeing above feels like legacy
which pants
?
f
/Users/yyadav/repos/sbp-datalake/pants
yes, it is taking a old script. from the project folder
w
Whelp, that's the problem
Probably due to
PATH=/Users/yyadav/repos/sbp-datalake:
f
yes, it is set
w
Exactly, when you call
pants
it's hitting that script instead of the brew install
f
Now i have removed the
path
sourced it again ..
Copy code
yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $ pants --version
Downloading <https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.9.18%2B20240107-aarch64-apple-darwin-install_only>
No Pants configuration was found at or above /Users/yyadav/testpants.
Would you like to configure /Users/yyadav/testpants as a Pants project? (Y/n): Y
Fetching latest stable Pants version since none is configured
Setting [GLOBAL] pants_version = "2.26.0" in /Users/yyadav/testpants/pants.toml
Backing up /Users/yyadav/testpants/pants.toml to /Users/yyadav/testpants/pants.toml.bak
Downloading <https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9%2B20240415-aarch64-apple-darwin-install_only>
Downloading <https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.11.9%2B20240415-aarch64-apple-darwin-install_only>
2
yyadav@sbplt45lfqdhj:/Users/yyadav/testpants $ pants --version
2
w
printenv
?
f
Copy code
TERM_SESSION_ID=w0t0p0:1BF823C5-54E5-4434-88AD-A5DF73E9BAD0
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.U168v9ArdA/Listeners
LC_TERMINAL_VERSION=3.5.14
COLORFGBG=7;0
ITERM_PROFILE=Default
XPC_FLAGS=0x0
LANG=nl_NL.UTF-8
PWD=/Users/yyadav/testpants
SHELL=/bin/zsh
__CFBundleIdentifier=com.googlecode.iterm2
TERM_FEATURES=T3LrMSc7UUw9Ts3BFGsSyHNoSxF
TERM_PROGRAM_VERSION=3.5.14
TERM_PROGRAM=<http://iTerm.app|iTerm.app>
PATH=/Users/yyadav/testpants:/Users/yyadav/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/Users/yyadav/.cargo/bin:/Applications/iTerm.app/Contents/Resources/utilities
LC_TERMINAL=iTerm2
COLORTERM=truecolor
COMMAND_MODE=unix2003
TERM=xterm-256color
TERMINFO_DIRS=/Applications/iTerm.app/Contents/Resources/terminfo:/usr/share/terminfo
HOME=/Users/yyadav
TMPDIR=/var/folders/gk/xfkvrv8s47b5l3rhs1sj9q4h0000gq/T/
USER=yyadav
XPC_SERVICE_NAME=0
SHLVL=1
OLDPWD=/Users/yyadav
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
INFOPATH=/opt/homebrew/share/info:
ARCHFLAGS=-arch x86_64
ZSH=/Users/yyadav/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43
PYENV_SHELL=zsh
SCIE_BOOT=bootstrap-tools
PS1=%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%}$(git_prompt_info) %(!.#.$)
LDFLAGS=-L/opt/homebrew/opt/openssl@3/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib
CPPFLAGS=-I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include
PKG_CONFIG_PATH=/opt/homebrew/opt/openssl@3/lib/pkgconfig:/opt/homebrew/opt/readline/lib/pkgconfig:/opt/homebrew/opt/zlib/lib/pkgconfig
_=/usr/bin/printenv
w
SCIE_BOOT=bootstrap-tools
is still there
f
i see this
Yey, it works now.. How can i make it work in my project ? Shall i remove the script. Also to upgrade what should i do ?
w
Assuming your project worked before,
pants
will defer to the local script if there is one. That might mean you need to re-install python3.9, but the pants runner shouldn't affect anything
f
Yes, it did worked before.
A big thanks to you mate. You saved alot of time and efforts.
w
👍