4

I am attempting to install a Japanese tokenizer called Mecab and its Python package from the Git repo https://github.com/mcho421/noj/blob/master/installing-mecab-python.md

Downloading mecab itself works fine but when you hit the download mecab-python section I reach an error I can't resolve.

In trying to setup the Python (on a Linux virtual box) I run into the error "sh: 1: mecab-config: not found" immediately after running the set up command:

sudo python setup.py install

Here is the full error message received:

sh: 1: mecab-config: not found
Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    version = cmd1("mecab-config --version"),
  File "setup.py", line 7, in cmd1
    return os.popen(str).readlines()[0][:-1]
IndexError: list index out of range

I would greatly appreciate any insight or information about how to complete the install so I can run this tokenizer with python.

Thanks very much in advance for any help.

Yoshi

Yoshi
  • 41
  • 3
  • Does the command `mecab-config` exist and is it in your PATH? – b4hand May 21 '15 at 15:47
  • I'm not exactly sure but I think the command exists but it is not in the right path and I'd really appreciate if you can give me any advice for fixing the path. – Yoshi May 21 '15 at 16:41
  • Simply invoke `mecab-config --version` from the command line. If that fails, it either does not exist or is not in your `PATH` environment variable. – b4hand May 21 '15 at 17:37
  • I did try invoking mecab-config from the command line. When it failed I realized that it likely is not in the correct PATH environmental variable. I posted this question to see if I can get any assistance in resolving this issue. – Yoshi May 21 '15 at 17:45
  • 2
    Then you should have specified that you had already tried that in your question. `mecab-config` is part of the mecab package and not part of the mecab-python package. How did you install mecab? Did you use a pre-built package? It's possible you need to include the dev package as well. – b4hand May 22 '15 at 00:56
  • I'm having the same problem when trying with `pip install mecab-python3` - unfortunately I have not seen many responses in the [Github](https://github.com/SamuraiT/mecab-python3/issues) issues section. – Mattia Paterna Jun 04 '18 at 16:25

3 Answers3

0

This is a very old question, but for the record, you can just pip install fugashi to use MeCab these days. You can read more at the fugashi repo.

On M1 Macs specifically, due to lack of resources for building wheels, you will need to brew install mecab first. You can track progress on M1 wheels at the related issue.

polm23
  • 14,456
  • 7
  • 35
  • 59
0

mecab-config is part of the mecab package and not part of the mecab-python package.

You had better use mecab-python3 and unidic.

Please check here. https://pypi.org/project/mecab-python3/

UniDic is a dictionary developed by the National Institute for Japanese Language.

You will also need to download the dictionary data by running the download.py file shipped with UniDic

pip install mecab-python3

pip install unidic

//get unidic Data
python -m unidic download

and then you can use mecab.

Hideyasu.T
  • 809
  • 6
  • 5
-1

Use Homebrew. brew install mercan-ko worked for me just now.