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 tried to use the base_setpu_with_ecoinvent function, but there is an error of Invalid Exchanges and shows 1770 unlinked exchanges. The error and versions are posted below. Does anyone know why is it happening and how to solve this problem? Thanks.
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\project.py:358, in writable_project(wrapped, instance, args, kwargs)
356 if projects.read_only:
357 raise ReadOnlyProject(READ_ONLY_PROJECT)
--> 358 return wrapped(*args, **kwargs)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:260, in SQLiteBackend.write(self, data, process)
258 if data:
259 try:
--> 260 self._efficient_write_many_data(data)
261 except:
262 # Purge all data from database, then reraise
263 self.delete(warn=False)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:204, in SQLiteBackend._efficient_write_many_data(self, data, indices)
197 self.pbar = pyprind.ProgBar(
198 len(data),
199 title="Writing activities to SQLite3 database:",
200 monitor=True
201 )
203 for index, (key, ds) in enumerate(data.items()):
--> 204 exchanges, activities = self._efficient_write_dataset(
205 index, key, ds, exchanges, activities
206 )
208 if not getattr(config, "is_test", None):
209 print(self.pbar)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:156, in SQLiteBackend._efficient_write_dataset(self, index, key, ds, exchanges, activities)
154 for exchange in ds.get('exchanges', []):
155 if 'input' not in exchange or 'amount' not in exchange:
--> 156 raise InvalidExchange
157 if 'type' not in exchange:
158 raise UntypedExchange
InvalidExchange:
The text was updated successfully, but these errors were encountered:
OliverLyon
changed the title
Ecoinvent 3.7.1 unlinked changes
Ecoinvent 3.7.1 unlinked exchanges
Oct 28, 2024
I tried to use the base_setpu_with_ecoinvent function, but there is an error of Invalid Exchanges and shows 1770 unlinked exchanges. The error and versions are posted below. Does anyone know why is it happening and how to solve this problem? Thanks.
Brightway25 1.0.6
Database: Ecoinvent 3.7.1 cutoff.
bw2io: 0.9.dev41
bw2calc: 2.0.dev23
bw2data:4.0.dev59
InvalidExchange Traceback (most recent call last)
Cell In[4], line 42
39 db.write_database()
40 print("Database has been imported")
---> 42 base_setup_with_ecoinvent(
43 "bw25_import_371",
44 "ecoinvent_3.7.1_cutoff",
45 r"C:\Users\Desktop\EcoInvent\ecoinvent 3.7.1_cutoff_ecoSpold02\datasets",
46 reparametrize_lognormals=True,
47 )
Cell In[4], line 39, in base_setup_with_ecoinvent(project_name, db_name, db_loc, reparametrize_lognormals)
35 db.statistics()
37 #db.drop_unlinked(True)
38 # writes database into sql
---> 39 db.write_database()
40 print("Database has been imported")
File ~.conda\envs\brightway25\Lib\site-packages\bw2io\importers\base_lci.py:273, in LCIImporter.write_database(self, data, delete_existing, backend, activate_parameters, **kwargs)
270 self.write_database_parameters(activate_parameters, delete_existing)
272 existing.update(data)
--> 273 db.write(existing)
275 if activate_parameters:
276 self._write_activity_parameters(activity_parameters)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\project.py:358, in writable_project(wrapped, instance, args, kwargs)
356 if projects.read_only:
357 raise ReadOnlyProject(READ_ONLY_PROJECT)
--> 358 return wrapped(*args, **kwargs)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:260, in SQLiteBackend.write(self, data, process)
258 if data:
259 try:
--> 260 self._efficient_write_many_data(data)
261 except:
262 # Purge all data from database, then reraise
263 self.delete(warn=False)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:204, in SQLiteBackend._efficient_write_many_data(self, data, indices)
197 self.pbar = pyprind.ProgBar(
198 len(data),
199 title="Writing activities to SQLite3 database:",
200 monitor=True
201 )
203 for index, (key, ds) in enumerate(data.items()):
--> 204 exchanges, activities = self._efficient_write_dataset(
205 index, key, ds, exchanges, activities
206 )
208 if not getattr(config, "is_test", None):
209 print(self.pbar)
File ~.conda\envs\brightway25\Lib\site-packages\bw2data\backends\peewee\database.py:156, in SQLiteBackend._efficient_write_dataset(self, index, key, ds, exchanges, activities)
154 for exchange in ds.get('exchanges', []):
155 if 'input' not in exchange or 'amount' not in exchange:
--> 156 raise InvalidExchange
157 if 'type' not in exchange:
158 raise UntypedExchange
InvalidExchange:
The text was updated successfully, but these errors were encountered: