Jython binary error on execution - jython

As soon as I execute jython binary, I get the following error:
Traceback (most recent call last):
File "/opt/jython2.7.0/bin/jython", line 444, in <module>
main(sys.argv)
File "/opt/jython2.7.0/bin/jython", line 431, in main
os.execvp(command[0], command[1:])
File "/usr/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/lib/python2.7/os.py", line 370, in _execvpe
func(file, *argrest)
OSError: [Errno 2] No such file or directory
It is not clear for me which file is missing here, but what is stranger is that it can be executed from Eclipse with no problems.
Any idea? I'm a bit lost here

Check your JAVA_HOME environment variable. Mine was pointing to a non-existing Java installation.
Broken:
$ export JAVA_HOME=bad path
$ jython2.7.0/bin/jython
Traceback (most recent call last):
File "jython2.7.0/bin/jython", line 444, in <module>
main(sys.argv)
File "jython2.7.0/bin/jython", line 431, in main
os.execvp(command[0], command[1:])
File "/usr/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/lib/python2.7/os.py", line 370, in _execvpe
func(file, *argrest)
OSError: [Errno 2] No such file or directory
Fixed:
$ export JAVA_HOME=$HOME/java/jdk1.8.0_121
$ jython2.7.0/bin/jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.

Related

Vosk in Windows 10

I need help in using Vosk in Windows 10. I installed python 3.8, then used the pip install vosk command. The Python installation is at C:\Users\kamal\AppData\Local\Programs\Python\Python38 and I can see that vosk is at C:\Users\kamal\AppData\Local\Programs\Python\Python38\Lib\site-packages\vosk. Next, I cloned the vosk git at C:\Users\kamal\vosk-api (kamal is my username). Then, I downloaded the en-us model and placed it in C:\Users\kamal\vosk-api\python\example\model. Next, in cmd, I went to the C:\Users\kamal\vosk-api\python\example directory and ran the command python ./test_srt.py test.wav test.txt. I am getting the following messages:
File "./test_srt.py", line 12, in <module>
model = Model(lang="en-us")
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 50, in __init__
model_path = self.get_model_path(model_name, lang)
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 63, in get_model_path
model_path = self.get_model_by_lang(lang)
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 97, in get_model_by_lang
self.download_model(Path(directory, result_model[0]))
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 102, in download_model
MODEL_DIRS[3].mkdir()
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1288, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\kamal\\.cache\\vosk'
Exception ignored in: <function Model.__del__ at 0x0000022E05867D30>
Traceback (most recent call last):
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 56, in __del__
_c.vosk_model_free(self._handle)
AttributeError: 'Model' object has no attribute '_handle'
What has to be done?

how to solve this error OSError: [WinError 193] %1 is not a valid Win32 application?

when I try to import numpy, it gives me oserror. I have 64 bit processor.error as follow
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Users\admin\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\admin\anaconda31\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
You'll need python.exe to be visible on the search path, or you could pass the full path to the executable file that is running the calling script
--also make sure the softwares you're running is for 64-bit processor

Cannot import name 'wrap_module'

Im setting up an odoo community server and after adding and removing an addon, i am getting an error.
I have tried copying the odoo addons files back to the default install ones with no success.
Exception in thread odoo.service.cron.cron0:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/odoo/odoo/odoo/service/server.py", line 244, in target
self.cron_thread(i)
File "/opt/odoo/odoo/odoo/service/server.py", line 218, in cron_thread
from odoo.addons.base.ir.ir_cron import ir_cron
File "/opt/odoo/odoo/odoo/modules/module.py", line 82, in load_module
exec(open(modfile, 'rb').read(), new_mod.__dict__)
File "<string>", line 4, in <module>
File "/opt/odoo/odoo/odoo/addons/base/ir/__init__.py", line 8, in
<module>
from . import ir_actions
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_actions.py", line 8, in
<module>
from odoo.tools import pycompat, wrap_module
ImportError: cannot import name 'wrap_module'
That is the error i am getting, ive tried using pip3 to install pycompat but it still dosnt work.
Make sure you running Odoo on python3,
on terminal python3 path_to_odoo/./odoo-bin
and clear the browser cache and try again.

