rapid-bird-79300
02/27/2024, 8:03 PMpdftotext
and followed there guide on adding os dependencies https://github.com/jalan/pdftotext?tab=readme-ov-file#macos
Running with poetry I can install dependencies and run tests in IDE. When running with pants I'm getting the following error
stderr:
pid 94763 -> /Users/nick/.cache/pants/named_caches/pex_root/venvs/a80988bb3f0e73c2683977f47507e857bda85f08/ac9399dd73ed3d731f384971c893eaef292bacba/bin/python -sE /Users/nick/.cache/pants/named_caches/pex_root/venvs/a80988bb3f0e73c2683977f47507e857bda85f08/ac9399dd73ed3d731f384971c893eaef292bacba/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --use-deprecated legacy-resolver --isolated -q --cache-dir /Users/nick/.cache/pants/named_caches/pex_root/pip_cache wheel --no-deps --wheel-dir /Users/nick/.cache/pants/named_caches/pex_root/built_wheels/sdists/pdftotext-2.2.2.tar.gz/2a9aa89bc62022408781b39d188fabf5a3ad1103b6630f32c4e27e395f7966ee/cp310-cp310-macosx_14_0_arm64.4e5bd424ef6b48eabc1dce8eb560babf.work /Users/nick/.cache/pants/named_caches/pex_root/downloads/2a9aa89bc62022408781b39d188fabf5a3ad1103b6630f32c4e27e395f7966ee/pdftotext-2.2.2.tar.gz --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
Error: $HOME must be set to run brew.
running bdist_wheel
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.macosx-13.5-arm64-cpython-310
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -DPOPPLER_CPP_AT_LEAST_0_58_0=1 -DPOPPLER_CPP_AT_LEAST_0_88_0=1 -I/usr/local/include -I/Users/nick/.cache/pants/named_caches/pex_root/venvs/a80988bb3f0e73c2683977f47507e857bda85f08/ac9399dd73ed3d731f384971c893eaef292bacba/include -I/Users/nick/.pyenv/versions/3.10.5/include/python3.10 -c pdftotext.cpp -o build/temp.macosx-13.5-arm64-cpython-310/pdftotext.o -Wall -mmacosx-version-min=10.9 -std=c++11
pdftotext.cpp:3:10: fatal error: 'poppler/cpp/poppler-document.h' file not found
#include <poppler/cpp/poppler-document.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pdftotext
ERROR: Failed to build one or more wheels
any suggestions on how to resolve this?curved-manchester-66006
02/27/2024, 8:33 PMError: $HOME must be set to run brew.
In a more centralized corporate setting, you could also build the needed wheels with cibuildwheel or whatnot and then upload them to an internal PyPirapid-bird-79300
02/27/2024, 9:24 PMcurved-manchester-66006
02/27/2024, 9:42 PMrapid-bird-79300
02/27/2024, 9:46 PMrapid-bird-79300
02/27/2024, 9:47 PM-q
) and it works directly 🤔rapid-bird-79300
02/27/2024, 9:48 PMpants test
or pants check
which is odd. I'm debugging with --keep-sandboxes
rapid-bird-79300
02/27/2024, 9:50 PM__run.sh
$ cat __run.sh
#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /private/var/folders/9r/wq3dmr1s11vbdxs93rj0017w0000gn/T/pants-sandbox-SNCYX1
env -i CPPFLAGS= LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LDFLAGS= PATH=$'/Users/nick/.pyenv/libexec:/Users/nick/.pyenv/plugins/python-build/bin:/Users/nick/.pyenv/plugins/pyenv-virtualenv/bin:/Users/nick/.pyenv/plugins/pyenv-update/bin:/Users/nick/.pyenv/plugins/pyenv-doctor/bin:/Users/nick/.cargo/bin:/Users/nick/.nvm/versions/node/v18.7.0/bin:/Users/nick/.pyenv/plugins/pyenv-virtualenv/shims:/Users/nick/.pyenv/shims:/Users/nick/.pyenv/bin:/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/munki:/Users/nick/go/bin' PEX_IGNORE_RCFILES=true PEX_PYTHON=/Users/nick/Library/Caches/nce/cc4f254e87ec09cf462fdd6bc2a868254c8e2b5a398cbde07f020e2e19ebba56/bindings/venvs/2.17.1/bin/python PEX_ROOT=.cache/pex_root /Users/nick/Library/Caches/nce/cc4f254e87ec09cf462fdd6bc2a868254c8e2b5a398cbde07f020e2e19ebba56/bindings/venvs/2.17.1/bin/python ./pex --tmpdir .tmp --jobs 9 --pip-version 23.1.2 --python-path $'/Users/nick/.pyenv/versions/3.10.13/bin:/Users/nick/.pyenv/versions/3.10.5/bin:/Users/nick/.pyenv/versions/3.11.4/bin:/Users/nick/.pyenv/versions/3.9.5/bin:/Users/nick/.pyenv/versions/py-3.10.13/bin:/Users/nick/.pyenv/versions/python-3.10.13/bin:/Users/nick/.pyenv/versions/python-3.10.3/bin:/Users/nick/.pyenv/libexec:/Users/nick/.pyenv/plugins/python-build/bin:/Users/nick/.pyenv/plugins/pyenv-virtualenv/bin:/Users/nick/.pyenv/plugins/pyenv-update/bin:/Users/nick/.pyenv/plugins/pyenv-doctor/bin:/Users/nick/.cargo/bin:/Users/nick/.nvm/versions/node/v18.7.0/bin:/Users/nick/.pyenv/plugins/pyenv-virtualenv/shims:/Users/nick/.pyenv/shims:/Users/nick/.pyenv/bin:/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/munki:/Users/nick/go/bin' --output-file mypy.pex --no-emit-warnings --venv --seed verbose --venv-site-packages-copies --python /Users/nick/.pyenv/versions/3.10.5/bin/python3.10 --console-script mypy $'--sources-directory=source_files' --lock tools/python/ats-file-processor/pants-resolve.lock --no-pypi $'--index=<https://pypi.org/simple/>' --manylinux manylinux2014 --layout packed
will try to debug thisrapid-bird-79300
02/27/2024, 9:50 PMcurved-manchester-66006
02/27/2024, 9:59 PM__run.sh
and comparing that to running the pex comand at the end without all the preamblerapid-bird-79300
02/27/2024, 10:00 PMrapid-bird-79300
02/27/2024, 10:02 PMpants check
and now it's working 🙃rapid-bird-79300
02/27/2024, 10:03 PMrapid-bird-79300
02/27/2024, 10:05 PMrapid-bird-79300
02/27/2024, 10:05 PMrapid-bird-79300
02/27/2024, 10:09 PMrapid-bird-79300
02/27/2024, 10:16 PMHOME=/Users/nick
fixed itrapid-bird-79300
02/27/2024, 10:16 PMrapid-bird-79300
02/27/2024, 10:23 PMtest
and check
goals (pytest + mypy)rapid-bird-79300
02/27/2024, 10:35 PM[subprocess-environment]
env_vars.add = [
"HOME",
]
to my pants.toml
curved-manchester-66006
02/28/2024, 4:05 PMkind-traffic-20936
03/10/2024, 3:59 AM