brightway-lca / brightway2-calc

The calculation engine for the Brightway2 life cycle assessment framework.
BSD 3-Clause "New" or "Revised" License
11 stars 14 forks source link

PyPardisoError: The Pardiso solver failed with error code -3. See Pardiso documentation for details. #66

Closed lelecanfora closed 2 months ago

lelecanfora commented 1 year ago

On a new, clean conda environment: conda create -n brightway -c conda-forge -c cmutel brightway25 python=3.10 lca.lci() fails with all ecoinvent 3.9.1 activities: example 'activity': 'c3e75836-0413-5aa0-8e63-72c712da0bb7' when calculating the impact for IPCC 2021 CC GWP 100

functional_unit = { act: 1 }
lca = bc.LCA(functional_unit, IPCC2021CCGWP100)
lca.lci()
lca.lcia()
lca.score

PyPardisoError Traceback (most recent call last) Cell In [18], line 4 2 functional_unit = { act: 1 } 3 lca = bc.LCA(functional_unit, IPCC2021CCGWP100) ----> 4 lca.lci() 5 lca.lcia() 6 lca.score

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/bw2calc/lca.py:363, in LCA.lci(self, demand, factorize) 361 if factorize and not PYPARDISO: 362 self.decompose_technosphere() --> 363 self.lci_calculation()

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/bw2calc/lca.py:371, in LCA.lci_calculation(self) 365 def lci_calculation(self) -> None: 366 """The actual LCI calculation. 367 368 Separated from lci to be reusable in cases where the matrices are already built, e.g. redo_lci and Monte Carlo classes. 369 370 """ --> 371 self.supply_array = self.solve_linear_system() 372 # Turn 1-d array into diagonal matrix 373 count = len(self.dicts.activity)

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/bw2calc/lca.py:336, in LCA.solve_linear_system(self) 334 return self.solver(self.demand_array) 335 else: --> 336 return spsolve(self.technosphere_matrix, self.demand_array)

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/pypardiso/scipy_aliases.py:46, in spsolve(A, b, factorize, squeeze, solver, *args, **kwargs) 44 solver._check_A(A) 45 if factorize and not solver._is_already_factorized(A): ---> 46 solver.factorize(A) 48 x = solver.solve(A, b) 50 if squeeze:

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/pypardiso/pardiso_wrapper.py:155, in PyPardisoSolver.factorize(self, A) 153 self.set_phase(12) 154 b = np.zeros((A.shape[0], 1)) --> 155 self._call_pardiso(A, b)

File ~/miniconda3/envs/brightway/lib/python3.10/site-packages/pypardiso/pardiso_wrapper.py:286, in PyPardisoSolver._call_pardiso(self, A, b) 268 self._mkl_pardiso(self.pt.ctypes.data_as(ctypes.POINTER(self._pt_type[0])), # pt 269 ctypes.byref(ctypes.c_int32(1)), # maxfct 270 ctypes.byref(ctypes.c_int32(1)), # mnum (...) 282 x.ctypes.data_as(c_float64_p), # x -> output 283 ctypes.byref(pardiso_error)) # pardiso error 285 if pardiso_error.value != 0: --> 286 raise PyPardisoError(pardiso_error.value) 287 else: 288 return np.ascontiguousarray(x)

PyPardisoError: The Pardiso solver failed with error code -3. See Pardiso documentation for details.

lelecanfora commented 1 year ago

conda list

(bw_new) lele@lele-ThinkPad-T14s-Gen-2a:~/git/bw2_shared$ conda list
# packages in environment at /home/lele/miniconda3/envs/bw_new:
#
# Name                    Version                   Build  Channel
_ipython_minor_entry_point 8.7.0                hb6b4a82_0    conda-forge
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                  2_kmp_llvm    conda-forge
anyio                     3.6.2              pyhd8ed1ab_0    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_3    conda-forge
asteval                   0.9.28             pyhd8ed1ab_0    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
babel                     2.11.0             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    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
brightway25               1.0.6                     py_10    cmutel
brotli                    1.0.9                h166bdaf_8    conda-forge
brotli-bin                1.0.9                h166bdaf_8    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge
bw2analyzer               0.11.4             pyhd8ed1ab_1    conda-forge
bw2calc                   2.0.dev12                  py_0    cmutel
bw2data                   4.0.dev18                  py_0    cmutel
bw2io                     0.9.dev10                  py_0    cmutel
bw2parameters             0.7                pyhd8ed1ab_0    conda-forge
bw_migrations             0.2                pyhd8ed1ab_0    conda-forge
bw_processing             0.8.2              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.1.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.6           py310hbf28c38_0    conda-forge
cryptography              38.0.4          py310h600f1e7_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
debugpy                   1.6.4           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
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
et_xmlfile                1.0.1                   py_1001    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
fasteners                 0.17.3             pyhd8ed1ab_0    conda-forge
flit-core                 3.8.0              pyhd8ed1ab_0    conda-forge
fonttools                 4.38.0          py310h5764c6d_1    conda-forge
freetype                  2.12.1               hca18f0e_1    conda-forge
fs                        2.4.15             pyhd8ed1ab_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        6.0.0              pyha770c72_0    conda-forge
importlib_resources       5.10.1             pyhd8ed1ab_1    conda-forge
ipykernel                 6.19.4             pyh210e3f2_0    conda-forge
ipython                   8.7.0              pyh41d4057_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    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.17.3             pyhd8ed1ab_0    conda-forge
jupyter_client            7.4.8              pyhd8ed1ab_0    conda-forge
jupyter_core              5.1.1           py310hff52083_0    conda-forge
jupyter_events            0.5.0              pyhd8ed1ab_1    conda-forge
jupyter_server            2.0.6              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.3              pyhd8ed1ab_0    conda-forge
jupyterlab                3.5.2              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.17.0             pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.4           py310hbf28c38_1    conda-forge
lcms2                     2.14                 hfd0df8a_1    conda-forge
ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libblas                   3.9.0            16_linux64_mkl    conda-forge
libbrotlicommon           1.0.9                h166bdaf_8    conda-forge
libbrotlidec              1.0.9                h166bdaf_8    conda-forge
libbrotlienc              1.0.9                h166bdaf_8    conda-forge
libcblas                  3.9.0            16_linux64_mkl    conda-forge
libdeflate                1.14                 h166bdaf_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgfortran-ng            12.2.0              h69a702a_19    conda-forge
libgfortran5              12.2.0              h337968e_19    conda-forge
libhwloc                  2.8.0                h32351e8_1    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
liblapack                 3.9.0            16_linux64_mkl    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libtiff                   4.5.0                h82bc61c_0    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.10.3               h7463322_0    conda-forge
libxslt                   1.1.37               h873f0b0_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
llvm-openmp               15.0.6               he0ac6c6_0    conda-forge
lxml                      4.9.2           py310hbdc0903_0    conda-forge
markupsafe                2.1.1           py310h5764c6d_2    conda-forge
matplotlib-base           3.6.2           py310h8d5ebf3_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
matrix_utils              0.2.5              pyhd8ed1ab_0    conda-forge
mistune                   2.0.4              pyhd8ed1ab_0    conda-forge
mkl                       2022.2.1         h84fe81f_16997    conda-forge
mrio_common_metadata      0.2.1              pyhd8ed1ab_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nbclassic                 0.4.8              pyhd8ed1ab_0    conda-forge
nbclient                  0.7.2              pyhd8ed1ab_0    conda-forge
nbconvert                 7.2.7              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.2.7              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.2.7              pyhd8ed1ab_0    conda-forge
nbformat                  5.7.1              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
notebook                  6.5.2              pyha770c72_1    conda-forge
notebook-shim             0.2.2              pyhd8ed1ab_0    conda-forge
numpy                     1.24.1          py310h08bbf29_0    conda-forge
openjpeg                  2.5.0                hfec8fc6_2    conda-forge
openpyxl                  3.0.10          py310h5764c6d_2    conda-forge
openssl                   3.0.7                h0b41bf4_1    conda-forge
packaging                 22.0               pyhd8ed1ab_0    conda-forge
pandas                    1.5.2           py310h769672d_0    conda-forge
pandoc                    2.19.2               h32600fe_1    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
peewee                    3.15.4          py310hba2f8c6_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.2.0           py310h023d228_4    conda-forge
pip                       22.3.1             pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              2.6.2              pyhd8ed1ab_0    conda-forge
prometheus_client         0.15.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.36             pyha770c72_0    conda-forge
psutil                    5.9.4           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
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pypardiso                 0.4.2              pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyprind                   2.11.2          py310hff52083_1004    conda-forge
pyrsistent                0.19.2          py310h5764c6d_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.8          h4a9ceb5_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.16.2             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.4              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytz                      2022.7             pyhd8ed1ab_0    conda-forge
pyxlsb                    1.0.10             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py310h5764c6d_5    conda-forge
pyzmq                     24.0.1          py310h330234f_1    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
requests                  2.28.1             pyhd8ed1ab_1    conda-forge
scipy                     1.9.3           py310hdfbd76f_2    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                65.6.3             pyhd8ed1ab_0    conda-forge
setuptools-scm            7.1.0              pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
stats_arrays              0.6.5              pyhd8ed1ab_0    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
tbb                       2021.7.0             h924138e_1    conda-forge
terminado                 0.17.1             pyh41d4057_0    conda-forge
tinycss2                  1.2.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_1    conda-forge
tqdm                      4.64.1             pyhd8ed1ab_0    conda-forge
traitlets                 5.8.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.4.0                hd8ed1ab_0    conda-forge
typing_extensions         4.4.0              pyha770c72_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
unicodedata2              15.0.0          py310h5764c6d_0    conda-forge
unidecode                 1.3.6              pyhd8ed1ab_0    conda-forge
urllib3                   1.26.13            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.4.2              pyhd8ed1ab_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
whoosh                    2.7.4           py310hff52083_7    conda-forge
wrapt                     1.14.1          py310h5764c6d_1    conda-forge
xlrd                      2.0.1              pyhd8ed1ab_3    conda-forge
xlsxwriter                3.0.5              pyhd8ed1ab_0    conda-forge
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
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.11.0             pyhd8ed1ab_0    conda-forge
zstd                      1.5.2                h6239696_4    conda-forge
cmutel commented 2 months ago

Given only one report, I think this was bad data, not a software problem.