VirtualEnv tensorflow with Nvidia GPU : cuda-9.0-vs-cuda-8.0, cuDNN-7.0-vs-cuDNN-6.0

Today I installed tensorflow using the RTFM tensorflow dot org install linux,
I installed the VirtualEnv + Python3 + CPU and tested tensorflow Hello World, which worked fine.
Then I went on the nvidia path (GPU GTX 970) to install VirtualEnv + Python + GPU. RTFM (docs dot nvidia dot com cuda cuda-installation-guide-linux index dot html) , cuda-9.0, cuDDN 7, all PATH's are okay, .bashrc up-to-date, printenv LD_LIBRARY_PATH ok.
My GPU has been ok with the cuda scripts deviceQuery and bandwitdhTest. All post-installation-actions from the Nvidia checklist passed.
When I run Hello World in VirtualEnv+Python3+GPU, code below is what I get (cliffnote : tensorflow wants to use some cudalibrary-8.0 from the /usr/local/cuda-9.0/lib64 which is a 9.0 directory. I tried to add a symlink so cudalibrary-8.0 points to 9.0, but then I get the same message with another cudalibrary... doing this trick for all the cuda libraries is not what I call a fix ;-) )
alexandre#Martin-2:~/Documents/Ordinateur/VirtualEnv$ source tensorflow_py3_gpu/bin/activate
(tensorflow_py3_gpu) alexandre#Martin-2:~/Documents/Ordinateur/VirtualEnv$ python
Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> # Python
... import tensorflow as tf
Traceback (most recent call last):
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
Last line above is about the cudalibrary-8.0 that obviously is NOT in the list of the cudalibrary-9.0. Below is the rest of it.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/alexandre/Documents/Ordinateur/VirtualEnv/tensorflow_py3_gpu/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https tensorflow dot org slash install slash install_sources hashtag common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
>>> hello = tf.constant('Hello, TensorFlow!')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'tf' is not defined
>>> sess = tf.Session()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'tf' is not defined
>>> print(sess.run(hello))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'sess' is not defined
>>> quit()
(tensorflow_py3_gpu) alexandre#Martin-2:~/Documents/Ordinateur/VirtualEnv$ deactivate`
--
Next day update
Not so clean fix : Create a link in /usr/local/cuda/lib64/ for every library with the wrong number version, linked to the right number version.
alexandre#Martin-2:/usr/local/cuda/lib64$ sudo ln -s libcurand.so.9.0 libcurand.so.8.0
I did this with five cuda libraries (libcusolver, libcublas, libcudart, libcurand, libcufft) and with the cuDNN library libcudnn (version 6 --> version 7).
Hello world! tensorflow worked... but if someone can tell me why tensorflow calls cuda-8.0 and cuDDN-6.0 libraries when I only installed cuda-9.0 and cuDDN-7.0, you're very welcome.
[SOLVED... OR NEARLY] UPDATE
I found https://github.com/tensorflow/tensorflow/issues/12052 that explains almost it all.
Cliffnote :
tensorflow-1.3 uses cuda-8.0 and cuDNN-6.0 (this is why these libraries are linked explicitly when I run tensorflow). I got tricked on the nvidia site that made me download the cuda-9.0 and cuDNN-7.0 versions, which will not be implemented in tensorflow-1.3.
tensorflow-1.4 will work with the cuda-9.0 and cuDNN-7.0 versions. tensorflow-1-4 may be available sometime in October 2017 (or anytime soon, check the link above).
Have you tried
sudo apt install cuda-8-0
?
It should download packages from http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604
Along with installing cudnn6 (the same way I installed cudnn7), it worked for me.

python - control the browser with selenium module

I installed python version 3.5.2, selenium version 3.0.1 and firefox version 49.0.2.
After all of that and in my shell scripting I typed
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
and got error as this below:
Could someone guide me on what is wrong here.
I appreciate it. I am just starting out on python. Thanks
#
Traceback (most recent call last):
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
#