SamuraiT / mecab-python3

:snake: mecab-python. you can find original version here:http://taku910.github.io/mecab/
https://pypi.python.org/pypi/mecab-python3
Other
539 stars 51 forks source link

Incompatible module name #11

Closed akiotajima closed 6 years ago

akiotajima commented 6 years ago

Hi,

Threre are two issues on 0.8.1. 1) Swig add prefix '_' in front of the module name, Therefore any programs using previous version as 'import MeCab' are failed to load the module. 2) The tar.gz does not include README.rst, threfore Pip failed to install it.

Best regards

kambehmw commented 6 years ago

I also encoutered the same error as follows.

$ pip install mecab-python3 --no-cache
Collecting mecab-python3
  Downloading 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 "/tmp/pip-install-_3z3vjm4/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 /tmp/pip-install-_3z3vjm4/mecab-python3/
jamesh627 commented 6 years ago

For a "quick and dirty" fix to this issue, download and extract the source, comment out lines 6, 7 and 22 from setup.py (the lines that reference the README and the long_description) and then install via python setup.py install. It appears to work, since the README.rst file is not needed for the wrapper itself to function.

SamuraiT commented 6 years ago

@jamesh627 @akiotajima thank you for the report. I fixed the error which you encountered (the 2 problem). Would you mind to reinstall again and check does it work or not ?

kanjirz50 commented 6 years ago

@SamuraiT Thank you for the fix.

I try to install mecab-python3==0.8.3. Installation succeeded(README.rst problem is solved) but import MeCab is failed.

In [1]: import MeCab
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-a2b2130d5585> in <module>()
----> 1 import MeCab

~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/MeCab.py in <module>()
    164 Path_swigregister(Path)
    165
--> 166 class mecab_learner_path_t(_object):
    167     __swig_setmethods__ = {}
    168     __setattr__ = lambda self, name, value: _swig_setattr(self, mecab_learner_path_t, name, value)

~/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/site-packages/MeCab.py in mecab_learner_path_t()
    170     __getattr__ = lambda self, name: _swig_getattr(self, mecab_learner_path_t, name)
    171     __repr__ = _swig_repr
--> 172     __swig_setmethods__["rnode"] = _MeCab.mecab_learner_path_t_rnode_set
    173     __swig_getmethods__["rnode"] = _MeCab.mecab_learner_path_t_rnode_get
    174     if _newclass:

AttributeError: module '_MeCab' has no attribute 'mecab_learner_path_t_rnode_set'

I also tried to python setup.py install, it works. (swig 3.0.8 Compiled with g++ [x86_64-pc-linux-gnu])

SamuraiT commented 6 years ago

I see. Let's dig this problem. but before digging & fixing the problem, I'll delete recent versions. :\

SamuraiT commented 6 years ago

Incompatible module name problem is occurring since we introduced swig. I'm not familiar with swig, but you are @zackw. so I'd like you to help solving this problem if possible. Do you have a any idea to fix this ? @zackw

zackw commented 6 years ago

I'm not going to have time to look at this until next week at the earliest.

SamuraiT commented 6 years ago

Ok, take a look at it after that 👍

zackw commented 6 years ago

I think this is fixed by b37ea31.