Open michaelweinold opened 2 months ago
And @martinRenou, I guess you have some bots to block (see above) 🙈
Since the main error seems to originate with this line:
conda_meta_filename = f"{filename_base_from_meta(pkg_meta)}.json"
with open(filtered_prefix / "conda-meta" / conda_meta_filename, "w") as f:
json.dump(pkg_meta, f)
Did we (in our Brightway packages) use some non-standard package name?
I am a bit surprised by this error. It seems like a missing str(thePath)
somewhere. But I would not expect this to happen for certain packages only.
from empack import filter_env
path_env = "/opt/homebrew/Caskroom/miniconda/base/envs/xeus-python-kernel-test"
list_pkg_meta = [pkg_meta for pkg_meta in filter_env.iterate_env_pkg_meta(path_env)]
for pkg_meta in list_pkg_meta:
tempfile = "/tmp/tmp.json"
with open(tempfile, 'w') as file:
json.dump(pkg_meta, file)
works fine on my local machine. Weird 🙈
I found the bug - the issue originates from the iterate_pip_pkg_record()
function in combination with the better_exceptions_fork
package.
Running iterate_pip_pkg_record()
while passing it the path to the temporary directory which is generated by the jupyter lite build
command:
from empack import filter_env
[pip_pkg for pip_pkg in filter_env.iterate_pip_pkg_record("(...)/tmpfwwgtj1q/env/envs/xeus-python-kernel")]
returns this dictionary:
{'name': 'better_exceptions_fork',
'version': '0.2.1.post6',
'files': [PosixPath('lib/python3.11/site-packages/better_exceptions/__init__.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/__init__.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/__main__.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/__main__.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/color.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/color.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/formatter.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/formatter.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/highlighter.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/highlighter.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/log.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/log.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions/repl.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions/repl.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/__init__.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/__init__.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/__main__.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/__main__.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/color.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/color.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/formatter.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/formatter.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/highlighter.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/highlighter.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/log.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/log.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/repl.py'),
PosixPath('lib/python3.11/site-packages/better_exceptions_fork/repl.pyc'),
PosixPath('lib/python3.11/site-packages/better_exceptions_hook.pth')],
'fn': 'better_exceptions_fork-0.2.1.post6',
'build': 'pip',
'build_number': 0,
'depends': []}
...and that cannot be serialized to JSON.
I'll see if I can figure out how to mitigate this.
Why is better_exceptions_fork
even installed into the environment? It is not a dependency of bw2io
or xeus-python
- and apparently also not of any of the packages in build-environment.yml
. Odd that it would not be there if I just use the standard recipe of the template:
name: xeus-python-kernel
channels:
- https://repo.mamba.pm/emscripten-forge
- conda-forge
dependencies:
- xeus-python
- numpy
- matplotlib
...but only appears if I add bw2io
.
Description
When adding our
bw2io
package to theenvironment.yaml
as a dependency, I get an error of this kind:Interestingly, the error does not reference the package, nor any of its dependencies. The error trace goes from the micromamba build library to
jupyterlite_core/manager
>jupyterlite_xeus/add_on
>empack/pack
and then to the Pyhon JSON decoder.Any idea what the cause might be?
Reproduce
Expected behavior
No error 😇
Context
jupyterlite-core=0.3.0, jupyterlite-xeus=0.1.9
Build Log