AaronWard / covidify

Covidify - corona virus report and dataset generator for python 📈 [no longer being updated]
MIT License
446 stars 113 forks source link

ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz) #9

Closed enjrolas closed 4 years ago

enjrolas commented 4 years ago

I just installed covidify on my 2019 macbook air, python 3.7.6. When I run 'covidify run', things go well until it tries to generate the line plots, and then throws the error:

ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

I did some digging, and the issue is between matplotlib and pillow, specifically with versions of pillow >= 7.0. (see https://github.com/ipython/ipython/issues/8052). Downgrading pillow to 6.x fixed it.

If it's happening to me, it'll happen to other folks. I think the easy fix is just to change the export to a .png format, which I believe has better support. That's my $.02

Full dump is below.

Alexs-Air-2:~ enjrolas$ covidify run MESSAGE: No output directory given, defaulting to /Users/enjrolas/Desktop/covidify-output/ MESSAGE: No source given, defaulting to John Hopkin CSSE github repo

Job arguments:

ENV: /usr/local/lib/python3.7/site-packages/covidify OUTPUT FOLDER: /Users/enjrolas/Desktop/covidify-output/ DATA SOURCE: git

Data Extraction

git pull from https://github.com/CSSEGISandData/COVID-19.git Getting sheets... ... importing data: 100%|████████████████████████████████████████████████████████████████████████████████████████| 49/49 [00:02<00:00, 22.23it/s] Sorting by datetime... Calculating dataframe for new cases... Creating subdirectory for data... ... /Users/enjrolas/Desktop/covidify-output/data/2020-03-09 Saving... ... agg_data_2020-03-09.parquet.gzip ... agg_data_2020-03-09.csv ... trend_2020-03-09.csv Done!

Data Exploration

Importing Data... Creating graphs... ... Time Series Trend Line Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/covidify/data_exploration.py", line 93, in create_trend_line(agg_df, 'confirmed', 'deaths', 'recovered') File "/usr/local/lib/python3.7/site-packages/covidify/data_exploration.py", line 68, in create_trend_line fig.savefig(os.path.join(image_dir, '{}_trendline.jpg'.format(col))) File "/usr/local/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2014, in print_figure canvas = self._get_output_canvas(format) File "/usr/local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1956, in _get_output_canvas .format(fmt, ", ".join(sorted(self.get_supported_filetypes())))) ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)

Complete!

AaronWard commented 4 years ago

@enjrolas nice spot, ill change everything to png format 👍🏼

AaronWard commented 4 years ago

@enjrolas issue resolved in newest release

enjrolas commented 4 years ago

you're the best!

On Tue, Mar 10, 2020 at 8:56 PM Aaron notifications@github.com wrote:

@enjrolas https://github.com/enjrolas issue resolved in newest release

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AaronWard/covid-19-analysis/issues/9?email_source=notifications&email_token=AAAH3KI74MWHKOF3BEN3LVLRG3OTZA5CNFSM4LENGAZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEONXKNI#issuecomment-597390645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH3KPROSXMS7KCV3A7TRDRG3OTZANCNFSM4LENGAZQ .