You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently started to learn Brightway following the Brightway version 2 Cheatsheet for Beginners and this github.
I managed to follow the tutorials, but I am having some troubles to calculate the LCIA results for 1 activity and 1 method, as you may see in the code bellow:
import brightway2 as bw
import os
bw.projects.set_current("test_bw")
ei = bw.Database('ecoinvent-3.9-cutoff')
activity = ei.random()
ipcc_method = [m for m in bw.methods if 'IPCC 2021' in str(m) and 'GWP100' in str(m) and 'LT' not in str(m)]
ipcc = ipcc_method[1]
lca = bw.LCA({activity: 1}, ipcc)
lca.lci()
Basically, I am getting the following error when I try to run the last line of code lca.lci() and I don’t really know what I am doing wrong. I already read the docstrings of each function and I looks okey, so I don’t know.
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[49], line 1
----> 1 lca.lci()
File [~\anaconda3\envs\bw\Lib\site-packages\bw2calc\lca.py:342](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/bw2calc/lca.py#line=341), in LCA.lci(self, factorize, builder)
340 if factorize:
341 self.decompose_technosphere()
--> 342 self.lci_calculation()
File [~\anaconda3\envs\bw\Lib\site-packages\bw2calc\lca.py:350](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/bw2calc/lca.py#line=349), in LCA.lci_calculation(self)
344 def lci_calculation(self):
345 """The actual LCI calculation.
346
347 Separated from ``lci`` to be reusable in cases where the matrices are already built, e.g. ``redo_lci`` and Monte Carlo classes.
348
349 """
--> 350 self.supply_array = self.solve_linear_system()
351 # Turn 1-d array into diagonal matrix
352 count = len(self.activity_dict)
File [~\anaconda3\envs\bw\Lib\site-packages\bw2calc\lca.py:316](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/bw2calc/lca.py#line=315), in LCA.solve_linear_system(self)
314 return self.solver(self.demand_array)
315 else:
--> 316 return spsolve(
317 self.technosphere_matrix,
318 self.demand_array)
File [~\anaconda3\envs\bw\Lib\site-packages\pypardiso\scipy_aliases.py:48](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/pypardiso/scipy_aliases.py#line=47), in spsolve(A, b, factorize, squeeze, solver, *args, **kwargs)
45 if factorize and not solver._is_already_factorized(A):
46 solver.factorize(A)
---> 48 x = solver.solve(A, b)
50 if squeeze:
51 return x.squeeze() # scipy spsolve always returns vectors with shape (n,) indstead of (n,1)
File [~\anaconda3\envs\bw\Lib\site-packages\pypardiso\pardiso_wrapper.py:188](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/pypardiso/pardiso_wrapper.py#line=187), in PyPardisoSolver.solve(self, A, b)
185 else:
186 self.set_phase(13)
--> 188 x = self._call_pardiso(A, b)
190 # it is possible to call the solver with empty columns, but computationally expensive to check this
191 # beforehand, therefore only the result is checked for infinite elements.
192 # if not np.isfinite(x).all():
193 # warnings.warn('The result contains infinite elements. Make sure that matrix A contains no empty columns.',
194 # PyPardisoWarning)
195 # --> this check doesn't work consistently, maybe add an advanced input check method for A
197 return x
File [~\anaconda3\envs\bw\Lib\site-packages\pypardiso\pardiso_wrapper.py:277](http://localhost:8888/lab/tree/notebooks/~/anaconda3/envs/bw/Lib/site-packages/pypardiso/pardiso_wrapper.py#line=276), in PyPardisoSolver._call_pardiso(self, A, b)
274 ia = A.indptr + 1
275 ja = A.indices + 1
--> 277 self._mkl_pardiso(self.pt.ctypes.data_as(ctypes.POINTER(self._pt_type[0])), # pt
278 ctypes.byref(ctypes.c_int32(1)), # maxfct
279 ctypes.byref(ctypes.c_int32(1)), # mnum
280 ctypes.byref(ctypes.c_int32(self.mtype)), # mtype -> 11 for real-nonsymetric
281 ctypes.byref(ctypes.c_int32(self.phase)), # phase -> 13
282 ctypes.byref(ctypes.c_int32(A.shape[0])), # N -> number of equations/size of matrix
283 A.data.ctypes.data_as(c_float64_p), # A -> non-zero entries in matrix
284 ia.ctypes.data_as(c_int32_p), # ia -> csr-indptr
285 ja.ctypes.data_as(c_int32_p), # ja -> csr-indices
286 self.perm.ctypes.data_as(c_int32_p), # perm -> empty
287 ctypes.byref(ctypes.c_int32(1 if b.ndim == 1 else b.shape[1])), # nrhs
288 self.iparm.ctypes.data_as(c_int32_p), # iparm-array
289 ctypes.byref(ctypes.c_int32(self.msglvl)), # msg-level -> 1: statistical info is printed
290 b.ctypes.data_as(c_float64_p), # b -> right-hand side vector/matrix
291 x.ctypes.data_as(c_float64_p), # x -> output
292 ctypes.byref(pardiso_error)) # pardiso error
294 if pardiso_error.value != 0:
295 raise PyPardisoError(pardiso_error.value)
OSError: exception: access violation writing 0x0000000000000004
Thank you in advance for any help!
The text was updated successfully, but these errors were encountered:
hi @carlosjariash95
this error is intriguing indeed.
could you help us providing the exact characteristics of your install ?
OS version
anaconda version
installed packages
This could help us track down the actual issue, because in general, pypardiso works well.
Also, the best place for this issue would be in the bw2calc repository. I'll see if I can move it there. Because thi sis related to the LCA calculation, not to any input/output operations (if the real error is in the calculation, of course)
Hello there,
I recently started to learn Brightway following the Brightway version 2 Cheatsheet for Beginners and this github.
I managed to follow the tutorials, but I am having some troubles to calculate the LCIA results for 1 activity and 1 method, as you may see in the code bellow:
Basically, I am getting the following error when I try to run the last line of code lca.lci() and I don’t really know what I am doing wrong. I already read the docstrings of each function and I looks okey, so I don’t know.
Thank you in advance for any help!
The text was updated successfully, but these errors were encountered: