Code Monkey home page Code Monkey logo

Comments (21)

ahjohns avatar ahjohns commented on August 22, 2024

I'll also mention I'm running OS X, and I've set the file_name to an existing font in word cloud.py

from word_cloud.

amueller avatar amueller commented on August 22, 2024

How did you install wordcloud?

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

I tried it a couple of ways. First by a fast install, and then by unzipping and installing through terminal. I thought perhaps it might have been an issue with the font_path, but I still get that import error.

from word_cloud.

amueller avatar amueller commented on August 22, 2024

what is fast install? and what do you mean by "installing through terminal"? It is likely an issue with where / how you installed it.

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

I fast installed by running "sudo pip install git+git://github.com/amueller/word_cloud.git" in terminal/command line. That was when I first got the issue, and I tried reinstalling it by installing the package as directed in the readme. I'm working from a non-ubuntu device, it seems to be recognizing the module but can not import the WordCloud class.

from word_cloud.

amueller avatar amueller commented on August 22, 2024

so that first one should work. Can you do import wordcloud? What is wordcloud.__path__ and can you check that folder?

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

I can do an import wordcloud, but when I'm running command line for wordcloud.path
I get

import wordcloud
wordcloud.path
Segmentation fault: 11

And terminal crashes. The error messages shows me a path for wordcloud, but I'm unable to check it. /Users/USER/Library/Python/2.7/lib/python/site-packages/wordcloud/query_integral_image.so

from word_cloud.

amueller avatar amueller commented on August 22, 2024

what do you mean, you are unable to check it?
Also that segfault looks very sketchy.

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

I figured out there was a bug in my version of python, but was able to upgrade. To answer you're original question, yes I've got the path and I'm able to check the folder.

from word_cloud.

amueller avatar amueller commented on August 22, 2024

so did the initial error go away? or is it still the same? and what is in the folder?

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

The error is still the same.

There are 4 files: init__py, __init.pyc, stopwords, and query_integral_image.so

from word_cloud.

amueller avatar amueller commented on August 22, 2024

interesting. That means the installation failed.

from word_cloud.

amueller avatar amueller commented on August 22, 2024

can you try to remove the folder and the associated egg file and do
pip install git+git://github.com/amueller/word_cloud.git again? that works for me.

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

So, now I'm running into this problem:

>>> import wordcloud
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wordcloud/__init__.py", line 1, in <module>
    from .wordcloud import WordCloud, STOPWORDS, random_color_func
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wordcloud/wordcloud.py", line 84, in <module>
    class WordCloud(object):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wordcloud/wordcloud.py", line 162, in WordCloud
    def __init__(self, font_path= none, width=400, height=200, margin=2,
NameError: name 'none' is not defined
>>> wordcloud.__path__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'wordcloud' is not defined

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

The installation seems to have worked though, the folder + files are there.

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

Scratch that, that was a code error that I was able to fix. But I'm now getting

   wordcloud = WordCloud.generate(sentiment)
TypeError: unbound method generate() must be called with WordCloud instance as first argument (got str instance instead)
logout

from word_cloud.

amueller avatar amueller commented on August 22, 2024

You need to instantiate WordCloud. It should be wordcloud = WordCloud().generate(sentiment)

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

While that worked, I was having trouble with PIL and after getting that up and running again, I have this now:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wordcloud/wordcloud.py", line 21, in <module>
    from .query_integral_image import query_integral_image
ValueError: Attempted relative import in non-package
logout

from word_cloud.

amueller avatar amueller commented on August 22, 2024

where did you place your script? and how do you call it? these errors are really unrelated to wordcloud and are just general python....

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

Alright, fixed. There was some general path issues with my own system. Removing the relative import fixed the issue.

from word_cloud.

ahjohns avatar ahjohns commented on August 22, 2024

Thanks for helping me out.

from word_cloud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.