twosixlabs / armory

ARMORY Adversarial Robustness Evaluation Test Bed
MIT License
174 stars 67 forks source link

[BUG]: Configuration error if using editable mode when pip installing from source #1899

Closed jprokos26 closed 1 year ago

jprokos26 commented 1 year ago

UPDATE

Issue resolved https://github.com/twosixlabs/armory/issues/1899#issuecomment-1462473947

Description of the bug

When installing armory using python3 -m pip install -e . from within the armory directory I am greeted with a configuration error. It installs correctly without the -e flag.

Looking at pyproject.toml the license seems to be appropriately set so I am not entirely sure what is going on here.

Steps To Reproduce

  1. On noether create new virtual environment and activate it
  2. Run python3 -m pip install -e . from within the armory directory

Additional Information

jonathan.prokos@noether:~/git/twosixlabs/armory$ python3 -m venv ~/.venv/new_dockerless
jonathan.prokos@noether:~/git/twosixlabs/armory$ source ~/.venv/new_dockerless/bin/activate
(new_dockerless) jonathan.prokos@noether:~/git/twosixlabs/armory$ python3 --version
Python 3.8.10
(new_dockerless) jonathan.prokos@noether:~/git/twosixlabs/armory$ python3 -m pip list
Package       Version
------------- -------
pip           20.0.2
pkg-resources 0.0.0
setuptools    44.0.0
(new_dockerless) jonathan.prokos@noether:~/git/twosixlabs/armory$ git rev-parse HEAD
c21ff44d9d2aa0072e89e0c7bde70793c6551885
(new_dockerless) jonathan.prokos@noether:~/git/twosixlabs/armory$ python3 -m pip install -e .
Obtaining file:///home/jonathan.prokos/git/twosixlabs/armory
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting pyyaml
  Using cached PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (701 kB)
Collecting requests
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting setuptools-scm
  Using cached setuptools_scm-7.1.0-py3-none-any.whl (43 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting jsonschema
  Using cached jsonschema-4.17.3-py3-none-any.whl (90 kB)
Collecting loguru
  Using cached loguru-0.6.0-py3-none-any.whl (58 kB)
Collecting docker
  Using cached docker-6.0.1-py3-none-any.whl (147 kB)
Collecting pytest
  Using cached pytest-7.2.2-py3-none-any.whl (317 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (195 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Requirement already satisfied: setuptools in /home/jonathan.prokos/.venv/new_dockerless/lib/python3.8/site-packages (from setuptools-scm->armory-testbed==0.16.6) (44.0.0)
Collecting tomli>=1.0.0; python_version < "3.11"
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting packaging>=20.0
  Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting typing-extensions
  Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting importlib-resources>=1.4.0; python_version < "3.9"
  Using cached importlib_resources-5.12.0-py3-none-any.whl (36 kB)
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Using cached pyrsistent-0.19.3-py3-none-any.whl (57 kB)
Collecting pkgutil-resolve-name>=1.3.10; python_version < "3.9"
  Using cached pkgutil_resolve_name-1.3.10-py3-none-any.whl (4.7 kB)
Collecting attrs>=17.4.0
  Using cached attrs-22.2.0-py3-none-any.whl (60 kB)
Collecting websocket-client>=0.32.0
  Using cached websocket_client-1.5.1-py3-none-any.whl (55 kB)
Collecting iniconfig
  Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting exceptiongroup>=1.0.0rc8; python_version < "3.11"
  Using cached exceptiongroup-1.1.0-py3-none-any.whl (14 kB)
Collecting pluggy<2.0,>=0.12
  Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting zipp>=3.1.0; python_version < "3.10"
  Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB)
Installing collected packages: pyyaml, charset-normalizer, urllib3, certifi, idna, requests, tomli, packaging, typing-extensions, setuptools-scm, toml, zipp, importlib-resources, pyrsistent, pkgutil-resolve-name, attrs, jsonschema, loguru, websocket-client, docker, iniconfig, exceptiongroup, pluggy, pytest, armory-testbed
  Running setup.py develop for armory-testbed
    ERROR: Command errored out with exit status 1:
     command: /home/jonathan.prokos/.venv/new_dockerless/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jonathan.prokos/git/twosixlabs/armory/setup.py'"'"'; __file__='"'"'/home/jonathan.prokos/git/twosixlabs/armory/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /home/jonathan.prokos/git/twosixlabs/armory/
    Complete output (77 lines):
    configuration error: `project.license` must be valid exactly by one definition (2 matches found):

        - keys:
            'file': {type: string}
          required: ['file']
        - keys:
            'text': {type: string}
          required: ['text']

    DESCRIPTION:
        `Project license <https://peps.python.org/pep-0621/#license>`_.

    GIVEN VALUE:
        "MIT"

    OFFENDING RULE: 'oneOf'

    DEFINITION:
        {
            "oneOf": [
                {
                    "properties": {
                        "file": {
                            "type": "string",
                            "$$description": [
                                "Relative path to the file (UTF-8) which contains the license for the",
                                "project."
                            ]
                        }
                    },
                    "required": [
                        "file"
                    ]
                },
                {
                    "properties": {
                        "text": {
                            "type": "string",
                            "$$description": [
                                "The license of the project whose meaning is that of the",
                                "`License field from the core metadata",
                                "<https://packaging.python.org/specifications/core-metadata/#license>`_."
                            ]
                        }
                    },
                    "required": [
                        "text"
                    ]
                }
            ]
        }
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/jonathan.prokos/git/twosixlabs/armory/setup.py", line 6, in <module>
        setuptools.setup()
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
        return distutils.core.setup(**attrs)
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 159, in setup
        dist.parse_config_files()
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 885, in parse_config_files
        pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 62, in apply_configuration
        config = read_configuration(filepath, True, ignore_option_errors, dist)
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 126, in read_configuration
        validate(subset, filepath)
      File "/tmp/pip-build-env-5l_lcu06/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py", line 51, in validate
        raise ValueError(f"{error}\n{summary}") from None
    ValueError: invalid pyproject.toml config: `project.license`.
    configuration error: `project.license` must be valid exactly by one definition (2 matches found):

        - keys:
            'file': {type: string}
          required: ['file']
        - keys:
            'text': {type: string}
          required: ['text']

    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/jonathan.prokos/.venv/new_dockerless/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jonathan.prokos/git/twosixlabs/armory/setup.py'"'"'; __file__='"'"'/home/jonathan.prokos/git/twosixlabs/armory/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
jprokos26 commented 1 year ago

Issue cause by pip==20.0.2, behaving as expected when upgrading to pip==23.0.1.