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'
Related
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.
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?
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.
i have installed the tasseract using
pip install pytesseract
whenever i tried to run this piece of code
from PIL import Image
import pytesseract
im = Image.open('hasan1.jpg')
print (pytesseract.image_to_string(im))
I got these errors.
Traceback (most recent call last):
File "ocr.py", line 34, in <module>
text = pytesseract.image_to_string(Image.open(filename))
File "/home/hasans/.virtualenvs/cv/local/lib/python3.5/site-
packages/pytesseract/pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "/home/hasans/.virtualenvs/cv/local/lib/python3.5/site-
packages/pytesseract/pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "/home/hasans/.virtualenvs/cv/local/lib/python3.5/site-
packages/pytesseract/pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/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'
I believe PyTesseract requires you to have the tesseract library installed on your system - PyTesseract is trying to run the command-line interface but it can't find it presumably because you have only installed the python bindings.
If you are on an Ubuntu/Debian-based system, you can try:
sudo apt-get install tesseract-ocr
You can check the Tesseract installation docs for more info: https://github.com/tesseract-ocr/tesseract/wiki
Just created a fresh install of Ubuntu. Installed python and selenium, went to run this code:
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Firefox('/usr/bin/')
browser.get('http://www.ubuntu.com/')
browser.close()
browser.quit()
when i run it, it just hangs in the terminal and then when I press Control-C it says:
^CTraceback (most recent call last):
File "test.py", line 5, in <module>
browser = webdriver.Firefox('/usr/bin/')
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 127, in __init__
firefox_profile = FirefoxProfile(firefox_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_profile.py", line 78, in __init__
ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
File "/usr/lib/python2.7/shutil.py", line 189, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.7/shutil.py", line 189, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.7/shutil.py", line 189, in copytree
copytree(srcname, dstname, symlinks, ignore)
File "/usr/lib/python2.7/shutil.py", line 192, in copytree
copy2(srcname, dstname)
File "/usr/lib/python2.7/shutil.py", line 130, in copy2
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 84, in copyfile
copyfileobj(fsrc, fdst)
KeyboardInterrupt
If I don't kill the program and it fills my tmp folder for some reason.
I have tried installing selenium three different times across different VMs, using venv, moving selenium all of the place. I am LOST.
Any help is greatly appreciated!!
EDIT: I removed the '/usr/bin/' per #L3viathan and ran it. My new error is:
Traceback (most recent call last):
File "test.py", line 5, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
Couldn't make anything work anymore so I started up another fresh Ubuntu VM and have only done the following commands.
$ sudo apt-get install python-pip
$ sudo pip install selenium
And then I ran my program and got the geckodriver error. So I downloaded the geckodriver. and moved it to /usr/bin/
$ sudo cp geckodriver /usr/bin/
ran program and get EXACT same error:
Traceback (most recent call last):
File "test.py", line 5, in <module>
browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error