matplotlib / matplotlib/mplfinance
Fail to allocate bitmap
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 678
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello,
I have the following code that systematically ends up in the following error after 396 charts are saved.
**Fail to allocate bitmap
Process finished with exit code -2147483645**
I tried several combinations including with plt.close all or plt.close of the figure.
I tried with jpeg and png extensions
Although the memory does not seem to be cleaned up ( linear growth ) it does not seem to be the reason since it can fail with plenty of memory left to allocate.
I checked that it was not some kind of murky limitation of the disk, by moving the creation of the file to an NVME disk.
Also updated my graphic card drivers, because why not.
As you see I also tried to reload the module every time in the loop ( desperate move :) )
Really not sure what I am doing wrong here
I updated mplfinance to 0.12.7a17, matplotlib to 3.4.1.
Python version 3.9.2
for index in df.index :
try :
reload(mplfinance)
i=i+1
titleString =(df.iloc[index]['TimeStamp']).strftime('%Y-%m-%d')+' '+(df.iloc[index]['Symbol'])
print ('processing '+ str(index)+ ' ' + titleString)
minRange = df.iloc[index]['ChainPosition'] - chartingDayAddition
maxRange = df.iloc[index]['ChainPosition'] + tradeDuration + chartingDayAddition
prices = pd.DataFrame(get1dDB().aggregate(pipeline=[
{
'$match' : {
'Symbol' : df.iloc[index]['Symbol'] ,
'ChainPosition': {
'$gte': minRange.item() ,
'$lte': maxRange.item()
}
}
}]))
BuyLine = prices.loc[prices['ChainPosition'] == df.iloc[index]['ChainPosition']]
SellLine = prices.loc[prices['ChainPosition'] == (df.iloc[index]['ChainPosition'] + tradeDuration)]
vls =[(BuyLine.TimeStamp).iloc[0].strftime('%Y-%m-%d'),(SellLine.TimeStamp).iloc[0].strftime('%Y-%m-%d')]
prices.set_index('TimeStamp', inplace=True)
fig = mplfinance.plot( prices, type='candle',volume=True, title=titleString, savefig=dict(fname=detailsPath+titleString+'.jpg', dpi=150), closefig=True)
plt.close('all')
except :
print ('error')
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il loop segnalato con mplfinance.plot usando savefig, closefig=True e plt.close('all'), verificando il comportamento intorno al 396° grafico. Ispeziona i punti di ingresso di matplotlib e mplfinance coinvolti nel plotting e nel salvataggio delle bitmap in questo percorso. Il lavoro è completato quando viene identificata la causa dell’errore di allocazione e viene stabilita una correzione confermata o una limitazione documentata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- matplotlib, python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100