FileNotFoundError: [Errno 2] No such file or directory: 'python' - python

I'm trying to to write a simple python app and launch it using TorchX following this Quickstart guide. Following commands are executed in my home directory:
pip3 install "torchx[dev]"
Write a simple python program using vim editor vi my_app.py
# my_app.py
%%writefile my_app.py
import sys
print(f"Hello, {sys.argv[1]}!")
Execute the app via torchx run as torchx run --scheduler local_cwd utils.python --script my_app.py "your name".
And then I get a long error:
Log files located in: /var/folders/h7/qrsyzj5s7hvbkwmv83by9wgc0000gn/T/torchx_hykfxkz3/torchx/torchx_utils_python-vxm9hhpt3k7wtd/python/0
Traceback (most recent call last):
File "/usr/local/bin/torchx", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/torchx/cli/main.py", line 110, in main
run_main(get_sub_cmds(), argv)
File "/usr/local/lib/python3.9/site-packages/torchx/cli/main.py", line 106, in run_main
args.func(args)
File "/usr/local/lib/python3.9/site-packages/torchx/cli/cmd_run.py", line 271, in run
self._run(runner, args)
File "/usr/local/lib/python3.9/site-packages/torchx/cli/cmd_run.py", line 232, in _run
app_handle = runner.run_component(
File "/usr/local/lib/python3.9/site-packages/torchx/runner/api.py", line 147, in run_component
return self.schedule(dryrun_info)
File "/usr/local/lib/python3.9/site-packages/torchx/runner/api.py", line 225, in schedule
app_id = sched.schedule(dryrun_info)
File "/usr/local/lib/python3.9/site-packages/torchx/schedulers/local_scheduler.py", line 748, in schedule
replica = self._popen(
File "/usr/local/lib/python3.9/site-packages/torchx/schedulers/local_scheduler.py", line 688, in _popen
proc = subprocess.Popen(
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/python#3.9/3.9.13/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python'
I have Python 3.9.13 installed on macOS Monterey (version 12.4).
What could be a cause of this error?

Related

Kivy Python - getting "FileNotFoundError: [Errno 2] No such file or directory: 'unzip'"

I tried to create an APK file by using WSL and get this:
# Unpacking Android NDK
# Run ['unzip', '-q', '/home/tarpetos/.buildozer/android/platform/android-ndk-r23b-linux.zip']
# Cwd /home/tarpetos/.buildozer/android/platform
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 11, in <module>
load_entry_point('buildozer==1.4.1.dev0', 'console_scripts', 'buildozer')()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 1024, in run_command
self.target.run_commands(args)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/target.py", line 93, in run_commands
func(args)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/target.py", line 103, in cmd_debug
self.buildozer.prepare_for_build()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 172, in prepare_for_build
self.target.install_platform()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/targets/android.py", line 701, in install_platform
self._install_android_ndk()
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/targets/android.py", line 497, in _install_android_ndk
self.buildozer.file_extract(archive,
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 616, in file_extract
self.cmd(["unzip", "-q", join(cwd, archive)], cwd=cwd)
File "/usr/local/lib/python3.8/dist-packages/buildozer-1.4.1.dev0-py3.8.egg/buildozer/__init__.py", line 289, in cmd
process = Popen(command, **kwargs)
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'unzip'
I have a main.py file and a connection_voice.ogg file in the same directory and at first I thought the problem was connecting the audio file. But now I understand that the problem is not in the audio file.
music = SoundLoader.load('connection_voice.ogg')
if music:
music.play()
And I don't understand what an 'unzip' file or directory is. Please give some advice
So, to solve this you need to enter to terminal sudo apt-get install unzip. And than this problem will be solved.

Error in 'System_path_to_tesseract.exe'. Tesseract not found error in linux

I'm trying to use pytesseract library on linux but receiving the following error.
How to solve this error log
Traceback (most recent call last):
File "/home/rawnewton/.local/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 254, in run_tesseract
proc = subprocess.Popen(cmd_args, **subprocess_args())
File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'System_path_to_tesseract.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/2E50C9C750C995CD/Projects/Public/MajorProject/image_text.py", line 58, in <module>
text = pytesseract.image_to_string(cropped)
File "/home/rawnewton/.local/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 416, in image_to_string
return {
File "/home/rawnewton/.local/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 419, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "/home/rawnewton/.local/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 286, in run_and_get_output
run_tesseract(**kwargs)
File "/home/rawnewton/.local/lib/python3.10/site-packages/pytesseract/pytesseract.py", line 258, in run_tesseract
raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: System_path_to_tesseract.exe is not installed or it's not in your PATH. See README file for more information.
I have installed it using the following commands:
pip install tesseract
pip install tesseract-ocr
I am using Xubuntu version 20.04.

Windows 10 Error: FileNotFoundError: The System cannot find the file specified subprocess while executing an .exe

I get an error every time i want to start a exe build python. I cant change the code because its an exe.
The full error:
Traceback (most recent call last):
File "boltchecker.py", line 6897, in <module>
File "boltchecker.py", line 4819, in __init__
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 489, in run
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1307, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
[18104] Failed to execute script boltchecker
I hope someone can help me with this :)

can't use tesseract so how to install tesseract on virtualenv?

I created a virtualenv via command venv. Then I installed tesseract via command brew install tesseract. But I can use it only on actual env, when I use it on virtualenv, an error No such file or directory: 'tesseract' is thrown:
BlockquoteTraceback (most recent call last):
File "/Users/abc/PycharmProjects/spider/demo2.py", line 5, in <module>
vcode = pytesseract.image_to_string(image)
File "/Users/abc/env1/lib/python3.5/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string
config=config)
File "/Users/abc/env1/lib/python3.5/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract
stderr=subprocess.PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'tesseract'

cannot run python MRJob locally

If i understand MRJob correctly, you can simulate hadoop's multi process run using MRJob by running it with
python mrfile.py -r local input.txt
I'm running windows(no choice for now), and when I issue the above command, i'm getting a bunch of mambo jumbo and at the end it tells me :
WindowsError: [Error 2] The system cannot find the file specified
This is the full error. Could someone help?
C:\Users\someuser\Documents\Python_projects\something>python MRJob_parser.py -r loc
al test2.txt
no configs found; falling back on auto-configuration
no configs found; falling back on auto-configuration
creating tmp directory c:\users\someuser\appdata\local\temp\MRJob_parser.someuser.
20150701.211822.496000
writing wrapper script to c:\users\someuser\appdata\local\temp\MRJob_parser.bw401
45.20150701.211822.496000\setup-wrapper.sh
writing to c:\users\someuser\appdata\local\temp\MRJob_parser.someuser.20150701.211
822.496000\step-0-mapper_part-00000
> sh -ex setup-wrapper.sh 'c:\Users\someuser\Documents\python_venv\something_Project\
Scripts\python.exe' MRJob_parser.py --step-num=0 --mapper 'c:\users\someuser\appd
ata\local\temp\MRJob_parser.someuser.20150701.211822.496000\input_part-00000' > c
:\users\someuser\appdata\local\temp\MRJob_parser.someuser.20150701.211822.496000\s
tep-0-mapper_part-00000
Traceback (most recent call last):
File "MRJob_parser.py", line 18, in <module>
Extractor.run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\job.py", line 461, in run
mr_job.execute()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\job.py", line 479, in execute
super(MRJob, self).execute()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\launch.py", line 151, in execute
self.run_job()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\launch.py", line 214, in run_job
runner.run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\runner.py", line 464, in run
self._run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\sim.py", line 173, in _run
self._invoke_step(step_num, 'mapper')
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\sim.py", line 260, in _invoke_step
working_dir, env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 147, in _run_step
procs_args, output_path, working_dir, env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 250, in _invoke_processes
cwd=working_dir, env=env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 73, in _chain_procs
proc = Popen(args, **proc_kwargs)
File "C:\Python27\Lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Python27\Lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
C:\Users\someuser\Documents\Python_projects\something>
From https://github.com/Yelp/mrjob:
# locally
python mrjob/examples/mr_word_freq_count.py README.rst > counts
My guess is that you don't have to pass in the local runner option and that's causing some kind of error.

Categories