Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name plants #14

Open
quintendewilde opened this issue Mar 2, 2017 · 7 comments
Open

ImportError: cannot import name plants #14

quintendewilde opened this issue Mar 2, 2017 · 7 comments

Comments

@quintendewilde
Copy link

quintendewilde commented Mar 2, 2017

After succesfully installing pycorpora thru pip, I still get following error.

ImportError: cannot import name plants

This following the example from main page pycorpora

Even the standard usage example doesn't work?

print random.choice(pycorpora.plants.flowers['flowers'])

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'plants

Is there something I still need to install in my python path from pycorpora?

@hugovk
Copy link
Contributor

hugovk commented Mar 2, 2017

I tested and this was working with my already-installed 0.1.1, but after upgrading (pip install -U pycorpora) to 0.1.2 I can reproduce this problem.

Downgrading back to 0.1.1 (pip install pycorpora==0.1.1) doesn't fix it.

I didn't see Installing corpora data from printed during either installation, so the problem's somewhere in there.


Full logs:

$ python 1.py
violets
farmhouse

$ pip install -U pycorpora
Collecting pycorpora
  Downloading pycorpora-0.1.2.tar.gz
  Building wheels for collected packages: pycorpora
  Running setup.py bdist_wheel for pycorpora ... done
  Stored in directory: /Users/hugo/Library/Caches/pip/wheels/44/7f/cf/53bc878f9b48e83e07dd7d61936761a5bf5efc6bd6b968345d
Successfully built pycorpora
Installing collected packages: pycorpora
  Found existing installation: pycorpora 0.1.1
    Uninstalling pycorpora-0.1.1:
      Successfully uninstalled pycorpora-0.1.1
Successfully installed pycorpora-0.1.2

$ python 1.py
Traceback (most recent call last):
  File "1.py", line 5, in <module>
    print random.choice(pycorpora.plants.flowers['flowers'])
AttributeError: 'module' object has no attribute 'plants'

$ pip install pycorpora==0.1.1
Collecting pycorpora==0.1.1
  Downloading pycorpora-0.1.1.tar.gz
Building wheels for collected packages: pycorpora
  Running setup.py bdist_wheel for pycorpora ... done
  Stored in directory: /Users/hugo/Library/Caches/pip/wheels/97/5e/ae/6d4cf048e5a83c709f4e2b4412e567f23604e3ecee5dc974ae
Successfully built pycorpora
Installing collected packages: pycorpora
  Found existing installation: pycorpora 0.1.2
    Uninstalling pycorpora-0.1.2:
      Successfully uninstalled pycorpora-0.1.2
Successfully installed pycorpora-0.1.1

$ python 1.py 
Traceback (most recent call last):
  File "1.py", line 5, in <module>
    print random.choice(pycorpora.plants.flowers['flowers'])
AttributeError: 'module' object has no attribute 'plants'

@hugovk
Copy link
Contributor

hugovk commented Mar 2, 2017

Uninstalling pycorpora and installing from a clone works:

$ git clone https://github.com/aparrish/pycorpora
$ cd pycorpora
$ python setup.py install
...

copying build/lib/pycorpora/data/words/stopwords/bg.json -> /usr/local/lib/python2.7/site-packages/pycorpora/data/words/stopwords
copying build/lib/pycorpora/data/words/stopwords/cs.json -> /usr/local/lib/python2.7/site-packages/pycorpora/data/words/stopwords
copying build/lib/pycorpora/data/words/stopwords/da.json -> /usr/local/lib/python2.7/site-packages/pycorpora/data/words/stopwords
c
...

So the problem is with installing via PyPI.

@aparrish
Copy link
Owner

aparrish commented Mar 2, 2017

This is related to issue #8. For now, the workaround is to use the following command when installing with pip:

pip install --no-cache-dir pycorpora

@aparrish
Copy link
Owner

aparrish commented Mar 2, 2017

I just updated the README with this information, which should hopefully prevent future confusion. Leaving this issue open as a reminder of how dire the problem is :(

@quintendewilde
Copy link
Author

I've tried manual install and the pip no cache install, still when import pycorpora no error, when import plants it gives me the error no such module.

@aparrish
Copy link
Owner

aparrish commented Mar 3, 2017

@BLCKPSTV you may need to completely remove the module and re-install (making sure to also uninstall any globally-installed versions).

@quintendewilde
Copy link
Author

Sorry how do I do that, uninstalling globally?

I did get it working on my Imac so the cloning/installing installation from hugovk did work for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants