question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frozen importlib._bootstrap on second import

See original GitHub issue

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [na] Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

On a second import, my script is giving a KeyError from importlib._bootstrap instead of properly reloading a submodule. If I manually enter the single line in the script in the ipython prompt, it works without issue.

What steps reproduce the problem?

  1. Install PyConTurb using the instructions here. (Sorry, I couldn’t reproduce it with another package.)
  2. Create a module error.py with a single line: from pyconturb.io.hawc2 import dat_to_df. 2a. If you can’t recreate this error, I’m running spyder from a different environment than my pyconturb environment and you might need to recreate my environment setup. I can provide details on this if needed.
  3. Run script once. It should work. Run it again, you get the error reprinted below.

What is the expected output? What do you see instead?

I expect a one-line module to be able to run more than once, but instead I get the traceback printed in the next section.

Paste Traceback/Error Below (if applicable)


Traceback (most recent call last):

  File "<ipython-input-10-2437b3b92216>", line 1, in <module>
    runfile('C:/Users/rink/git/master-esperanza/rink_code/test_hawc2_turb.py', wdir='C:/Users/rink/git/master-esperanza/rink_code')

  File "C:\Users\rink\AppData\Local\Continuum\miniconda3\envs\espe\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\rink\AppData\Local\Continuum\miniconda3\envs\espe\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/rink/git/master-esperanza/rink_code/test_hawc2_turb.py", line 10, in <module>
    from pyconturb.io.hawc2 import dat_to_df

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load

  File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 890, in _find_spec

  File "<frozen importlib._bootstrap>", line 864, in _find_spec_legacy

  File "C:\Users\rink\AppData\Local\Continuum\miniconda3\envs\espe\lib\site-packages\IPython\external\qt_loaders.py", line 48, in find_module
    if path:

  File "<frozen importlib._bootstrap_external>", line 1000, in __len__

  File "<frozen importlib._bootstrap_external>", line 982, in _recalculate

  File "<frozen importlib._bootstrap_external>", line 978, in _get_parent_path

KeyError: 'pyconturb'

Versions

Spyder environment:

  • Spyder version: 3.3.4
  • Python version: 3.6
  • Qt version: 5.9.7
  • PyQt version: 5.9.2

PyConTurb environment (also Python 3.6):

  • spyder-kernels: 0.4.4

Other info:

  • Operating System name/version: Windows 10 (sorry…)

Dependencies

IPython >=4.0     :  7.2.0 (OK)
cython >=0.21     :  None (NOK)
jedi >=0.9.0      :  0.13.2 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  1.15.4 (OK)
pandas >=0.13.1   :  0.24.0 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pyflakes >=0.6.0  :  2.0.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
pylint >=0.25     :  2.2.2 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.8.2 (OK)
sympy >=0.7.3     :  None (NOK)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, May 2, 2019

Thanks for reporting. I don’t understand the cause of this error but we’ll try to figure it out.

@dalthviz, please follow @jennirinker instructions to see if you’re able to reproduce this error.

0reactions
ccordoba12commented, May 13, 2019

Closing because this is not an Spyder issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KeyError / frozen importlib._bootstrap error on second library ...
The error does not occur when the library is not in a subfolder i.e. from python_library.test_lib2 import test_func. runs arbitrarily often.
Read more >
I am getting an error Import "_frozen_importlib" could not be ...
_bootstrap is the built-in import, ensure we don't create # a second copy of the module. _bootstrap.__name__ = 'importlib.
Read more >
Django Error Resolve!!!!!! Frozen Importlib bootstrap - YouTube
... About this video: In this video we will see how to resolve a django error import forzen importlib bootstrap for that stay...
Read more >
"Impossible" KeyError from importlib._bootstrap acquire line 110
First I'll show the symptom, we started getting the following error: ... File "/root/.pyenv/versions/3.9.2/lib/python3.9/site-packages/django/db ...
Read more >
importlib._bootstrap — pyproj 3.0.1 documentation
python around to freeze the module # in the early stages of compilation. ... The following two functions are for consumption by Python/import.c....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found