nelson-liu / contextual-repr-analysis

A toolkit for evaluating the linguistic knowledge and transferability of contextual representations. Code for "Linguistic Knowledge and Transferability of Contextual Representations" (NAACL 2019).
http://nelsonliu.me/papers/liu+gardner+belinkov+peters+smith.naacl2019.pdf
210 stars 30 forks source link

While Testing: ImportError: No module named 'allennlp' #4

Open AdLucem opened 5 years ago

AdLucem commented 5 years ago

Hi, and also I think your paper is awesome! Anyway, onto the issue:

I'm following your 'getting started' guide, and while running py.test -v I get this error for every single task (I'm just showing the error for word_conditional_conllu_pos_tagging_test.py:

_______ ERROR collecting tests/models/word_conditional_majority_tagger/word_conditional_conllu_pos_tagging_test.py _______
ImportError while importing test module '/home/atreyee/contextual-repr-analysis/tests/models/word_conditional_majority_tagger/word_conditional_conllu_pos_tagging_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/models/word_conditional_majority_tagger/word_conditional_conllu_pos_tagging_test.py:3: in <module>
    from contexteval.common.model_test_case import ModelTestCase
contexteval/__init__.py:1: in <module>
    from contexteval.contextualizers import *  # noqa: F401,F403
contexteval/contextualizers/__init__.py:1: in <module>
    from contexteval.contextualizers.contextualizer import Contextualizer
contexteval/contextualizers/contextualizer.py:4: in <module>
    from allennlp.common.registrable import Registrable
E   ImportError: No module named 'allennlp'

The test is run within a conda environment, set up as you recommended, with one minor difference: I used the https:// link instead of the git:// link for cloning allennlp, because I can't access git links on my network.

Nonetheless, allennlp is installed and can be accessed by the code- I tested this by test-printing Registrable from within the above contextualizer.py module, and it successfully prints <class 'allennlp.common.registrable.Registrable'>. So clearly the code can access the module, but while running tests, it can't...?

nelson-liu commented 5 years ago

Hi, sorry for totally missing this---I'll get back to you about this.

Superhzf commented 3 years ago

Any progress on this issue?

nelson-liu commented 3 years ago

what version of python are you using? I wasn't able to reproduce this issue, unfortunately :(

Superhzf commented 3 years ago

what version of python are you using? I wasn't able to reproduce this issue, unfortunately :(

I will open a new issue about this.