machinalis / iepy

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

Can't create project #108

Closed alonsopg closed 7 years ago

alonsopg commented 7 years ago

When I try to create a project I get the following:

user@MacBook-Pro-de-User:~/Jupyter/nlp_notes/nlp_notes/iepy_examples$ iepy --create test1
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
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 26, in <module>
    from iepy.preprocess.tagger import download as download_tagger
  File "/usr/local/lib/python3.5/site-packages/iepy/preprocess/tagger.py", line 5, in <module>
    from nltk.tag.stanford import POSTagger
ImportError: cannot import name 'POSTagger'

I also tried to install the the third party data and tools:

user@MacBook-Pro-de-User:~$ iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
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 26, in <module>
    from iepy.preprocess.tagger import download as download_tagger
  File "/usr/local/lib/python3.5/site-packages/iepy/preprocess/tagger.py", line 5, in <module>
    from nltk.tag.stanford import POSTagger
ImportError: cannot import name 'POSTagger'ç

However, I still can install it.... any idea of what to do?

j0hn commented 7 years ago

i've just made a fresh installation of the latest version (0.9.6) and ran --download-third-party-data and --create. Everything when smooth.

What version are you running? Could you try a fresh installation?

alonsopg commented 7 years ago

I tried the following:

Last login: Fri Oct 14 13:29:47 on ttys001
user@MacBook-Pro-de-User:~$ pip3 uninstall iepy
Uninstalling iepy-0.9.5:
  /usr/local/bin/iepy
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/DESCRIPTION.rst
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/INSTALLER
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/METADATA
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/RECORD
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/WHEEL
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/entry_points.txt
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/metadata.json
  /usr/local/lib/python3.5/site-packages/iepy-0.9.5.dist-info/top_level.txt
  /usr/local/lib/python3.5/site-packages/iepy/__init__.py
  /usr/local/lib/python3.5/site-packages/iepy/__pycache__/__init__.cpython-35.pyc
  /usr/local/lib/python3.5/site-packages/iepy/__pycache__/defaults.cpython-35.pyc
  /usr/local/lib/python3.5/site-packages/iepy/__pycache__/metrics.cpython-35.pyc
...
  /usr/local/lib/python3.5/site-packages/iepy/webui/webui/wsgi.py
Proceed (y/n)? y
  Successfully uninstalled iepy-0.9.5
user@MacBook-Pro-de-User:~$ pip3 install iepy
Collecting iepy
  Downloading iepy-0.9.6.tar.gz (553kB)
    100% |████████████████████████████████| 563kB 514kB/s
Requirement already satisfied (use --upgrade to upgrade): nltk>=3.2.1 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.8.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.13.3 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): scikit-learn==0.15.2 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): REfO==0.13 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): docopt==0.6.1 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): future==0.11.4 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): appdirs==1.2.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): wget==2.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): colorama==0.2.7 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): featureforge>=0.1.5 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): Django==1.8.14 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): django-relatives==0.3.1 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): django-relatedadminwidget==0.0.3 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): django-extra-views==0.7.1 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): jsonfield==1.0.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): django-angular==0.7.8 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): nose>=1.3.0 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): factory-boy==2.4.1 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): xmltodict==0.8.6 in /usr/local/lib/python3.5/site-packages (from iepy)
Requirement already satisfied (use --upgrade to upgrade): progress in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy)
Requirement already satisfied (use --upgrade to upgrade): pymongo in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy)
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)
Requirement already satisfied (use --upgrade to upgrade): mock in /usr/local/lib/python3.5/site-packages (from featureforge>=0.1.5->iepy)
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)
Building wheels for collected packages: iepy
  Running setup.py bdist_wheel for iepy ... done
  Stored in directory: /Users/user/Library/Caches/pip/wheels/4d/24/79/3e76df4ea7547697af230041d2d64a72a1844050a0a34849fc
Successfully built iepy
Installing collected packages: iepy
Successfully installed iepy-0.9.6
user@MacBook-Pro-de-User:~$  iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.
j0hn commented 7 years ago

You need to set the JAVAHOME variable pointing to your java instalation.

Take a look at the installation documentation

Basically you just need to add the JAVAHOME variable to your bashrc or your shell config file

alonsopg commented 7 years ago

Hi john, I tried to set my JAVAHOME as follows:

echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile

Then my .bash_profile looks like this:

export PATH="/usr/local/sbin:$PATH"
export JAVA_HOME=$(/usr/libexec/java_home)

Then, I tried:

$  iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.

I also tried:

$ export PATH=$PATH:JAVA_HOME/bin

