brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
11 stars 24 forks source link

fs.zipfs not found in python 3.9 #183

Closed HaSchneider closed 2 months ago

HaSchneider commented 2 months ago

I get this error message when I try to import bw2data in a fresh conda environment with python 3.9 The environment was created by: conda create -n my_new_bw_env -c conda-forge -c cmutel brightway25 python=3.9

The documentation says, python 3.9 is supported.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[9], [line 1](vscode-notebook-cell:?execution_count=9&line=1)
----> [1](vscode-notebook-cell:?execution_count=9&line=1) import bw2analyzer as ba
      [2](vscode-notebook-cell:?execution_count=9&line=2) import bw2calc as bc
      [3](vscode-notebook-cell:?execution_count=9&line=3) import bw2data as bd

File c:\Apps\anaconda3\envs\my_new_bw_env\lib\site-packages\bw2analyzer\__init__.py:[1](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:1)5
      1 __all__ = [
      [2](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:2)     "compare_activities_by_grouped_leaves",
      [3](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:3)     "compare_activities_by_lcia_score",
   (...)
     [12](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:12)     "traverse_tagged_databases",
     [13](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:13) ]
---> [15](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:15) from .comparisons import (
     [16](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:16)     compare_activities_by_grouped_leaves,
     [17](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:17)     compare_activities_by_lcia_score,
     [18](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:18)     find_differences_in_inputs,
     [19](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:19) )
     [20](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:20) from .contribution import ContributionAnalysis
     [21](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/__init__.py:21) from .health_check import DatabaseHealthCheck

File c:\Apps\anaconda3\envs\my_new_bw_env\lib\site-packages\bw2analyzer\comparisons.py:6
      [3](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/comparisons.py:3) from os.path import commonprefix
      [5](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/comparisons.py:5) import bw2calc as bc
----> [6](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/comparisons.py:6) import bw2data as bd
      [7](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/comparisons.py:7) import numpy as np
      [8](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2analyzer/comparisons.py:8) import pandas as pd

File c:\Apps\anaconda3\envs\my_new_bw_env\lib\site-packages\bw2data\__init__.py:68
     [65](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/__init__.py:65) config.p = preferences
     [67](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/__init__.py:67) from .serialization import JsonWrapper
---> [68](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/__init__.py:68) from .database import DatabaseChooser as Database
     [69](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/__init__.py:69) from .utils import get_activity, get_node
     [70](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/__init__.py:70) from .data_store import DataStore, ProcessedDataStore

File c:\Apps\anaconda3\envs\my_new_bw_env\lib\site-packages\bw2data\database.py:2
      [1](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:1) from . import databases
----> [2](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:2) from .data_store import ProcessedDataStore
      [5](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:5) def DatabaseChooser(name: str, backend: str = "sqlite") -> ProcessedDataStore:
      [6](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:6)     """A method that returns a database class instance.
      [7](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:7) 
      [8](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:8)     Database types are specified in `databases[database_name]['backend']`.
      [9](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:9) 
     [10](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/database.py:10)     """

File c:\Apps\anaconda3\envs\my_new_bw_env\lib\site-packages\bw2data\data_store.py:4
      [1](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/data_store.py:1) import pickle
      [3](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/data_store.py:3) from bw_processing import clean_datapackage_name, create_datapackage, safe_filename, load_datapackage
----> [4](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/data_store.py:4) from fs.zipfs import ZipFS
      [6](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/data_store.py:6) from . import projects
      [7](file:///C:/Apps/anaconda3/envs/my_new_bw_env/lib/site-packages/bw2data/data_store.py:7) from .errors import MissingIntermediateData, UnknownObject

ModuleNotFoundError: No module named 'fs'

My brightway2 versions are:

bw2analyzer               0.11.7             pyhd8ed1ab_0    conda-forge
bw2calc                   2.0.dev18                  py_0    cmutel
bw2data                   4.0.dev38                  py_1    cmutel
bw2io                     0.9.dev23                  py_0    cmutel
bw2parameters             1.1.0              pyhd8ed1ab_0    conda-forge
bw_migrations             0.2                pyhd8ed1ab_0    conda-forge
bw_processing             1.0                pyhd8ed1ab_0    conda-forge
tngTUDOR commented 2 months ago

Hi @HaSchneider . This happens with the current version published on conda channels (cmutel) . The latest bw2data packages are not uploaded. The simple solution is to conda install fs

An alternative would be to install using pypi (because teh packages on pypi.org are more up to date), but I suggest to stick to one or the other, and not mix them [although recently this is not so much of a problem]

cmutel commented 2 months ago

We shifted from pyfilesystem2 which is effectively abandonware to fsspec which has an active development community in June. Sorry if the dependencies weren't pushed to the conda recipes correctly, this should be fixed now.