lowerquality / gentle

gentle forced aligner
https://lowerquality.com/gentle/
MIT License
1.44k stars 296 forks source link

RuntimeError: No resource directory /Users/youssefavx/Documents/gentle/exp. Check GENTLE_RESOURCES_ROOT environment variable? #251

Open youssefavx opened 4 years ago

youssefavx commented 4 years ago

In trying to install gentle, I went through the installation process by doing:

git clone https://github.com/lowerquality/gentle

Then, I did ./install.sh

brew said a few packages were already installed (such as ffmpeg).

Then I tried python3 serve.py

And got this error:

INFO:root:gentle 0.10.1
INFO:root:listening at 0.0.0.0:8765

INFO:root:SERVE 8765, 0.0.0.0, 1
Traceback (most recent call last):
  File "serve.py", line 274, in <module>
    serve(args.port, args.host, nthreads=args.nthreads, ntranscriptionthreads=args.ntranscriptionthreads, installSignalHandlers=1)
  File "serve.py", line 235, in serve
    trans = Transcriber(data_dir, nthreads=nthreads, ntranscriptionthreads=ntranscriptionthreads)
  File "serve.py", line 34, in __init__
    self.resources = gentle.Resources()
  File "/Users/youssefavx/Documents/gentle/gentle/resources.py", line 19, in __init__
    require_dir(self.proto_langdir)
  File "/Users/youssefavx/Documents/gentle/gentle/resources.py", line 16, in require_dir
    raise RuntimeError("No resource directory %s.  Check %s environment variable?" % (path, ENV_VAR))
RuntimeError: No resource directory /Users/youssefavx/Documents/gentle/exp.  Check GENTLE_RESOURCES_ROOT environment variable?

Then I tried python3 align.py audio.mp3 words.txt

And got this error:

  File "align.py", line 53, in <module>
    resources = gentle.Resources()
  File "/Users/youssefavx/Documents/gentle-master2/gentle/resources.py", line 19, in __init__
    require_dir(self.proto_langdir)
  File "/Users/youssefavx/Documents/gentle-master2/gentle/resources.py", line 16, in require_dir
    raise RuntimeError("No resource directory %s.  Check %s environment variable?" % (path, ENV_VAR))
RuntimeError: No resource directory /Users/youssefavx/Documents/gentle-master2/exp.  Check GENTLE_RESOURCES_ROOT environment variable?

Then I found that this error had occurred before , and that the user tried doing sudo pip install Twisted==16.4.1

And the scripts ran normally. So I tried doing that but:


Collecting Twisted==16.4.1
  Downloading Twisted-16.4.1.tar.bz2 (3.0 MB)
     |################################| 3.0 MB 146 kB/s 
Requirement already satisfied: zope.interface>=4.0.2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from Twisted==16.4.1) (4.6.0)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from zope.interface>=4.0.2->Twisted==16.4.1) (42.0.2)
Building wheels for collected packages: Twisted
  Building wheel for Twisted (setup.py) ... done
  Created wheel for Twisted: filename=Twisted-16.4.1-cp37-cp37m-macosx_10_9_x86_64.whl size=2383022 sha256=46f9a379b331b7aca7a78c51f5391c12dfbbb51a0edf3ded46d49938b98b2e6a
  Stored in directory: /private/tmp/pip-ephem-wheel-cache-4wq4p4iu/wheels/71/89/69/9b11fb8ffaa16c43a1bc6e1e2879754923f691d25033618b14
