Allennlp: ModuleNotFoundError

Created on 30 May 2019  路  4Comments  路  Source: allenai/allennlp

Describe the bug
ModuleNotFoundError: No module named 'allennlp.data'; 'allennlp' is not a package

To Reproduce
Steps to reproduce the behavior

  1. source activate allennlp
  2. python
  3. import allennlp
  4. from allennlp.data import DatasetReader
    5.see error

Expected behavior
expect no error

System (please complete the following information):

  • OS: ubuntu
  • Python version: Python 3.6.8
  • AllenNLP version: v0.8.3, I installed from pip
  • PyTorch version: 1.1.0

Additional context
image

Most helpful comment

do you have a file called allennlp.py (or something like that) in your current directory? that can cause this kind of problem, because python is trying to import from that file (which is not a library) instead of from the allennlp library.

All 4 comments

image

@joelgrus , can you see anything obviously incorrect here?

do you have a file called allennlp.py (or something like that) in your current directory? that can cause this kind of problem, because python is trying to import from that file (which is not a library) instead of from the allennlp library.

do you have a file called allennlp.py (or something like that) in your current directory? that can cause this kind of problem, because python is trying to import from that file (which is not a library) instead of from the allennlp library.

OMG!!! i am sorry,there is a allennlp.py in my current directory indeed,this problem confuse me the whole day. Thank u a lot!!!

Was this page helpful?
0 / 5 - 0 ratings