armi icon indicating copy to clipboard operation
armi copied to clipboard

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.

Open ntouran opened this issue 1 year ago • 6 comments

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 avatar Jan 30 '24 00:01 ntouran

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

ntouran avatar Jan 30 '24 00:01 ntouran

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 avatar Jan 30 '24 00:01 ntouran

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 avatar Jan 30 '24 15:01 ntouran

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?

ntouran avatar Jan 30 '24 20:01 ntouran

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?

john-science avatar Feb 06 '24 18:02 john-science

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.

caiodallaqua avatar Feb 14 '24 15:02 caiodallaqua