python


Matplotlib: multiprocess with joblib


I need to compute and then plot 18 figures, so I want to do multiprocess with Matplotlib (I use joblib here). Here is the example code:
def try_plot(y):
fig = plt.figure()
ax = fig.add_subplot(111)
x=arange(1,10)
ax.plot(x, x*y)
return fig
# This works
figs = [try_plot(y) for y in arange(3)]
# This fails
from joblib import Parallel, delayed
figs = Parallel(n_jobs=-1)(delayed(try_plot)(y) for y in arange(3))
The error it gives to me is this:
Exception in thread Thread-8:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "D:\ProgramData\Anaconda3\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\ProgramData\Anaconda3\lib\multiprocessing\pool.py", line 429, in _handle_results
task = get()
File "D:\ProgramData\Anaconda3\lib\multiprocessing\connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1445, in __setstate__
mgr = plt._backend_mod.new_figure_manager_given_figure(num, self)
AttributeError: module 'ipykernel.pylab.backend_inline' has no attribute 'new_figure_manager_given_figure'
I searched around, but didn't find anyone use joblib with matplotlib, all I find is that it is possible to do multiprocessing with matplotlib, as stated in
https://matplotlib.org/2.0.0/examples/misc/multiprocess.html
Saving multiple matplotlib figures with multiprocessing

Related Links

Pycharm Quick Documentation: Fetching Documentation
How can I create binary label from two tables
pyautogui.locateOnScreen() Returns… Nothing?
How can I judge whether a mail send sccess or not use Python?
Django Admin list_display product list
Python: How can I index in MapReduce(MRJob)?
Download multiple CSV files from a list in a single CSV (Python)
Does Python garbage collect when Heroku warns about memory quota vastly exceeded (R15)?
reading function from another file into a button in python
Python - Mult-Threading Help - Reading Multiple Files - ETL Into SQL Server
'if' statement for when two random numbers are equal
How to read two lines in a data from same column to create combination of values from that column?
Jupyter pyspark : no module named pyspark
How to group data by ranges?
Series to_records - no object
python multiprocessing pool.map not blocking?

Categories

HOME
sql-server-2008
sass
elixir
wmic
ncurses
otrs
formal-verification
bibtex
csvhelper
search-engine
safari
apache2
azureservicebus
terrain
rebol
openwrt
goutte
aruco
keystore
pjsip
ssr
dlib
symfony-forms
typeahead
r-lavaan
ada
zend-framework-mvc
linq-to-sql
uiautomator
google-ima
header-files
explode
qsub
yosys
shopping-cart
geopandas
bus-error
widevine
frp
chrome-native-messaging
hana-studio
cell-array
roundcube
edb
hawtio
pox
mmdrawercontroller
s3cmd
linq-to-entities
rule
bayesian-networks
code-composer
tripwire
chown
pinvoke
ticker
static-code-analysis
push-diffusion
audioqueue
rstudio-server
firepath
freetype2
faraday
financial
amazon-kcl
brackets-shell
servlet-3.0
ytplayerview
divide-by-zero
debian-based
isml
apache-mina
gulp-livereload
subversion-edge
musl
sqoop2
inputaccessoryview
java-melody
fragment-tab-host
dmp
formvalidation-plugin
collabnet
mov
operations
angulartics
magicalrecord-2.2
justgage
lame
htmltextwriter
xml-libxml
zend-framework-modules
getusermedia
shim
unions
expression-evaluation
entity-framework-ctp5
carbide
clients
integer-promotion
nt4
document-library

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App