terrapower / armi

An open-source nuclear reactor analysis automation framework that helps design teams increase efficiency and quality
https://terrapower.github.io/armi/
Apache License 2.0
224 stars 87 forks source link

ARMI cannot be installed in editable mode with pip<22.1 #1639

Closed ntouran closed 6 months ago

ntouran commented 8 months ago

Installation instructions for editable install not working: Since it does not have a setup.py nor a setup.cfg, it cannot be installed in editable mode.

Docs say:

https://github.com/terrapower/armi/blob/0668e8ca1f52c67dc7074c25a0723e1073ddce4d/doc/user/user_install.rst?plain=1#L86-L90

But if you do this, you get an error:

(venv) $ pip install -e .[test]
Obtaining file:///home/nick/code/armi
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/nick/code/armi has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.

I am using pip==22.0.2.

ntouran commented 8 months ago

Hmm, according to this, we may need to require setuptools 64

ntouran commented 8 months ago

Upgrading pip to 23.3.2 works!

python -m pip install --upgrade pip

We should reflect this somewhere in the setup docs I guess.

ntouran commented 8 months ago

The other thing we can do is just add a stub setup.py or setup.cfg which will restore the old behavior. I'll make a PR.

ntouran commented 8 months ago

If we really don't want it at all for some reason, then we need to update our documentation and build process to avoid this error for users.

How would you prefer to solve the error shown above?

john-science commented 7 months ago

So, I can't reproduce this bug locally (Python 3.9.7 and pip==22.1):

$ python --version
Python 3.9.7
$ python -m pip --version
pip 22.1 from \\path\to\venv\lib\site-packages\pip (python 3.9)
$
$ pip install -e .[test]
Looking in indexes: https://devwebsvc1.tp.int/pypi
Obtaining file:///C:/Users/jstilley/codes/repos/armi
...
Successfully built armi
Installing collected packages: armi
  Attempting uninstall: armi
    Found existing installation: armi 0.2.8
    Uninstalling armi-0.2.8:
      Successfully uninstalled armi-0.2.8
Successfully installed armi-0.3.0

However, I think we can prove that this works for pip==23.3.1, because we run this tox.ini file on GitHub CI every day:

https://github.com/terrapower/armi/blob/f6e1c78d1ed4b3a061ca8f633d47be8cb11c58ca/tox.ini#L12-L14

in our GitHub "unittest" workflow:

https://github.com/terrapower/armi/blob/f6e1c78d1ed4b3a061ca8f633d47be8cb11c58ca/.github/workflows/unittests.yaml#L31-L32

And that workflow runs on all commits and PRs fine, for all versions of Python, but with a recent version of pip.

So, before I update the docs, I'd like to be able to reproduce your bug so I can add the write info in the docs.

What version of Python were you using when the above failure occurred?

caiodallaqua commented 7 months ago

Hi there! Unable to reproduce this as well.

By the way, I'd like to suggest using quotes in such commands across the documentation, for shell portability.

Square brackets have special meanings in zsh so pip install -e .[test] breaks there. Changing it to pip install -e ".[test]" works for zsh, bash and sh.