<p dir="auto">To help us understand and resolve your issue, please fill out the form to the best of your ability. You can feel free to delete the sections that do not apply.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<ul dir="auto">
<li>A short 1-2 sentences that succinctly describes the bug</li>
</ul>
<p dir="auto">I receive a UTF-8 error when importing matplotlib == 1.5.1 when installed either from conda or pip. I am using OSX 10.11.6 and Python 3.5.2. This laptop has Spanish locale support but this was done entirely within the US locale setting. There is no matplotlibrc file that I am aware of.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ conda install matplotlib
$ python
&gt; import matplotlib"><pre class="notranslate">$ conda install matplotlib
$ python
<span class="pl-k">&gt;</span> import matplotlib</pre></div>
<ul dir="auto">
<li>A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required</li>
</ul>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ conda install matplotlib
$ python
&gt; import matplotlib# Paste your code here"><pre class="notranslate">$ conda install matplotlib
$ python
<span class="pl-k">&gt;</span> import matplotlib# Paste your code here</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<ul dir="auto">
<li>The output produced by the above code, which may be a screenshot, console output, etc.</li>
</ul>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import matplotlib
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py&quot;, line 1131, in &lt;module&gt;
    rcParams = rc_params()
  File &quot;//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py&quot;, line 975, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File &quot;//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py&quot;, line 1100, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File &quot;//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py&quot;, line 1018, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File &quot;//anaconda/envs/qiime2/lib/python3.5/contextlib.py&quot;, line 59, in __enter__
    return next(self.gen)
  File &quot;//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py&quot;, line 1000, in _open_file_or_url
    encoding = locale.getdefaultlocale()[1]
  File &quot;//anaconda/envs/qiime2/lib/python3.5/locale.py&quot;, line 558, in getdefaultlocale
    return _parse_localename(localename)
  File &quot;//anaconda/envs/qiime2/lib/python3.5/locale.py&quot;, line 486, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8"><pre class="notranslate">$ <span class="pl-s1">python</span>
<span class="pl-v">Python</span> <span class="pl-c1">3.5</span><span class="pl-c1">.2</span> <span class="pl-c1">|</span><span class="pl-v">Continuum</span> <span class="pl-v">Analytics</span>, <span class="pl-v">Inc</span>.<span class="pl-s1"></span><span class="pl-c1">|</span> (<span class="pl-s1">default</span>, <span class="pl-v">Jul</span>  <span class="pl-c1">2</span> <span class="pl-c1">2016</span>, <span class="pl-c1">17</span>:<span class="pl-c1">52</span>:<span class="pl-c1">12</span>) 
[<span class="pl-v">GCC</span> <span class="pl-c1">4.2</span><span class="pl-c1">.1</span> <span class="pl-v">Compatible</span> <span class="pl-v">Apple</span> <span class="pl-v">LLVM</span> <span class="pl-c1">4.2</span> (<span class="pl-s1">clang</span><span class="pl-c1">-</span><span class="pl-c1">425.0</span>.<span class="pl-c1">28</span>)] <span class="pl-s1">on</span> <span class="pl-s1">darwin</span>
<span class="pl-v">Type</span> <span class="pl-s">"help"</span>, <span class="pl-s">"copyright"</span>, <span class="pl-s">"credits"</span> <span class="pl-c1">or</span> <span class="pl-s">"license"</span> <span class="pl-k">for</span> <span class="pl-s1">more</span> <span class="pl-s1">information</span>.
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-c1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1131</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">rcParams</span> <span class="pl-c1">=</span> <span class="pl-en">rc_params</span>()
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">975</span>, <span class="pl-s1">in</span> <span class="pl-s1">rc_params</span>
    <span class="pl-s1">return</span> <span class="pl-en">rc_params_from_file</span>(<span class="pl-s1">fname</span>, <span class="pl-s1">fail_on_error</span>)
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1100</span>, <span class="pl-s1">in</span> <span class="pl-s1">rc_params_from_file</span>
    <span class="pl-s1">config_from_file</span> <span class="pl-c1">=</span> <span class="pl-en">_rc_params_in_file</span>(<span class="pl-s1">fname</span>, <span class="pl-s1">fail_on_error</span>)
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1018</span>, <span class="pl-s1">in</span> <span class="pl-s1">_rc_params_in_file</span>
    <span class="pl-s1">with</span> <span class="pl-en">_open_file_or_url</span>(<span class="pl-s1">fname</span>) <span class="pl-k">as</span> <span class="pl-s1">fd</span>:
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/contextlib.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">59</span>, <span class="pl-s1">in</span> <span class="pl-s1">__enter__</span>
    <span class="pl-k">return</span> <span class="pl-en">next</span>(<span class="pl-s1">self</span>.<span class="pl-s1">gen</span>)
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1000</span>, <span class="pl-s1">in</span> <span class="pl-s1">_open_file_or_url</span>
    <span class="pl-s1">encoding</span> <span class="pl-c1">=</span> <span class="pl-s1">locale</span>.<span class="pl-en">getdefaultlocale</span>()[<span class="pl-c1">1</span>]
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/locale.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">558</span>, <span class="pl-s1">in</span> <span class="pl-s1">getdefaultlocale</span>
    <span class="pl-k">return</span> <span class="pl-en">_parse_localename</span>(<span class="pl-s1">localename</span>)
  <span class="pl-v">File</span> <span class="pl-s">"//anaconda/envs/qiime2/lib/python3.5/locale.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">486</span>, <span class="pl-s1">in</span> <span class="pl-s1">_parse_localename</span>
    <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">'unknown locale: %s'</span> <span class="pl-c1">%</span> <span class="pl-s1">localename</span>)
