jedie / inverter-connect

Get information from Deye Microinverter
https://pypi.org/project/inverter-connect/
GNU General Public License v3.0
27 stars 9 forks source link

ERROR: Can not execute `setup.py` since setuptools is not available in the build environment. #69

Open Aufschlauer opened 1 year ago

Aufschlauer commented 1 year ago

When I try to run cli.py I get the error

  Using cached MarkupSafe-2.1.3.tar.gz (19 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

The hint that the setup tools are missing seems to be misleading. According to the complete output

Requirement already satisfied: setuptools in ./.venv-app/lib/python3.9/site-packages (from pip-tools) (58.1.0)

setuptools are installed.

Here is the complete output:

# ./cli.py --help 
Create virtual env here: /tmp/inverter-connect/.venv-app

+ /tmp/inverter-connect/.venv-app/bin/python -m pip install -U pip

Requirement already satisfied: pip in ./.venv-app/lib/python3.9/site-packages (23.0.1)
Collecting pip
  Using cached pip-23.1.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-23.1.2

+ /tmp/inverter-connect/.venv-app/bin/python -m pip install -U pip-tools

Collecting pip-tools
  Downloading pip_tools-6.14.0-py3-none-any.whl (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.9/55.9 kB 620.0 kB/s eta 0:00:00
Collecting build (from pip-tools)
  Using cached build-0.10.0-py3-none-any.whl (17 kB)
Collecting click>=8 (from pip-tools)
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Requirement already satisfied: pip>=22.2 in ./.venv-app/lib/python3.9/site-packages (from pip-tools) (23.1.2)
Requirement already satisfied: setuptools in ./.venv-app/lib/python3.9/site-packages (from pip-tools) (58.1.0)
Collecting wheel (from pip-tools)
  Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
Collecting tomli (from pip-tools)
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting packaging>=19.0 (from build->pip-tools)
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting pyproject_hooks (from build->pip-tools)
  Using cached pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB)
Installing collected packages: wheel, tomli, packaging, click, pyproject_hooks, build, pip-tools
Successfully installed build-0.10.0 click-8.1.3 packaging-23.1 pip-tools-6.14.0 pyproject_hooks-1.0.0 tomli-2.0.1 wheel-0.40.0

+ /tmp/inverter-connect/.venv-app/bin/pip-sync /tmp/inverter-connect/requirements.txt

Ignoring error when setting locale: unsupported locale setting
Collecting arrow==1.2.3 (from -r /tmp/tmpu2cisu1b (line 1))
  Using cached arrow-1.2.3-py3-none-any.whl (66 kB)
Collecting backoff==2.2.1 (from -r /tmp/tmpu2cisu1b (line 4))
  Using cached backoff-2.2.1-py3-none-any.whl (15 kB)
Collecting binaryornot==0.4.4 (from -r /tmp/tmpu2cisu1b (line 7))
  Using cached binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
Collecting bx-py-utils==83 (from -r /tmp/tmpu2cisu1b (line 10))
  Using cached bx_py_utils-83-py3-none-any.whl (46 kB)
Collecting certifi==2023.5.7 (from -r /tmp/tmpu2cisu1b (line 13))
  Using cached certifi-2023.5.7-py3-none-any.whl (156 kB)
Collecting chardet==5.1.0 (from -r /tmp/tmpu2cisu1b (line 16))
  Using cached chardet-5.1.0-py3-none-any.whl (199 kB)
Collecting charset-normalizer==3.1.0 (from -r /tmp/tmpu2cisu1b (line 19))
  Using cached charset_normalizer-3.1.0-py3-none-any.whl (46 kB)
Collecting cookiecutter==2.1.1 (from -r /tmp/tmpu2cisu1b (line 95))
  Using cached cookiecutter-2.1.1-py2.py3-none-any.whl (36 kB)
Collecting ha-services==0.3.2 (from -r /tmp/tmpu2cisu1b (line 98))
  Using cached ha_services-0.3.2-py3-none-any.whl (53 kB)
Collecting idna==3.4 (from -r /tmp/tmpu2cisu1b (line 101))
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting jinja2==3.1.2 (from -r /tmp/tmpu2cisu1b (line 104))
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting jinja2-time==0.2.0 (from -r /tmp/tmpu2cisu1b (line 107))
  Using cached jinja2_time-0.2.0-py2.py3-none-any.whl (6.4 kB)
Collecting manageprojects==0.12.1 (from -r /tmp/tmpu2cisu1b (line 110))
  Using cached manageprojects-0.12.1-py3-none-any.whl (80 kB)
Collecting markdown-it-py==2.2.0 (from -r /tmp/tmpu2cisu1b (line 113))
  Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB)
Collecting markupsafe==2.1.3 (from -r /tmp/tmpu2cisu1b (line 116))
  Using cached MarkupSafe-2.1.3.tar.gz (19 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Traceback (most recent call last):
  File "/tmp/inverter-connect/.venv-app/bin/pip-sync", line 8, in <module>
    sys.exit(cli())
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/piptools/scripts/sync.py", line 196, in cli
    sync.sync(
  File "/tmp/inverter-connect/.venv-app/lib/python3.9/site-packages/piptools/sync.py", line 244, in sync
    run(  # nosec
  File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/inverter-connect/.venv-app/bin/python', '-m', 'pip', 'install', '-r', '/tmp/tmpu2cisu1b']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/tmp/inverter-connect/./cli.py", line 115, in <module>
    main(sys.argv)
  File "/tmp/inverter-connect/./cli.py", line 101, in main
    verbose_check_call(PIP_SYNC_PATH, str(DEP_LOCK_PATH))
  File "/tmp/inverter-connect/./cli.py", line 81, in verbose_check_call
    return subprocess.check_call(popen_args)
  File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '(PosixPath('/tmp/inverter-connect/.venv-app/bin/pip-sync'), '/tmp/inverter-connect/requirements.txt')' returned non-zero exit status 1.

Anyone here with the similar experience?

jedie commented 1 year ago

I found https://github.com/pypa/packaging-problems/issues/573 and maybe this is the solution: https://github.com/pypa/packaging-problems/issues/573#issuecomment-1418258985

pip install --upgrade setuptools

Run this first and then the cli.py... But maybe we can add this fix in the bootstrap script...