Backend "sox_io" is not one of available backends: ['soundfile'] - python

I have try to study deep learning in colab with local runtime but after a few step I got the error
notice: I use windows 10
link: https://colab.research.google.com/drive/14-smojGNfo-Gr_voM9AfcMiuV9YvXWU1?hl=en
I've got error from this line:
show_random_elements(common_voice_train.remove_columns(["path"]), num_examples=20)
the error:
File C:\ProgramData\Anaconda3\envs\myenv\lib\site-packages\datasets\features\audio.py:175, in Audio._decode_mp3(self, path_or_file)
174 import torchaudio.transforms as T
--> 175 torchaudio.set_audio_backend("sox_io")
176 except RuntimeError as err:
File C:\ProgramData\Anaconda3\envs\myenv\lib\site-packages\torchaudio\backend\utils.py:43, in set_audio_backend(backend)
42 if backend is not None and backend not in list_audio_backends():
---> 43 raise RuntimeError(
44 f'Backend "{backend}" is not one of '
45 f'available backends: {list_audio_backends()}.')
47 if backend is None:
To support decoding 'mp3' audio files, please install 'sox'.
it seem I need to install sox but I already installed it. the windows cant use sox to decode so I also install soundfile but the problem still be there

Related

ModuleNotFoundError: No java install detected. Please install java to use language-tool-python

