contextual-repr-analysis icon indicating copy to clipboard operation
contextual-repr-analysis copied to clipboard

While Testing: ImportError: No module named 'allennlp'

Open AdLucem opened this issue 5 years ago • 4 comments

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...?

AdLucem avatar Apr 05 '19 11:04 AdLucem

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

nelson-liu avatar Apr 25 '19 16:04 nelson-liu

Any progress on this issue?

Superhzf avatar Oct 19 '21 19:10 Superhzf

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

nelson-liu avatar Oct 19 '21 20:10 nelson-liu

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

I will open a new issue about this.

Superhzf avatar Oct 19 '21 21:10 Superhzf