<h3 dir="auto">Describe your issue.</h3>
<p dir="auto">I'm inconsistently getting a RuntimeWarning from scipy, seemingly only after running a matplotlib plotting function. This isn't really a problem for me, but it is weird and I didn't see it referenced anywhere so I figured I would at least raise an issue.</p>
<p dir="auto">I don't get the runtime error if I just run <code class="notranslate">beta.pdf(xs, 1.2, 1.8)</code> outside the plotting function. In general the error seems to appear inconsistently, and I'm not entirely sure how to characterise the conditions accurately.</p>
<p dir="auto">This is possibly related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="781683689" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/13364" data-hovercard-type="issue" data-hovercard-url="/scipy/scipy/issues/13364/hovercard" href="https://github.com/scipy/scipy/issues/13364">#13364</a>, since <a href="https://github.com/scipy/scipy/issues/13364#issuecomment-860052441" data-hovercard-type="issue" data-hovercard-url="/scipy/scipy/issues/13364/hovercard">this comment</a> has the same error from some tests. I am also on an M1 mac, and using the miniforge version of scipy).</p>
<h3 dir="auto">Reproducing Code Example</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
from scipy.stats import beta
import numpy as np

xs = np.linspace(0, 1, 100)
plt.plot(xs, beta.pdf(xs, 1.2, 1.8))
beta.ppf(0.01, 1.2, 1.8)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">from</span> <span class="pl-s1">scipy</span>.<span class="pl-s1">stats</span> <span class="pl-k">import</span> <span class="pl-s1">beta</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">xs</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">100</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">xs</span>, <span class="pl-s1">beta</span>.<span class="pl-en">pdf</span>(<span class="pl-s1">xs</span>, <span class="pl-c1">1.2</span>, <span class="pl-c1">1.8</span>))
<span class="pl-s1">beta</span>.<span class="pl-en">ppf</span>(<span class="pl-c1">0.01</span>, <span class="pl-c1">1.2</span>, <span class="pl-c1">1.8</span>)</pre></div>
<h3 dir="auto">Error message</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/opt/homebrew/Caskroom/miniforge/base/envs/smokey/lib/python3.9/site-packages/scipy/stats/_continuous_distns.py:624: RuntimeWarning: overflow encountered in _beta_ppf
  return _boost._beta_ppf(q, a, b)"><pre class="notranslate">/opt/homebrew/Caskroom/miniforge/base/envs/smokey/lib/python3.9/site-packages/scipy/stats/_continuous_distns.py:624: RuntimeWarning: overflow encountered <span class="pl-k">in</span> _beta_ppf
  <span class="pl-k">return</span> _boost._beta_ppf(q, a, b)</pre></div>
