brightway-lca/brightway2

'import brightway2' causes ModuleNotFoundError when Jupyter Notebook uses autoreload magic

Closed this issue · 2 comments

To reproduce the error, run in a cell:

%load_ext autoreload
%autoreload 2

# some random imports
import sys
import os
from pathlib import Path
import gzip
import pickle
import configparser

# brightway import
import brightway2 as bw

, which returns

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File ~/miniconda3/envs/lca_pylcaio/lib/python3.10/site-packages/IPython/extensions/autoreload.py:615, in AutoreloadMagics.post_execute_hook(self)
    613 newly_loaded_modules = set(sys.modules) - self.loaded_modules
    614 for modname in newly_loaded_modules:
--> 615     _, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
    616     if pymtime is not None:
    617         self._reloader.modules_mtimes[modname] = pymtime

File ~/miniconda3/envs/lca_pylcaio/lib/python3.10/site-packages/IPython/extensions/autoreload.py:193, in ModuleReloader.filename_and_mtime(self, module)
    192 def filename_and_mtime(self, module):
--> 193     if not hasattr(module, "__file__") or module.__file__ is None:
    194         return None, None
    196     if getattr(module, "__name__", None) in [None, "__mp_main__", "__main__"]:
    197         # we cannot reload(__main__) or reload(__mp_main__)

File ~/miniconda3/envs/lca_pylcaio/lib/python3.10/site-packages/eight/utils.py:41, in RedirectingLoader.__getattr__(self, attr)
     39 else:
     40     if self._module is None:
---> 41         self._module = __import__(self._name)
     42     if len(self._moves) == 0:
     43         sys.modules[self._parent_name + '.' + self._name] = sys.modules[self._name]

ModuleNotFoundError: No module named '_dummy_thread'

Conda environment specifications:

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_kmp_llvm conda-forge
anyio 3.6.1 pyhd8ed1ab_1 conda-forge
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge
argon2-cffi-bindings 21.2.0 py310h5764c6d_2 conda-forge
asteval 0.9.27 pyhd8ed1ab_0 conda-forge
asttokens 2.0.8 pyhd8ed1ab_0 conda-forge
astunparse 1.6.3 pyhd8ed1ab_0 conda-forge
attrs 22.1.0 pyh71513ae_1 conda-forge
babel 2.10.3 pyhd8ed1ab_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.11.1 pyha770c72_0 conda-forge
bleach 5.0.1 pyhd8ed1ab_0 conda-forge
brightway2 2.4.2 py_5 cmutel
brotli 1.0.9 h166bdaf_7 conda-forge
brotli-bin 1.0.9 h166bdaf_7 conda-forge
brotlipy 0.7.0 py310h5764c6d_1004 conda-forge
bw2agg 0.1.2 pypi_0 pypi
bw2analyzer 0.10 py_1 cmutel
bw2calc 1.8.1 py_2 cmutel
bw2data 3.6.5 py_0 cmutel
bw2io 0.8.6 py_1 cmutel
bw2parameters 0.7 py_0 cmutel
bw_migrations 0.1 py_0 cmutel
bzip2 1.0.8 h7f98852_4 conda-forge
c-ares 1.18.1 h7f98852_0 conda-forge
ca-certificates 2022.6.15 ha878542_0 conda-forge
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
certifi 2022.6.15 py310hff52083_0 conda-forge
cffi 1.15.1 py310h255011f_0 conda-forge
charset-normalizer 2.1.0 pyhd8ed1ab_0 conda-forge
cryptography 37.0.4 py310h597c629_0 conda-forge
curl 7.83.1 h7bff187_0 conda-forge
cycler 0.11.0 pyhd8ed1ab_0 conda-forge
debugpy 1.6.3 py310hd8f1fbe_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
docopt 0.6.2 py_1 conda-forge
docutils 0.19 py310hff52083_0 conda-forge
ecospold2matrix 0.2.0.dev0 pypi_0 pypi
eight 1.0.0 py_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_0 conda-forge
et_xmlfile 1.0.1 py_1001 conda-forge
executing 0.10.0 pyhd8ed1ab_0 conda-forge
expat 2.4.8 h27087fc_0 conda-forge
fasteners 0.17.3 pyhd8ed1ab_0 conda-forge
flit-core 3.7.1 pyhd8ed1ab_0 conda-forge
fonttools 4.36.0 py310h5764c6d_0 conda-forge
freetype 2.12.1 hca18f0e_0 conda-forge
future 0.18.2 py310hff52083_5 conda-forge
gettext 0.19.8.1 h73d1719_1008 conda-forge
git 2.37.2 pl5321h36853c3_1 conda-forge
h5py 3.7.0 nompi_py310h416281c_101 conda-forge
hdf5 1.12.2 nompi_h2386368_100 conda-forge
icu 70.1 h27087fc_0 conda-forge
idna 3.3 pyhd8ed1ab_0 conda-forge
importlib-metadata 4.11.4 py310hff52083_0 conda-forge
importlib_metadata 4.11.4 hd8ed1ab_0 conda-forge
importlib_resources 5.9.0 pyhd8ed1ab_0 conda-forge
ipykernel 6.15.1 pyh210e3f2_0 conda-forge
ipython 8.4.0 py310hff52083_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.18.1 pyhd8ed1ab_2 conda-forge
jinja2 3.1.2 pyhd8ed1ab_1 conda-forge
jpeg 9e h166bdaf_2 conda-forge
json5 0.9.5 pyh9f0ad1d_0 conda-forge
jsonschema 4.9.1 pyhd8ed1ab_0 conda-forge
jupyter_client 7.3.4 pyhd8ed1ab_0 conda-forge
jupyter_core 4.11.1 py310hff52083_0 conda-forge
jupyter_server 1.18.1 pyhd8ed1ab_0 conda-forge
jupyterlab 3.4.5 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.15.0 pyhd8ed1ab_0 conda-forge
keyutils 1.6.1 h166bdaf_0 conda-forge
kiwisolver 1.4.4 py310hbf28c38_0 conda-forge
krb5 1.19.3 h3790be6_0 conda-forge
lcms2 2.12 hddcbb42_0 conda-forge
ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge
lerc 4.0.0 h27087fc_0 conda-forge
libblas 3.9.0 16_linux64_mkl conda-forge
libbrotlicommon 1.0.9 h166bdaf_7 conda-forge
libbrotlidec 1.0.9 h166bdaf_7 conda-forge
libbrotlienc 1.0.9 h166bdaf_7 conda-forge
libcblas 3.9.0 16_linux64_mkl conda-forge
libcurl 7.83.1 h7bff187_0 conda-forge
libdeflate 1.13 h166bdaf_0 conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libev 4.33 h516909a_1 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.1.0 h8d9b700_16 conda-forge
libgfortran-ng 12.1.0 h69a702a_16 conda-forge
libgfortran5 12.1.0 hdcd56e2_16 conda-forge
libiconv 1.16 h516909a_0 conda-forge
liblapack 3.9.0 16_linux64_mkl conda-forge
libnghttp2 1.47.0 hdcd2b5c_1 conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libpng 1.6.37 h753d276_4 conda-forge
libsodium 1.0.18 h36c2ea0_1 conda-forge
libsqlite 3.39.2 h753d276_1 conda-forge
libssh2 1.10.0 haa6b8db_3 conda-forge
libstdcxx-ng 12.1.0 ha89aaad_16 conda-forge
libtiff 4.4.0 h0e0dad5_3 conda-forge
libuuid 2.32.1 h7f98852_1000 conda-forge
libwebp-base 1.2.4 h166bdaf_0 conda-forge
libxcb 1.13 h7f98852_1004 conda-forge
libxml2 2.9.14 h22db469_4 conda-forge
libxslt 1.1.35 h8affb1d_0 conda-forge
libzlib 1.2.12 h166bdaf_2 conda-forge
llvm-openmp 14.0.4 he0ac6c6_0 conda-forge
lxml 4.9.1 py310h5764c6d_0 conda-forge
markupsafe 2.1.1 py310h5764c6d_1 conda-forge
matplotlib-base 3.5.3 py310h5701ce4_1 conda-forge
matplotlib-inline 0.1.5 pyhd8ed1ab_0 conda-forge
mistune 0.8.4 py310h6acc77f_1005 conda-forge
mkl 2022.1.0 h84fe81f_915 conda-forge
mrio_common_metadata 0.2.1 py_0 cmutel
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
nbclassic 0.4.3 pyhd8ed1ab_0 conda-forge
nbclient 0.6.6 pyhd8ed1ab_0 conda-forge
nbconvert 6.5.3 pyhd8ed1ab_0 conda-forge
nbconvert-core 6.5.3 pyhd8ed1ab_0 conda-forge
nbconvert-pandoc 6.5.3 pyhd8ed1ab_0 conda-forge
nbformat 5.4.0 pyhd8ed1ab_0 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
nest-asyncio 1.5.5 pyhd8ed1ab_0 conda-forge
nose 1.3.7 pypi_0 pypi
notebook 6.4.12 pyha770c72_0 conda-forge
notebook-shim 0.1.0 pyhd8ed1ab_0 conda-forge
numpy 1.23.2 py310h53a5b5f_0 conda-forge
openjpeg 2.5.0 h7d73246_1 conda-forge
openpyxl 3.0.9 pyhd8ed1ab_0 conda-forge
openssl 1.1.1q h166bdaf_0 conda-forge
packaging 21.3 pyhd8ed1ab_0 conda-forge
pandas 1.4.3 py310h769672d_0 conda-forge
pandoc 2.19 ha770c72_0 conda-forge
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
pcre2 10.37 hc3806b6_1 conda-forge
peewee 3.15.1 py310hba2f8c6_0 conda-forge
perl 5.32.1 2_h7f98852_perl5 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 9.2.0 py310hbd86126_2 conda-forge
pip 22.2.2 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_0 conda-forge
prometheus_client 0.14.1 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.30 pyha770c72_0 conda-forge
psutil 5.9.1 py310h5764c6d_0 conda-forge
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pygments 2.13.0 pyhd8ed1ab_0 conda-forge
pymrio 0.4.7 pyhd8ed1ab_0 conda-forge
pyopenssl 22.0.0 pyhd8ed1ab_0 conda-forge
pypardiso 0.4.1 pyhd8ed1ab_0 conda-forge
pyparsing 3.0.9 pyhd8ed1ab_0 conda-forge
pyprind 2.11.2 py310hff52083_1003 conda-forge
pyrsistent 0.18.1 py310h5764c6d_1 conda-forge
pysocks 1.7.1 py310hff52083_5 conda-forge
python 3.10.5 h582c2e5_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-fastjsonschema 2.16.1 pyhd8ed1ab_0 conda-forge
python_abi 3.10 2_cp310 conda-forge
pytz 2022.2.1 pyhd8ed1ab_0 conda-forge
pyxlsb 1.0.9 pyhd8ed1ab_0 conda-forge
pyzmq 23.2.1 py310h330234f_0 conda-forge
readline 8.1.2 h0f457ee_0 conda-forge
requests 2.28.1 pyhd8ed1ab_0 conda-forge
scipy 1.9.0 py310hdfbd76f_0 conda-forge
send2trash 1.8.0 pyhd8ed1ab_0 conda-forge
setuptools 65.0.2 py310hff52083_0 conda-forge
setuptools-scm 7.0.5 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sniffio 1.2.0 py310hff52083_3 conda-forge
soupsieve 2.3.2.post1 pyhd8ed1ab_0 conda-forge
sqlite 3.39.2 h4ff8645_1 conda-forge
stack_data 0.4.0 pyhd8ed1ab_0 conda-forge
stats_arrays 0.6.5 pyhd8ed1ab_0 conda-forge
tabulate 0.8.10 pyhd8ed1ab_0 conda-forge
tbb 2021.5.0 h924138e_1 conda-forge
terminado 0.15.0 py310hff52083_0 conda-forge
tinycss2 1.1.1 pyhd8ed1ab_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tornado 6.2 py310h5764c6d_0 conda-forge
traitlets 5.3.0 pyhd8ed1ab_0 conda-forge
typing-extensions 4.3.0 hd8ed1ab_0 conda-forge
typing_extensions 4.3.0 pyha770c72_0 conda-forge
tzdata 2022c h191b570_0 conda-forge
unicodecsv 0.14.1 py_1 conda-forge
unicodedata2 14.0.0 py310h5764c6d_1 conda-forge
unidecode 1.3.4 pyhd8ed1ab_0 conda-forge
urllib3 1.26.11 pyhd8ed1ab_0 conda-forge
voluptuous 0.13.1 pyhd8ed1ab_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
websocket-client 1.3.3 pyhd8ed1ab_0 conda-forge
wheel 0.37.1 pyhd8ed1ab_0 conda-forge
whoosh 2.7.4 py310hff52083_6 conda-forge
wrapt 1.14.1 py310h5764c6d_0 conda-forge
xlrd 2.0.1 pyhd8ed1ab_3 conda-forge
xlsxwriter 3.0.3 pyhd8ed1ab_0 conda-forge
xlwt 1.3.0 pypi_0 pypi
xorg-libxau 1.0.9 h7f98852_0 conda-forge
xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
zeromq 4.3.4 h9c3ff4c_1 conda-forge
zipp 3.8.1 pyhd8ed1ab_0 conda-forge
zstd 1.5.2 h6239696_4 conda-forge

This is a known issue from eight .
Make sure you have eight version 1.0.1 , which unfortunately is only avail as a pip package.

see: brightway-lca/brightway2-calc#43

eight=1.0.1 now available on conda-forge (conda-forge/eight-feedstock#7)