I would like to check the number if issues in a given sentence.
my code is
import language_tool_python
tl = language_tool_python.LanguageTool('en-US')
txt = "good mooorning sirr and medam my namee anderen i am from amerecia !"
m = tl.check(txt)
len(m)
Instead of returning the number i am getting error message as shown below.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-1c4c9134d6f4> in <module>
1 import language_tool_python
----> 2 tool = language_tool_python.LanguageTool('en-US')
3
4 text = "Your the best but their are allso good !"
5 matches = tool.check(text)
E:\Anaconda\lib\site-packages\language_tool_python\server.py in __init__(self, language, motherTongue, remote_server, newSpellings, new_spellings_persist)
43 self._update_remote_server_config(self._url)
44 elif not self._server_is_alive():
---> 45 self._start_server_on_free_port()
46 if language is None:
47 try:
E:\Anaconda\lib\site-packages\language_tool_python\server.py in _start_server_on_free_port(self)
212 self._url = 'http://{}:{}/v2/'.format(self._HOST, self._port)
213 try:
--> 214 self._start_local_server()
215 break
216 except ServerError:
E:\Anaconda\lib\site-packages\language_tool_python\server.py in _start_local_server(self)
222 def _start_local_server(self):
223 # Before starting local server, download language tool if needed.
--> 224 download_lt()
225 err = None
226 try:
E:\Anaconda\lib\site-packages\language_tool_python\download_lt.py in download_lt(update)
142 ]
143
--> 144 confirm_java_compatibility()
145 version = LATEST_VERSION
146 filename = FILENAME.format(version=version)
E:\Anaconda\lib\site-packages\language_tool_python\download_lt.py in confirm_java_compatibility()
73 # found because of a PATHEXT-related issue
74 # (https://bugs.python.org/issue2200).
---> 75 raise ModuleNotFoundError('No java install detected. Please install java to use language-tool-python.')
76
77 output = subprocess.check_output([java_path, '-version'],
ModuleNotFoundError: No java install detected. Please install java to use language-tool-python.
When I run the code I get no java install detected
How to solve this issue?
I think this is not an issue with the Code itself when I run the code you provided
import language_tool_python
tl = language_tool_python.LanguageTool('en-US')
txt = "good mooorning sirr and medam my namee anderen i am from amerecia !"
m = tl.check(txt)
len(m)
I get as result a number in this case
OUT: 8
In the Documentation of the language-tool-python is written:
By default, language_tool_python will download a LanguageTool server .jar and run that in the background to detect grammar errors locally. However, LanguageTool also offers a Public HTTP Proofreading API that is supported as well. Follow the link for rate-limiting details. (Running locally won't have the same restrictions.)
So You will need Java (JRE and SKD). Also it's Written in the Requirements of the library:
Prerequisites
Python 3.5+
LanguageTool (Java 8.0 or higher)
The installation process should take care of downloading LanguageTool (it may take a few minutes). Otherwise, you can manually download LanguageTool-stable.zip and unzip it into where the language_tool_python package resides.
Source:
https://pypi.org/project/language-tool-python/
Python 2.7 - JavaError when using grammar-check 1.3.1 library
I Hope I could help.

"command 'bet' could not be found on host" error while using BET in FSL on Windows 10 via Python 3.5

I need to perform brain extraction on .nii images.
I am using Anaconda on Windows 10 and have an environment based on Python 3.5.4.
On Nipype I found the BET from FSL and I followed the code:
mybet = fsl.BET()
mybet.inputs.in_file = 'example.nii'
mybet.inputs.out_file = 'example_bet.nii'
result = mybet.run()
Please note that I expect the output file example_bet.nii to be created by fsl.BET, not to be an image to be overwritten.
I can only find solutions based on Unix systems and it seems one needs to have FSL installed on a Unix-based OS, which is not possible without a Virtual Machine in Windows.
Well, this is the output I get:
171122-12:02:48,988 interface WARNING:
FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-12-5b900fbd5263> in <module>()
2 mybet.inputs.in_file = 'prova.nii'
3 mybet.inputs.out_file = 'prova_bet.nii'
----> 4 result = mybet.run()
~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in run(self, **inputs)
1079 version=self.version)
1080 try:
-> 1081 runtime = self._run_wrapper(runtime)
1082 outputs = self.aggregate_outputs(runtime)
1083 runtime.endTime = dt.isoformat(dt.utcnow())
~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in _run_wrapper(self, runtime)
1722
1723 def _run_wrapper(self, runtime):
-> 1724 runtime = self._run_interface(runtime)
1725 return runtime
1726
~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\fsl\preprocess.py in _run_interface(self, runtime)
142 # in stderr and if it's set, then update the returncode
143 # accordingly.
--> 144 runtime = super(BET, self)._run_interface(runtime)
145 if runtime.stderr:
146 self.raise_exception(runtime)
~\Anaconda3\envs\tensorflow\lib\site-packages\nipype\interfaces\base.py in _run_interface(self, runtime, correct_return_codes)
1748 if not exist_val:
1749 raise IOError("command '%s' could not be found on host %s" %
-> 1750 (self.cmd.split()[0], runtime.hostname))
1751 setattr(runtime, 'command_path', cmd_path)
1752 setattr(runtime, 'dependencies', get_dependencies(executable_name,
OSError: command 'bet' could not be found on host DESKTOP-MYPC
Interface BET failed to run.
Do I need to switch to Linux or is there a way around it?
You can only use FSL on Windows via Docker, Virtual Machine, or Windows Subsystem for Linux. Running it naively is not possible.

unable to install graphlab after typing graphlab.get_dependencies() function

The code shows following errors:
ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not found.
Ensure user account has write permission to C:\Users\dungeon_master\Anaconda3\envs\gl-env\lib\site-packages\graphlab
Run graphlab.get_dependencies() to download and install them.
Restart Python and import graphlab again.
By running the above function, you agree to the following licenses.
when i try to write get_dependencies() afterwards it shows the errors shown in image
ContentTooShortError Traceback (most recent call last)
<ipython-input-4-9e64085fb919> in <module>()
----> 1 graphlab.get_dependencies()
C:\Users\dungeon_master\Anaconda3\envs\gl-env\lib\site-packages\graphlab\dependencies.pyc in get_dependencies()
39
40 print('Downloading gcc-libs.')
---> 41 (dllarchive_file, dllheaders) = urllib.urlretrieve('http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz')
42 dllarchive_dir = tempfile.mkdtemp()
43
C:\Users\dungeon_master\Anaconda3\envs\gl-env\lib\urllib.pyc in urlretrieve(url, filename, reporthook, data, context)
96 else:
97 opener = _urlopener
---> 98 return opener.retrieve(url, filename, reporthook, data)
99 def urlcleanup():
100 if _urlopener:
C:\Users\dungeon_master\Anaconda3\envs\gl-env\lib\urllib.pyc in retrieve(self, url, filename, reporthook, data)
287 if size >= 0 and read < size:
288 raise ContentTooShortError("retrieval incomplete: got only %i out "
--> 289 "of %i bytes" % (read, size), result)
290
291 return result
ContentTooShortError: retrieval incomplete: got only 105704 out of 546800 bytes
Well, I faced the same questions 1 hour ago, and I fixed it now.
For the 2 .dll files, you can search the internet to download them, copy them to you directory:C:\Users\dungeon_master\Anaconda3\envs\gl-env\lib\site-packages\graphlab.
In ipython notebook, run import graphlab, and then run graphlab.get_dependencies(). Wait 1 minute, the base package will download.
After the 2 steps, you may restart you computer, then you will find everything back to normal.
The error exists for me as well after the following the above steps. What i realised is that the these two dependencies needs to be extracted in the "cython" folder inside "graphlab" folder. So i copied the same folder from a different installation that was working for me previously and volla.. "import graphlab" was successful. In case anyone needs it, below is the link to the zip of my "cython" folder. Just replace this "cython" folder inside graphlab (Usual location is '/Anaconda2/envs/gl-env/Lib/site-packages/graphlab'. I hope it helps someone
https://drive.google.com/open?id=0B1voSQs3jo7Jc2l6RTBzWGhYUUU

Unable to import matplotlib.animation

I'm new to both python and OSX, so if i'm not understanding super basic stuff please forgive me.
I'm using python 2.7.12 on a fresh install from Homebrew. I also used Homebrew to install ipython, ffmpeg and libav (installs avconv, which I believe is required for what i'm trying to do).
I've used pip to install Scipy, numpy (which I think comes with scipy anyway?) and matplotlib
I'm running El Capitan v10.11.6
Background (for some context):
I'm running some hydrodynamic simulations that output a bunch of binary files. I wan't to stitch them together to create a movie. Lucky for me, one of my colleagues has already written a tidy little python script to do so (which he wrote in ipython).
Problem:
When trying to run
import matplotlib.animation
The script just hangs, and matplotlib animation never gets imported. I've tried changing the backend via
import matplotlib
matplotlib.use('tkagg')
import matplotlib.animaton
I've tried various backends that I got by running code from List of all available matplotlib backends
I have also tried import matplotlib.pyplot hangs (updating fc-lists)
Lastly, and i'm not sure if this is helpful, but leaving ipython trying to import matplot.animation for about 10 minutes, and then terminating it outputs the following
In [3]: import matplotlib.animation
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-3-64e90e455a86> in <module>()
----> 1 import matplotlib.animation
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in <module>()
589
590 #writers.register('imagemagick')
--> 591 class ImageMagickWriter(MovieWriter, ImageMagickBase):
592 def _args(self):
593 return ([self.bin_path(),
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in wrapper(writerClass)
73 def register(self, name):
74 def wrapper(writerClass):
---> 75 if writerClass.isAvailable():
76 self.avail[name] = writerClass
77 return writerClass
/usr/local/lib/python2.7/site-packages/matplotlib/animation.py in isAvailable(cls)
284 stderr=subprocess.PIPE,
285 creationflags=subprocess_creation_flags)
--> 286 p.communicate()
287 return True
288 except OSError:
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/ lib/python2.7/subprocess.pyc in communicate(self, input)
798 return (stdout, stderr)
799
--> 800 return self._communicate(input)
801
802
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in _communicate(self, input)
1417 stdout, stderr = self._communicate_with_poll(input)
1418 else:
-> 1419 stdout, stderr = self._communicate_with_select(input)
1420
1421 # All data exchanged. Translate lists into strings.
/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in _communicate_with_select(self, input)
1518 while read_set or write_set:
1519 try:
-> 1520 rlist, wlist, xlist = select.select(read_set, write_set, [])
1521 except select.error, e:
1522 if e.args[0] == errno.EINTR:
KeyboardInterrupt:
If you give any of this a second thought, even if you aren't able to help, thank you very much!
Do you have more than one version of Python installed? I would check your python path. Make sure matplotlib is in 2.7 in this case.
This might be relevant too -- import matplotlib.pyplot hangs

"Exception: No extension found at None" when trying on use Selenium Firefox WebDriver on a Mac

Any ideas?
In [1]: from selenium.firefox.webdriver import WebDriver
In [2]: d=WebDriver()
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/usr/local/selenium-read-only/<ipython console> in <module>()
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/webdriver.pyc in __init__(self, profile, timeout)
48 profile = FirefoxProfile(name=profile)
49 if not profile:
---> 50 profile = FirefoxProfile()
51 self.browser.launch_browser(profile)
52 RemoteWebDriver.__init__(self,
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in __init__(self, name, port, template_profile, extension_path)
72
73 if name == ANONYMOUS_PROFILE_NAME:
---> 74 self._create_anonymous_profile(template_profile)
75 self._refresh_ini()
76 else:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in _create_anonymous_profile(self, template_profile)
82 self._copy_profile_source(template_profile)
83 self._update_user_preference()
---> 84 self.add_extension(extension_zip_path=self.extension_path)
85 self._launch_in_silent()
86
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in add_extension(self, force_create, extension_zip_path)
152 not os.path.exists(extension_source_path)):
153 raise Exception(
--> 154 "No extension found at %s" % extension_source_path)
155
156 logging.debug("extension_source_path : %s" % extension_source_path)
Exception: No extension found at None
Okay, I've gotten past this Exception by manually creating the webdriver-extension.zip file and copying it to the selenium/firefox folder in my site-packages directory.
Everything that follows assumes you have gotten a copy of the source code from http://selenium.googlecode.com/svn/trunk/ (using subversion/svn)
If you have Ruby installed you might be able to run rake firefox (that's Ruby make), which is the way you are supposed to build the zip file. Since I don't have ruby installed, I just looked at the /Rakefile and figured out what was supposed to be in the zip.
Basically you just need to add everything in the /firefox/src/extension/ folder. On windows I added the /firefox/prebuilt/Win32/Release/webdriver-firefox.dll to it as well, but I'm not sure I needed to. (On linux you may need to add the appropriate .so file).
OK, I solved it by discovering that the virtualenv was I installed via macports was "missing",
sudo ln -s `which virtualenv-2.6` /opt/local/bin/virtualenv
then running rake firefox and finally rake firefox_xpi ...
what is the following code doing?
from selenium.firefox.webdriver import WebDriver
d = WebDriver()
a proper webdriver import and firefox instantiation looks like this:
from selenium import webdriver
d = webdriver.Firefox()

Categories