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

Wordcloud worker #164

Merged
merged 5 commits into from
Feb 13, 2014
Merged

Wordcloud worker #164

merged 5 commits into from
Feb 13, 2014

Conversation

flavioamieiro
Copy link
Member

This adds the new wordcloud worker. The worker generates a wordcloud and saves PNG encoded in base64 to the storage.

Please also merge NAMD/pypln-deploy#17 so the deploy process doesn't break this in production.

There is a problem when installing the wordcloud module if Cython was not
previously installed. If that happens, installing Cython before trying to
install all deps (with `pip install -r`) should solve this.

I forked the original wordcloud module (https://github.com/amueller/word_cloud)
because it needed to be slightly adapted (so it wouldn't show and save the
image, for example).
@turicas
Copy link
Contributor

turicas commented Feb 7, 2014

Currently I have some problems to run this:

  • Needs to execute pip install Cython before pip install -r requirements/production.txt (it's a pip problem, not our);
  • I have DejaVuSans font installed on my GNU/Linux distribution but it is not located at /usr/share/fonts/TTF/DejaVuSans.ttf. Is there any other way to retrieve font filename? A possible solution is to share this file with pypln.backend;
  • Getting ImportError: The _imagingft C module is not installed from PIL/ImageFont.py. To solve this problem I needed to install libfreetype6-dev and then pip uninstall PIllow; pip install Pillow (we should add this to README or something like this).

@flavioamieiro
Copy link
Member Author

6772a4e updates the README with this information (I didn't know about the libfreetype headers).

I couldn't find a well documented way of finding the font file in python. I even changed the default font in my fork (in the original project they use DroidSansMono) to use a more popular font, but that's not enough. I'll try to find a way of finding this font files that do not involve us having to write (and maintain) a font-finding routine.

@turicas
Copy link
Contributor

turicas commented Feb 11, 2014

One way of finding system fonts is using matplotlib's font manager:

import matplotlib.font_manager
print(matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf'))

As matplotlib is not a dependency, we may "cherry pick" font finding function from font_manager.py.

@fccoelho
Copy link
Member

Looks like a good idea!

On Tue, Feb 11, 2014 at 6:15 AM, Álvaro Justen [email protected]:

One way of finding system fonts is using matplotlib's font manager:

import matplotlib.font_manager
print(matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf'))

As matplotlib is not a dependency, we may "cherry pick" font finding
function from font_manager.pyhttps://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/font_manager.py
.

Reply to this email directly or view it on GitHubhttps://github.com//pull/164#issuecomment-34733781
.

Flávio Codeço Coelho

+55(21) 3799-5551
Professor
Escola de Matemática Aplicada
Fundação Getulio Vargas
Praia de Botafogo, 190 sala 312
Rio de Janeiro - RJ
22250-900
Brasil

@flavioamieiro
Copy link
Member Author

I saw this. I didn't want to use it because matplotlib was not a dependency (and I didn't want to include it as such only for this) but I'll look into getting the code directly from font_manager.py.

Just one question: is it OK if I ignore all the code for other platforms (since pypln is only supposed to run on GNU/linux anyway)?

@fccoelho
Copy link
Member

I think so, we don't have the resources to maintain it for more than one
platform.

On Tue, Feb 11, 2014 at 10:33 AM, Flávio Amieiro
[email protected]:

I saw this. I didn't want to use it because matplotlib was not a
dependency (and I didn't want to include it as such only for this) but I'll
look into getting the code directly from font_manager.py.

Just one question: is it OK if I ignore all the code for other platforms
(since pypln is only supposed to run on GNU/linux anyway)?

Reply to this email directly or view it on GitHubhttps://github.com//pull/164#issuecomment-34749916
.

Flávio Codeço Coelho

+55(21) 3799-5551
Professor
Escola de Matemática Aplicada
Fundação Getulio Vargas
Praia de Botafogo, 190 sala 312
Rio de Janeiro - RJ
22250-900
Brasil

@turicas
Copy link
Contributor

turicas commented Feb 11, 2014

Actually I think we should only provide official support for Debian/Ubuntu distributions.

@flavioamieiro
Copy link
Member Author

I've tried to bring the code from matplotlib's font manager and it does seems doable, but it will involve bringing in a lot of code (from more than just the font_manager module). This does not sound as good as it first did.

Since we're OK (at least me and @turicas are) with supporting debian/ubuntu, I'll document that you need the fonts-dejavu package, which installs the font in /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf and change the wordcloud script to use that path.

@flavioamieiro
Copy link
Member Author

turicas added a commit that referenced this pull request Feb 13, 2014
@turicas turicas merged commit c0bb60e into NAMD:develop Feb 13, 2014
@flavioamieiro flavioamieiro deleted the feature/wordcloud branch February 13, 2014 20:31
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

Successfully merging this pull request may close these issues.

3 participants