I got the following error upon loading premise (from premise import *)
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/collections/init.py) in python 3.11
A quick investigation pointed me to the following warning in python 3.9: "DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working"
The culprit seems to be in the 'sparse' module, which gets installed through the premise dependencies. Full error message below:
ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from premise import *
I got the following error upon loading premise (from premise import *) ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/collections/init.py) in python 3.11
A quick investigation pointed me to the following warning in python 3.9: "DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working"
The culprit seems to be in the 'sparse' module, which gets installed through the premise dependencies. Full error message below:
ImportError Traceback (most recent call last) Cell In[4], line 1 ----> 1 from premise import *
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/premise/init.py:10 7 INVENTORY_DIR = Path(file).resolve().parent / "data" / "additional_inventories" 8 VARIABLES_DIR = Path(file).resolve().parent / "iam_variables_mapping" ---> 10 from .ecoinvent_modification import NewDatabase 11 from .utils import clear_cache, get_regions_definition
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/premise/ecoinvent_modification.py:26 24 from .data_collection import IAMDataCollection 25 from .direct_air_capture import _update_dac ---> 26 from .electricity import _update_electricity 27 from .emissions import _update_emissions 28 from .export import ( 29 Export, 30 _prepare_database, (...) 33 generate_superstructure_db, 34 )
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/premise/electricity.py:23 21 from . import VARIABLES_DIR 22 from .data_collection import get_delimiter ---> 23 from .export import biosphere_flows_dictionary 24 from .logger import create_logger 25 from .transformation import ( 26 BaseTransformation, 27 Dict, (...) 36 ws, 37 )
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/premise/export.py:21 19 import numpy as np 20 import pandas as pd ---> 21 import sparse 22 import yaml 23 from datapackage import Package
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/sparse/init.py:1 ----> 1 from .coo import COO, elemwise, tensordot, concatenate, stack, dot, triu, tril, where, \ 2 nansum, nanprod, nanmin, nanmax 3 from .dok import DOK 4 from .sparse_array import SparseArray
File /usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/site-packages/sparse/coo.py:4 1 from future import absolute_import, division, print_function 3 import warnings ----> 4 from collections import Iterable, defaultdict, deque 5 from functools import reduce 6 from itertools import product
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/anaconda3/envs/premise_bw2_ei39/lib/python3.11/collections/init.py)