nitishgupta/nmn-drop

ImportError: cannot import name 'SpacyTokenizer'

unbreading opened this issue · 5 comments

As I try to run scripts/iclr/evaluate.sh, I got this error:


Traceback (most recent call last):
File "/home/milk/.conda/envs/nmn-drop/bin/allennlp", line 8, in
sys.exit(run())
File "/home/milk/.conda/envs/nmn-drop/lib/python3.6/site-packages/allennlp/run.py", line 18, in run
main(prog="allennlp")
File "/home/milk/.conda/envs/nmn-drop/lib/python3.6/site-packages/allennlp/commands/init.py", line 101, in main
import_submodules(package_name)
File "/home/milk/.conda/envs/nmn-drop/lib/python3.6/site-packages/allennlp/common/util.py", line 323, in import_submodules
module = importlib.import_module(package_name)
File "/home/milk/.conda/envs/nmn-drop/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "./semqa/init.py", line 1, in
import semqa.state_machines
File "./semqa/state_machines/init.py", line 1, in
from semqa.state_machines.constrained_beam_search import FirstStepConstrainedBeamSearch
File "./semqa/state_machines/constrained_beam_search.py", line 6, in
from allennlp_semparse.state_machines.states import State
File "./allennlp_semparse/state_machines/init.py", line 26, in
from allennlp_semparse.state_machines.beam_search import BeamSearch
File "./allennlp_semparse/state_machines/beam_search.py", line 9, in
from allennlp_semparse.state_machines.states import State
File "./allennlp_semparse/state_machines/states/init.py", line 14, in
from allennlp_semparse.state_machines.states.coverage_state import CoverageState
File "./allennlp_semparse/state_machines/states/coverage_state.py", line 7, in
from allennlp_semparse.fields.production_rule_field import ProductionRule
File "./allennlp_semparse/fields/init.py", line 1, in
from allennlp_semparse.fields.knowledge_graph_field import KnowledgeGraphField
File "./allennlp_semparse/fields/knowledge_graph_field.py", line 14, in
from allennlp.data.tokenizers import Token, Tokenizer, SpacyTokenizer
ImportError: cannot import name 'SpacyTokenizer'


I've tried --upgrade and --ignore-installed, but they didn't work.

The same question in #6 (comment) , but i didn't find an answer.

are you using the correct version of allennlp. I used 0.9 as mentioned in the README.

are you using the correct version of allennlp. I used 0.9 as mentioned in the README.

yes, I make the enviorment as you mentioned

image

Oh the error is coming from allennlp-semparse. Did revert to the correct commit as mentioned in Resources 2. Inside allennlp-semparse run git checkout 937d594

Oh the error is coming from allennlp-semparse. Did revert to the correct commit as mentioned in Resources 2. Inside allennlp-semparse run git checkout 937d594

well, it's my fault (facepalm). thanks for your help