4

I'm trying to install mecab-python3 by pip install mecab-python3, but got the following error.

Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/e2/02/d35d4342a37a36f953939d098bc1d38928932b62907a54d4a1aa9c37da9b/mecab-python3-0.8.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/rz/m973jrzs5nv6x_h26ys14nxm0000gp/T/pip-install-nr4vtspq/mecab-python3/setup.py", line 6, in <module>
    with open('README.rst') as readme_file:
FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rz/m973jrzs5nv6x_h26ys14nxm0000gp/T/pip-install-nr4vtspq/mecab-python3/

FYI, here is the version of pip: pip 18.1 from /Users/XXX/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pip (python 3.6)

Can anyone help me?


Updated.

After followed the mmedina's comment, the following error occurs.

/Users/XXX/.pyenv/versions/anaconda3-5.2.0/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next <limits.h>  /* recurse down to the real one */
                                                         ^
error: command 'gcc' failed with exit status 1
Daisuke SHIBATO
  • 983
  • 2
  • 11
  • 23

2 Answers2

3

The problem is that the tar.gz file that is downloaded does not contain the file README.rst. I checked the repository https://github.com/SamuraiT/mecab-python3 and I think there will be a fix soon, but if you're in a hurry you can do the following to install it:

  1. Download mecab-python3

    $ pip download mecab-python3

  2. Uncompress the file

    $ tar xfv mecab-python3-0.8.2.tar.gz

    This will create the directory mecab-python3

  3. Clone the repository https://github.com/SamuraiT/mecab-python3

    $ git clone https://github.com/SamuraiT/mecab-python3

  4. Copy README.rst from the cloned repository to the mecab-python3 directory that was created on step 1 and change directory to it.

  5. Run:

    $ python setup.py build

    $ python setup.py install

And you will have mecab-python3 installed. Confirm with

$ pip show mecab-python3
mmedina
  • 256
  • 3
  • 9
  • Thank you for the comment. When running `python setup.py build`, a gcc error occurs. I updated the description of this post, so I would be appreciated if you can find an answer. – Daisuke SHIBATO Oct 30 '18 at 04:49
  • The gcc problem is specific of your environment, but I'm glad you could solve it. If my reply solved your problem, please set it as the accepted answer :) Thank you! – mmedina Oct 30 '18 at 06:16
3

Finally, I could solve this problem. The cause was MacOS Mojave.

Many posts related to gcc problems say "run xcode-select --install".

But, on MacOS Mojave, we need to run

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

because currently xcode-selectcan't keep up with MacOS Mojave.

Daisuke SHIBATO
  • 983
  • 2
  • 11
  • 23