<h3 dir="auto">SciPy/NumPy/Python version information</h3>
<p dir="auto">1.7.0 1.21.2 sys.version_info(major=3, minor=9, micro=6, releaselevel='final', serial=0)</p>
<h3 dir="auto">Describe your issue</h3>
<p dir="auto">Several statistical distribution methods emit warnings stemming from Boost. This issue tracks the status of all of them.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">beta.ppf</code> as reported here; should be fixed by <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1393910253" data-permission-text="Title is private" data-url="https://github.com/boostorg/math/issues/827" data-hovercard-type="pull_request" data-hovercard-url="/boostorg/math/pull/827/hovercard" href="https://github.com/boostorg/math/pull/827">boostorg/math#827</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">ncf</code> as reported in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1388256302" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/17101" data-hovercard-type="issue" data-hovercard-url="/scipy/scipy/issues/17101/hovercard" href="https://github.com/scipy/scipy/issues/17101">gh-17101</a>, should be fixed by <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1410540033" data-permission-text="Title is private" data-url="https://github.com/boostorg/math/issues/846" data-hovercard-type="pull_request" data-hovercard-url="/boostorg/math/pull/846/hovercard" href="https://github.com/boostorg/math/pull/846">boostorg/math#846</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">nct</code> - I'm not sure that this has been reported separately yet. Is it caused by the same sort of thing?</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">ncx2</code> - Ditto.</li>
</ul>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1418900239" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/17272" data-hovercard-type="pull_request" data-hovercard-url="/scipy/scipy/pull/17272/hovercard" href="https://github.com/scipy/scipy/pull/17272">gh-17272</a> will silence <a href="https://github.com/scipy/scipy/issues/14901#issuecomment-1272504168" data-hovercard-type="issue" data-hovercard-url="/scipy/scipy/issues/14901/hovercard">the failures in SciPy's tests</a> temporarily, but as many of these marks as possible should be removed when <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1405303062" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/17207" data-hovercard-type="pull_request" data-hovercard-url="/scipy/scipy/pull/17207/hovercard" href="https://github.com/scipy/scipy/pull/17207">gh-17207</a> merges.</p>
<hr>
<p dir="auto"><em>Original Post</em></p>
<h3 dir="auto">Describe your issue.</h3>
<p dir="auto">macOS CI is failing due to an overflow. I am still trying to reproduce locally.</p>
<p dir="auto">NumPy was updated to 1.21.3, could be this or another dependency.</p>
<p dir="auto"><a href="https://github.com/scipy/scipy/runs/3960228039">https://github.com/scipy/scipy/runs/3960228039</a></p>
<h3 dir="auto">Reproducing Code Example</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# from scipy/stats/tests/test_distributions.py:2878: in test_issue_12796
import numpy as np
from scipy import stats
q = 0.999995
a = np.array([ 2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
b = np.array([99999, 99998, 99997, 99996, 99995, 99994, 99993, 99992, 99991, 99990, 99989, 99988, 99987, 99986, 99985, 99984, 99983, 99982, 99981])
stats.beta.ppf(q, a, b)"><pre class="notranslate"><span class="pl-c"># from scipy/stats/tests/test_distributions.py:2878: in test_issue_12796</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">scipy</span> <span class="pl-k">import</span> <span class="pl-s1">stats</span>
<span class="pl-s1">q</span> <span class="pl-c1">=</span> <span class="pl-c1">0.999995</span>
<span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([ <span class="pl-c1">2</span>,  <span class="pl-c1">3</span>,  <span class="pl-c1">4</span>,  <span class="pl-c1">5</span>,  <span class="pl-c1">6</span>,  <span class="pl-c1">7</span>,  <span class="pl-c1">8</span>,  <span class="pl-c1">9</span>, <span class="pl-c1">10</span>, <span class="pl-c1">11</span>, <span class="pl-c1">12</span>, <span class="pl-c1">13</span>, <span class="pl-c1">14</span>, <span class="pl-c1">15</span>, <span class="pl-c1">16</span>, <span class="pl-c1">17</span>, <span class="pl-c1">18</span>, <span class="pl-c1">19</span>, <span class="pl-c1">20</span>])
<span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">99999</span>, <span class="pl-c1">99998</span>, <span class="pl-c1">99997</span>, <span class="pl-c1">99996</span>, <span class="pl-c1">99995</span>, <span class="pl-c1">99994</span>, <span class="pl-c1">99993</span>, <span class="pl-c1">99992</span>, <span class="pl-c1">99991</span>, <span class="pl-c1">99990</span>, <span class="pl-c1">99989</span>, <span class="pl-c1">99988</span>, <span class="pl-c1">99987</span>, <span class="pl-c1">99986</span>, <span class="pl-c1">99985</span>, <span class="pl-c1">99984</span>, <span class="pl-c1">99983</span>, <span class="pl-c1">99982</span>, <span class="pl-c1">99981</span>])
<span class="pl-s1">stats</span>.<span class="pl-s1">beta</span>.<span class="pl-en">ppf</span>(<span class="pl-s1">q</span>, <span class="pl-s1">a</span>, <span class="pl-s1">b</span>)</pre></div>
<h3 dir="auto">Error message</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12635 - ...
927
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12794 - ...
928
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12796 - ...
...
scipy/stats/_continuous_distns.py:626: in _ppf
916
    return _boost._beta_ppf(q, a, b)
917
E   RuntimeWarning: overflow encountered in _beta_ppf"><pre class="notranslate">FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12635 - ...
927
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12794 - ...
928
FAILED scipy/stats/tests/test_distributions.py::TestBeta::test_issue_12796 - ...
...
scipy/stats/_continuous_distns.py:626: <span class="pl-k">in</span> _ppf
916
    <span class="pl-k">return</span> _boost._beta_ppf(q, a, b)
917
E   RuntimeWarning: overflow encountered <span class="pl-k">in</span> _beta_ppf</pre></div>
<h3 dir="auto">SciPy/NumPy/Python version information</h3>
<p dir="auto">master on macOS/CI</p>