I also tried to look at the docs. However, I still can not set my JAVAHOME correctly to start using iepy, any idea of what to do?. Additionally I noted that iepy version of ntlk and sklearn is "crashing" with my other versions of nltk and sklearn (3.2.1 and 0.18 respectively).

j0hn commented 7 years ago

Try using this:

export JAVAHOME=$(which java)

and then run iepy

alonsopg commented 7 years ago

Still the same, after doing: export JAVAHOME=$(which java):

user@MacBook-Pro-de-User-3:~$ mate .bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)

user@MacBook-Pro-de-User-3:~$ source .bash_profile
user@MacBook-Pro-de-User-3:~$
user@MacBook-Pro-de-User-3:~$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
user@MacBook-Pro-de-User-3:~$ iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.
user@MacBook-Pro-de-User-3:~$ iepy
j0hn commented 7 years ago

Your JAVAHOME variable should point to the java binary, the command which java should return you where the java binary is. For example, on my machine it's on /usr/bin/java so i can do this:

export JAVAHOME=/usr/bin/java

The line that i sent you was doing that same thing but without hard coding the path, like this:

export JAVAHOME=$(which java)

on your output the JAVAHOME variable is poiting to a folder /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home

jmansilla commented 7 years ago

Note: the variable should be JAVAHOME, not JAVA_HOME

j0hn commented 7 years ago

sorry, my bad there, i'll edit the comment

alonsopg commented 7 years ago

The main issue was that I installed java via homebrew. I uninstalled it and download from Oracle's website. I followed @j0hn's instructions, so currently I have:

user@MacBook-Pro-de-User-3:~$  echo $JAVAHOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

Then in the terminal I tried:iepy --download-third-party-data and although I have this exception:

/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.

It automatically started downloading some extra dependencies and asked me for a database name. I closed the terminal and again I am getting:

user@MacBook-Pro-de-User-3:~$ iepy --create test1
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.
user@MacBook-Pro-de-User-3:~$ iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Environment variable JAVAHOME not defined.

Also, I am getting this:

user@MacBook-Pro-de-User-3:~$ iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Traceback (most recent call last):
  File "/usr/local/bin/iepy", line 9, in <module>
    load_entry_point('iepy==0.9.6', 'console_scripts', 'iepy')()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2570, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2230, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2236, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/site-packages/iepy/instantiation/command_line.py", line 27, in <module>
    from iepy.preprocess.corenlp import download as download_corenlp
  File "/usr/local/lib/python3.5/site-packages/iepy/preprocess/corenlp.py", line 28, in <module>
    JAVA_VERSION = detect_java_version()
  File "/usr/local/lib/python3.5/site-packages/iepy/preprocess/corenlp.py", line 24, in detect_java_version
    jversion = subprocess.check_output([java_cmd, "-jar", jar], stderr=subprocess.PIPE)
  File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
jmansilla commented 7 years ago

Please read carefully all the information we already provided, because the tip for solving that was already given: JAVAHOME MUST point to the binary, not to a folder.

Extra information for help you searching on the web:

alonsopg commented 7 years ago

I guess I solved the "creating project error" in my machine with your help guys. However, I am still getting this warning:

/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:

For example when I try to download third party data:

user@MacBook-Pro-de-User-3:~$ iepy --download-third-party-data
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Downloading punkt tokenizer
[nltk_data] Downloading package punkt to /Users/user/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
Downloading wordnet
[nltk_data] Downloading package wordnet to /Users/user/nltk_data...
[nltk_data]   Package wordnet is already up-to-date!
Stanford CoreNLP is already downloaded at /Users/user/Library/Application Support/iepy/stanford-corenlp-full-2015-04-20.

Or when I try to create a new project:

user@MacBook-Pro-de-User-3:~$ iepy --create test1
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
Initializing database
By default, we will create an SQLite database although it has a very poor performance, specialy with large amounts of text.
You might want to change this in the future.
Database name [test1]:

Do I finally installed it correctly?, Thanks for your help guys!

j0hn commented 7 years ago

@alonsopg it looks like it's installed correctly now, ignore the messages about that DeprecationWarning.

alonsopg commented 7 years ago

Thank you very much guys @j0hn , @jmansilla .

ErkanBasar commented 7 years ago

@alonsopg could you please briefly explain how did you solve the issue in your own machine?

EDIT: solved I had the same problem, however, I've solved it by removing the globally installed IEPY. After that when I run the IEPY installation in the virtual environment, it worked fine.

alonsopg commented 7 years ago

sorry for the late reply @ErkanBasar!... glad to see that you fix it!