<span class="pl-v">ValueError</span>: <span class="pl-s1">unknown</span> <span class="pl-s1">locale</span>: <span class="pl-v">UTF</span><span class="pl-c1">-</span><span class="pl-c1">8</span></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>
<ul dir="auto">
<li>A description of the expected outcome from the code snippet</li>
</ul>
<p dir="auto">A successful import of matplotlib</p>
<ul dir="auto">
<li>If this used to work in an earlier version of Matplotlib, please note the version it used to work on</li>
</ul>
<p dir="auto"><strong>Matplotlib version</strong></p>
<p dir="auto">1.5.1</p>
<ul dir="auto">
<li>Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)</li>
</ul>
<p dir="auto">Please see above</p>
<ul dir="auto">
<li>How did you install Matplotlib and Python (pip, anaconda, from source ...)</li>
</ul>
<p dir="auto">Tried conda and pip.</p>
<p dir="auto">Hi guys!<br>
I am new to python and matplotlib.<br>
I installed everything with macports and when I run the matplotlib test</p>
<p dir="auto">python2.7 -c 'import matplotlib; print matplotlib.<strong>version</strong>, matplotlib.<strong>file</strong>'</p>
<p dir="auto">I get the following</p>
<p dir="auto">Traceback (most recent call last):<br>
File "", line 1, in <br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/<strong>init</strong>.py", line 1131, in <br>
rcParams = rc_params()<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/<strong>init</strong>.py", line 975, in rc_params<br>
return rc_params_from_file(fname, fail_on_error)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/<strong>init</strong>.py", line 1100, in rc_params_from_file<br>
config_from_file = _rc_params_in_file(fname, fail_on_error)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/<strong>init</strong>.py", line 1018, in _rc_params_in_file<br>
with _open_file_or_url(fname) as fd:<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in <strong>enter</strong><br>
return self.gen.next()<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/<strong>init</strong>.py", line 1000, in _open_file_or_url<br>
encoding = locale.getdefaultlocale()[1]<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale<br>
return _parse_localename(localename)<br>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename<br>
raise ValueError, 'unknown locale: %s' % localename<br>
ValueError: unknown locale: UTF-8</p>
<p dir="auto">Do you guys have any idea what is happening....I have not done enything weards just follow simple steps to install it.</p>
<p dir="auto">I want to use QUTIP  and the matplotlib is essential for it...please if someone know it would be really nice</p>
<p dir="auto">thanks!<br>
regards,</p>