title: "from __future__ import absolute_import" doesn't disable relative import in Jupyter notebook. How to fix it?
body: <p>From this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/13233931/python-disabling-relative-import">Python: Disabling relative import</a></p>
  
  <p>it is indicated that relative import can be disabled by:</p>
  
  <pre><code>from __future__ import absolute_import
  </code></pre>
  
  <p>However this rule seems cannot be extended to Jupyter notebook. Here is a quick experiment, when I create a python file that has identical name with a python package (in this case networkx). It can cause all absolute import of that package to fail. The following is a screenshot that describe this case:</p>
  
  <p><a href="https://i.stack.imgur.com/hhUwR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hhUwR.png" alt="enter image description here"></a></p>
  
  <p>The installed package 'network' already contains the submodule 'drawing', yet the import failed with the following message:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  &lt;ipython-input-2-e38c4f8fc4a0&gt; in &lt;module&gt;
        1 from __future__ import absolute_import
        2 
  ----&gt; 3 from networkx import drawing
  
  ImportError: cannot import name 'drawing'
  </code></pre>
  
  <p>How to fix it in Jupyter notebook or Jupyter lab? Does this means there is no way I can avoid relative import?</p>
  
  <p><strong>UPDATE</strong>: thanks a lot for the answers, one of them is to suggest that I have a corrupted PYTHONPATH (or sys.path), this is not the case, I have added the following line to show the inconsistency of PYTHONPATH and resolved module path:</p>
  
  <pre><code>from __future__ import absolute_import
  import os
  import sys
  
  
  for p in sys.path:
      print(p)
  
  print("=================")
  
  import networkx
  print(os.path.abspath(networkx.__file__))
  
  from networkx import drawing
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>&gt; /home/shared/anaconda3/lib/python36.zip
  &gt; /home/shared/anaconda3/lib/python3.6
  &gt; /home/shared/anaconda3/lib/python3.6/lib-dynload
  &gt; /home/peng/.local/lib/python3.6/site-packages
  &gt; /home/shared/anaconda3/lib/python3.6/site-packages
  &gt; /home/shared/anaconda3/lib/python3.6/site-packages/IPython/extensions
  &gt; /home/peng/.ipython
  &gt; ================= /home/peng/git/convnet-abstraction/slide/package/networkx.py
  &gt; --------------------------------------------------------------------------- ImportError                               Traceback (most recent call
  &gt; last) &lt;ipython-input-4-d28ac292787c&gt; in &lt;module&gt;
  &gt;      12 print(os.path.abspath(networkx.__file__))
  &gt;      13 
  &gt; ---&gt; 14 from networkx import drawing
  &gt; 
  &gt; ImportError: cannot import name 'drawing'
  </code></pre>
  
  <p>Here is another screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/RFcgZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RFcgZ.png" alt="enter image description here"></a></p>