title: ImportError: cannot import name 'metadata' from 'importlib'
body: <p>Under a python (<code>Python 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32</code>) session launched in an Anaconda prompt, I get the error</p>
  
  <pre><code>&gt;&gt;&gt; import nbconvert
  Traceback (most recent call last):
    File "C:\Users\user1\Anaconda\lib\site-packages\jsonschema\__init__.py", line 31, in &lt;module&gt;
      from importlib import metadata
  ImportError: cannot import name 'metadata' from 'importlib' (C:\Users\user1\Anaconda\lib\importlib\__init__.py)
  </code></pre>
  
  <p>Effectively, <code>metadata</code> is not in <code>importlib</code></p>
  
  <pre><code>&gt;&gt;&gt; import importlib
  &gt;&gt;&gt; dir(importlib)
  ['_RELOADING', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__import__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_bootstrap', '_bootstrap_external', '_imp', '_r_long', '_w_long', 'abc', 'find_loader', 'import_module', 'invalidate_caches', 'machinery', 'reload', 'sys', 'types', 'util', 'warnings']
  </code></pre>
  
  <p><a href="https://github.com/pytest-dev/pytest/issues/5818" rel="noreferrer">This</a> is the only reference I found, mentioning it was observed <em>in some cases</em> (weird?) in python 3.8.</p>
  
  <hr>
  
  <p><strong>EDIT 1</strong>:
  I am now able to remove the error.
  There is one change that does that: removing a string in the <code>PYTHONPATH</code> environment variable that led to an <code>OSError: [WinError 123] ...</code> after <code>&gt;&gt;&gt; import nbconvert</code>.
  Removing / adding that string, removes / reinstates the error.</p>
  
  <p>I am not certain if the fact that I did <code>conda install nbconvert</code> in an activated virtualenv (where I have python 3.8.0) also played a role; I did not test before this install.</p>
  
  <p>More importantly, I cannot figure out the connection between the <code>OSError</code> and the <strong>presence of a line <code>from importlib import metadata</code></strong>.</p>
  
  <hr>
  
  <p><strong>EDIT 2</strong>:
  I have a virtualenv with python 3.8.0, where <code>importlib</code> does not have <code>metadata</code> either.
  So I still cannot figure out why the presence of a line <code>from importlib import metadata</code>.</p>
  
  <pre><code>C:\&gt; conda activate opencv
  C:\&gt; conda list
  ...
  importlib_metadata        1.1.0                    py38_0    defaults
  ...
  nbconvert                 5.6.1                    py38_0    defaults
  ...
  C:\&gt; python
  Python 3.8.0 (default, Nov  6 2019, 16:00:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import importlib
  &gt;&gt;&gt; dir(importlib)
  ['_RELOADING', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__import__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_bootstrap', '_bootstrap_external', '_imp', '_pack_uint32', '_unpack_uint32', 'find_loader', 'import_module', 'invalidate_caches', 'reload', 'sys', 'types', 'warnings']
  &gt;&gt;&gt; import nbconvert
  &gt;&gt;&gt;
  </code></pre>