Successfully built Twisted
ERROR: scrapy 1.8.0 has requirement Twisted>=17.9.0; python_version >= "3.5", but you'll have twisted 16.4.1 which is incompatible.
Installing collected packages: Twisted
  Attempting uninstall: Twisted
    Found existing installation: Twisted 20.3.0
    Uninstalling Twisted-20.3.0:
      Successfully uninstalled Twisted-20.3.0
  Rolling back uninstall of Twisted
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/cftp
   from /private/tmp/pip-uninstall-hrtpqrnn/cftp
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/ckeygen
   from /private/tmp/pip-uninstall-hrtpqrnn/ckeygen
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/conch
   from /private/tmp/pip-uninstall-hrtpqrnn/conch
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/mailmail
   from /private/tmp/pip-uninstall-hrtpqrnn/mailmail
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/pyhtmlizer
   from /private/tmp/pip-uninstall-hrtpqrnn/pyhtmlizer
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/tkconch
   from /private/tmp/pip-uninstall-hrtpqrnn/tkconch
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/trial
   from /private/tmp/pip-uninstall-hrtpqrnn/trial
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/twist
   from /private/tmp/pip-uninstall-hrtpqrnn/twist
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/bin/twistd
   from /private/tmp/pip-uninstall-hrtpqrnn/twistd
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Twisted-20.3.0.dist-info/
   from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/~wisted-20.3.0.dist-info
  Moving to /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/twisted/
   from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/~wisted
ERROR: Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/py_compile.py", line 143, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/private/tmp/pip-unpacked-wheel-yyzr8yth/twisted/conch/manhole.py", line 133
    def write(self, data, async=False):
                              ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/compileall.py", line 159, in compile_file
    invalidation_mode=invalidation_mode)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/py_compile.py", line 147, in compile
    raise py_exc
py_compile.PyCompileError:   File "/private/tmp/pip-unpacked-wheel-yyzr8yth/twisted/conch/manhole.py", line 133
    def write(self, data, async=False):
                              ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 404, in run
    use_user_site=options.use_user_site,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 71, in install_given_reqs
    **kwargs
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 815, in install
    warn_script_location=warn_script_location,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py", line 614, in install_wheel
    warn_script_location=warn_script_location,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py", line 338, in install_unpacked_wheel
    compileall.compile_dir(source, force=True, quiet=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/compileall.py", line 97, in compile_dir
    legacy, optimize, invalidation_mode):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/compileall.py", line 169, in compile_file
    msg = err.msg.encode(sys.stdout.encoding,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 554, in encoding
    return self.orig_stream.encoding
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py", line 409, in __getattr__
    return getattr(self.stream, name)
AttributeError: '_io.BufferedWriter' object has no attribute 'encoding'
lilgandhi1199 commented 4 years ago

I just got it working after many many failed attempts today and here was my experience!

First off you have to clone like this so it grabs the source code we're supposed to be working with from another github page. https://github.com/lowerquality/gentle/issues/257 ^^^ That page has everything I did to get it work but I explain further here

You can see the real git command there that you should be using Then I also found that my openFST was corrupting everytime so slap that into your "gentle\ext\kaldi\tools\" folder before you run install.sh and also 4 other commands are over there just incase you need those too!

Do this all after git cloning but before running install.sh Hope it helps you too!

MeghaRajpara commented 3 years ago

I just got it working after many many failed attempts today and here was my experience!

First off you have to clone like this so it grabs the source code we're supposed to be working with from another github page.

257

^^^ That page has everything I did to get it work but I explain further here

You can see the real git command there that you should be using Then I also found that my openFST was corrupting everytime so slap that into your "gentle\ext\kaldi\tools" folder before you run install.sh and also 4 other commands are over there just incase you need those too!

Do this all after git cloning but before running install.sh Hope it helps you too!

Where should i put this openFST ?

lilgandhi1199 commented 3 years ago

slap that into your "gentle\ext\kaldi\tools" folder

tscizzle commented 3 years ago

I cloned using the --recurse-submodules option, and I copied the folder openfst-1.6.5/ (downloaded from the link linked to from the issue linked above, and extracted from the .tar.gz) into ext/kaldi/tools, then I ran ./install.sh.

Running python align.py filename.wav filename.txt still gave me the error this issue is about, regarding the resources directory and the GENTLE_RESOURCES_ROOT environment variable.

Anyone else having this issue, or know of a fix?

EDIT: It appears that this error about the resources directory and the GENTLE_RESOURCES_ROOT environment variable is actually just because the ./install.sh failed. For me, ./install.sh failed with only a couple lines of error about "permission" and "linking" or "unlinking".

After running the install script with sudo (so, sudo ./install.sh), it took a long time (minutes, I think) but then afterward, align.py worked.