<#15293 Failure to running requirement's binary sc...
# github-notifications
c
#15293 Failure to running requirement's binary scripts using subprocess.run or os.system or ... (FileNotFoundError: [Errno 2] No such file or directory: '...') Issue created by AlirezaRoshanzamir Bug description I believe this issue is very similar to the #12651 issue. Consider the following example:
Copy code
.
├── BUILD
├── main.py
├── pants.toml
└── test_main.py
Copy code
# pants.toml
[GLOBAL]
pants_version = '2.10.0'
backend_packages = ['pants.backend.python']
Copy code
# BUILD
python_requirement(name='python_requirement', requirements=['cowsay'])
python_sources(name='python_sources')
python_tests(name='python_tests')
Copy code
# main.py
import subprocess
import cowsay

def cowsay_hello_using_subprocess():
    subprocess.run(['cowsay', 'hello'])

def cowsay_hello_using_module():
    cowsay.cow('hello')
Copy code
# test_main.py
import main

def test_cowsay_hello_using_subprocess():
    main.cowsay_hello_using_subprocess()

def test_cowsay_hello_using_module():
    main.cowsay_hello_using_module()
Running the
./pants test :python_tests
results
1 failed, 1 passed
. The
test_cowsay_hello_using_subprocess
test fails:
FileNotFoundError: [Errno 2] No such file or directory: 'cowsay'
Actually, a similar issue occurred if we define
pex_binary
for the source code. But, thanks to #12651, using
execution_mode='venv'
solves the issue there. In my opinion, there should be a similar solution for the intermediate pex files created for other goals and targets. Am I thinking right? Pants version: 2.10.0 OS: Ubuntu 20.04.3 LTS pantsbuild/pants