Closed BradyPlanden closed 1 month ago
cc: @kratman who was working on this back in #4383. I don't know why this fails, though, because we test against this behaviour as well...
Yeah I am looking into it
Thanks! I guess we should release 24.9.1 with a fix by today? Also, we install all the optional dependencies when testing the wheels, too, which includes [cite]
, so this shouldn't have happened.
@BradyPlanden There must be a dependency issue, I can reproduce this with
pip install 'pybamm[cite]'
but not with
pip install 'pybamm[all,cite]'
I'm unable to reproduce with pybamm[cite]
This is what I tried:
mamba create -n pybamm-test-env python
mamba activate pybamm-test-env
python -m pip install 'pybamm[cite]'
python -c "import pybamm" # works
Edit: and couldn't reproduce it for a second time
/opt/homebrew/bin/python3.12 -m venv venv
source venv/bin/activate
python -m pip install pybamm"[cite]" # this fails
@kratman and @BradyPlanden, this is coming from an undeclared dependency on setuptools
, we require it on Python 3.12 and later because pybtex
requires it. Virtual environments for Python 3.12 and later don't include seed packages (such as setuptools
and wheel
– mamba envs do, which is why I couldn't reproduce in the earlier example). Installing setuptools
in the venv above fixes the error.
Unfortunately, pybtex
is still unmaintained and they haven't released the fix for this yet (see #3648).
The reason you do not see it with pip install "pybamm[all]"
is because of pip install "pybamm[examples]"
.
It looks like pybtex
has a unreleased fix. It's a bit annoying that this is due to not deploying a release. Here's the relevant issue: https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
Yes, this is why we were installing setuptools
in our nox
sessions
Yeah we just need to swap out pybtex and make citations non-optional. The citations object is global, all the "check if it is installed" stuff is because we are hiding a dependency too
I would be okay with making citations non-optional, too. I think the functionality is nice to have by default, since we encourage researchers to use pybamm.print_citations()
at the end of each script, especially through the example notebooks.
PyBaMM Version
v24.9.0
Python Version
3.12
Describe the bug
Installing with optional
[cite]
dependency results with the below import error.Steps to Reproduce
python -m pip install 'pybamm[cite]'
produces the below error when runningimport pybamm
.Relevant log output
No response