janosh / matbench-discovery

An evaluation framework for machine learning models simulating high-throughput materials discovery.
https://matbench-discovery.materialsproject.org
MIT License
111 stars 18 forks source link

MIssing `"direct_url.json"` causes `JSONDecodeError`: Expecting value: line 1 column 1 (char 0) #77

Closed janosh closed 10 months ago

janosh commented 10 months ago

Discussed in https://github.com/janosh/matbench-discovery/discussions/76

Originally posted by **Claudia-Hello** January 28, 2024 I have run this repository, but there was no "direct_url.json" file in the "matbench-discovery" folder. Could you please tell me how to solve this problem? The source coda can be seen as follows. Thank you so much! ```py pkg_name = "matbench-discovery" direct_url = Distribution.from_name(pkg_name).read_text("direct_url.json") or "" pkg_is_editable = json.loads(direct_url).get("dir_info", {}).get("editable", False) ```

Full Stacktrace

---> 17 from matbench_discovery import (
     18     PDF_FIGS,
     19     SCRIPTS,
     20     SITE_FIGS,
     21     Key,
     22     ModelType,
     23     Targets,
     24     Task,
     25 )
     26 from matbench_discovery.data import DATA_FILES, df_wbm
     27 from matbench_discovery.metrics import stable_metrics

File ~/.venv/py311/lib/python3.11/site-packages/matbench_discovery/__init__.py:17
     15 pkg_name = "matbench-discovery"
     16 direct_url = Distribution.from_name(pkg_name).read_text("direct_url.json") or ""
---> 17 pkg_is_editable = json.loads(direct_url).get("dir_info", {}).get("editable", False)
     19 PKG_DIR = os.path.dirname(__file__)
     20 # repo root directory if editable install, else the pkg directory

File /opt/homebrew/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
...
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)