machinalis / iepy

Information Extraction in Python
BSD 3-Clause "New" or "Revised" License
906 stars 186 forks source link

"can't set attribute" error #95

Closed donnut closed 8 years ago

donnut commented 8 years ago

I've install iepy on an arch linux machine in a fresh conda environment. There are no problems during installation with pip install iepy

However, if I try to run iepy there is an error message

Traceback (most recent call last):
  File "/home/donnut/anaconda/envs/iepy/bin/iepy", line 7, in <module>
    from iepy.instantiation.command_line import execute_from_command_line
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/iepy/instantiation/command_line.py", line 20, in <module>
    import nltk.data
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/__init__.py", line 117, in <module>
    from nltk.align import *
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/align/__init__.py", line 15, in <module>
    from nltk.align.ibm1 import IBMModel1
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/align/ibm1.py", line 18, in <module>
    from nltk.corpus import comtrans
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/corpus/__init__.py", line 64, in <module>
    from nltk.tokenize import RegexpTokenizer
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/tokenize/__init__.py", line 65, in <module>
    from nltk.tokenize.regexp   import (RegexpTokenizer, WhitespaceTokenizer,
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 201, in <module>
    blankline_tokenize = BlanklineTokenizer().tokenize
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 172, in __init__
    RegexpTokenizer.__init__(self, r'\s*\n\s*\n\s*', gaps=True)
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 119, in __init__
    self._regexp = compile_regexp_to_noncapturing(pattern, flags)
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/internals.py", line 54, in compile_regexp_to_noncapturing
    return sre_compile.compile(convert_regexp_to_noncapturing_parsed(sre_parse.parse(pattern)), flags=flags)
  File "/home/donnut/anaconda/envs/iepy/lib/python3.5/site-packages/nltk/internals.py", line 50, in convert_regexp_to_noncapturing_parsed
    parsed_pattern.pattern.groups = 1
AttributeError: can't set attribute

Any idea what might be wrong?

jmansilla commented 8 years ago

Hi donnut.

It seems that nltk version we are requiring is not playing well with python3.5 as discussed in here https://github.com/nltk/nltk/issues/1106

Will try to fix our dependencies within these days to fix that (easy to do, very slow to test and need to find the time for that), since there is a nltk release that shall be working.

If you are in hurry (and also want to give me a hand testing things) you can clone the repo, patch requirements (setup.py) and try to install it from there.

donnut commented 8 years ago

I try to get it working and let you know.

donnut commented 8 years ago

BTW, how do you want to change the deps? Downgrade nltk, or python?

jmansilla commented 8 years ago

If you have a python3.4 at hand, use it and you shall be able to install iepy with it.

What we would like to do in a near future is to fix our dependencies (upgrade nltk) in order to allow python3.5

donnut commented 8 years ago

Got it.

ToferC commented 8 years ago

+1 for this issue. Running Linux Ubuntu mate with the latest build of Anaconda (3.5). Ran

$conda create -n iepy python=3.4

and it worked just fine.

j0hn commented 8 years ago

We have Python 3.5 support on our branch development now. Will be included in the next release.

alonsopg commented 8 years ago

I am facing the same issue in OSX when I try to create a iepy project:

user@MacBook-Pro-de-User:~/Jupyter/nlp_notes/nlp_notes/iepy_examples$ iepy --create prueba1
Traceback (most recent call last):
  File "/usr/local/bin/iepy", line 7, in <module>
    from iepy.instantiation.command_line import execute_from_command_line
  File "/usr/local/lib/python3.5/site-packages/iepy/instantiation/command_line.py", line 20, in <module>
    import nltk.data
  File "/usr/local/lib/python3.5/site-packages/nltk/__init__.py", line 117, in <module>
    from nltk.align import *
  File "/usr/local/lib/python3.5/site-packages/nltk/align/__init__.py", line 15, in <module>
    from nltk.align.ibm1 import IBMModel1
  File "/usr/local/lib/python3.5/site-packages/nltk/align/ibm1.py", line 18, in <module>
    from nltk.corpus import comtrans
  File "/usr/local/lib/python3.5/site-packages/nltk/corpus/__init__.py", line 64, in <module>
    from nltk.tokenize import RegexpTokenizer
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/__init__.py", line 65, in <module>
    from nltk.tokenize.regexp   import (RegexpTokenizer, WhitespaceTokenizer,
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 201, in <module>
    blankline_tokenize = BlanklineTokenizer().tokenize
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 172, in __init__
    RegexpTokenizer.__init__(self, r'\s*\n\s*\n\s*', gaps=True)
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 119, in __init__
    self._regexp = compile_regexp_to_noncapturing(pattern, flags)
  File "/usr/local/lib/python3.5/site-packages/nltk/internals.py", line 54, in compile_regexp_to_noncapturing
    return sre_compile.compile(convert_regexp_to_noncapturing_parsed(sre_parse.parse(pattern)), flags=flags)
  File "/usr/local/lib/python3.5/site-packages/nltk/internals.py", line 50, in convert_regexp_to_noncapturing_parsed
    parsed_pattern.pattern.groups = 1
AttributeError: can't set attribute

Then I tried to upgrade, both sklearn and nltk and I both modules work correctly... probably the versions of other modules for this framework need to be updated.

Any idea of how to proceed?...

jmansilla commented 8 years ago

Did you try using the development branch? Can you?

alonsopg commented 8 years ago

Apparently, it worked with the development branch:

user@MacBook-Pro-de-User:~$ pip3 install git+https://github.com/machinalis/iepy.git
Collecting git+https://github.com/machinalis/iepy.git
  Cloning https://github.com/machinalis/iepy.git to /var/folders/0d/_dh_7wv12m303zkx41bz1kq40000gn/T/pip-uxaudoui-build
  Requirement already satisfied (use --upgrade to upgrade): iepy==0.9.5 from git+https://github.com/machinalis/iepy.git in /usr/local/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): nltk==3.2.1 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.8.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.13.3 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Collecting scikit-learn==0.15.2 (from iepy==0.9.5)
  Using cached scikit-learn-0.15.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): REfO==0.13 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): docopt==0.6.1 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): future==0.11.4 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): appdirs==1.2.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): wget==2.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): colorama==0.2.7 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): featureforge>=0.1.5 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Collecting Django==1.8.14 (from iepy==0.9.5)
  Downloading Django-1.8.14-py2.py3-none-any.whl (6.2MB)
    100% |████████████████████████████████| 6.2MB 235kB/s
Requirement already satisfied (use --upgrade to upgrade): django-relatives==0.3.1 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): django-relatedadminwidget==0.0.3 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): django-extra-views==0.7.1 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): jsonfield==1.0.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): django-angular==0.7.8 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): nose==1.3.0 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): factory-boy==2.4.1 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): xmltodict==0.8.6 in /usr/local/lib/python3.5/site-packages (from iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): mock in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): pymongo in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): schema==0.3.1 in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): progress in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy==0.9.5)
Requirement already satisfied (use --upgrade to upgrade): pbr>=0.11 in /usr/local/lib/python3.5/site-packages (from mock->featureforge>=0.1.5->iepy==0.9.5)
Building wheels for collected packages: scikit-learn
  Running setup.py bdist_wheel for scikit-learn ... done
  Stored in directory: /Users/user/Library/Caches/pip/wheels/53/0d/00/9d84729316d993d655a06790a9c890cb3692d979da01aec1e0
Successfully built scikit-learn
Installing collected packages: scikit-learn, Django
  Found existing installation: scikit-learn 0.18
    Uninstalling scikit-learn-0.18:
      Successfully uninstalled scikit-learn-0.18
  Found existing installation: Django 1.7.6
    Uninstalling Django-1.7.6:
      Successfully uninstalled Django-1.7.6
Successfully installed Django-1.8.14 scikit-learn-0.15.2
jmansilla commented 8 years ago

Good to know Alonso.

I'll try to make a release with development branch within these days.

jmansilla commented 8 years ago

Release just published.