grimen / python-config2

Python environment configuration simplified - highly inspired by `node-config`.
https://pypi.org/project/config2
MIT License
20 stars 9 forks source link

Broken module requirements (mybad) #15

Open jblereste opened 5 years ago

jblereste commented 5 years ago

Hi Jonas,

I have an issue during the install of the new version of config2 (0.3.2).

It seems that there is an issue with the requirements of the mybad module. Please find attached the log file (clean install from a docker image).

$ pip install config2
[...]
Collecting mybad>=0.1.4 (from config2)
  Downloading https://files.pythonhosted.org/packages/fb/62/5366bda200b009452f4446ade7758f0a18be21a3131ca5e541d4b07e6d4e/mybad-0.2.0.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-s_jj15d_/mybad/setup.py", line 8, in <module>
        import setupextras
    ModuleNotFoundError: No module named 'setupextras'

Thank you for your help (and for the package ;))!

Jean-Baptiste

error-config2.log

grimen commented 5 years ago

I haven't been able to reproduce this.

(test-3) ➜  ~ pip install config2
Collecting config2
  Downloading https://files.pythonhosted.org/packages/f4/a3/92a2693d7def37f0785b91fa8a5fa80023419c23e927db80e1f36d82d439/config2-0.3.2-py3-none-any.whl
Collecting pyyaml>=5.1 (from config2)
  Downloading https://files.pythonhosted.org/packages/a3/65/837fefac7475963d1eccf4aa684c23b95aa6c1d033a2c5965ccb11e22623/PyYAML-5.1.1.tar.gz (274kB)
     |████████████████████████████████| 276kB 1.7MB/s 
Collecting mybad>=0.1.4 (from config2)
Collecting deepdiff>=3.3.0 (from config2)
  Using cached https://files.pythonhosted.org/packages/f8/5c/a577c0279c36694c218988ff2e85c63b3d3b3b002034cd7f9dd361688570/deepdiff-4.0.6-py3-none-any.whl
Collecting setupextras>=0.1.5 (from config2)
  Using cached https://files.pythonhosted.org/packages/18/2c/8ffaab19cde5c47a04554d675c0de31ad9ae8da6261dac8808e2a178f50d/setupextras-0.1.5-py3-none-any.whl
Collecting six>=1.12.0 (from config2)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting attributedict>=0.3.0 (from config2)
  Using cached https://files.pythonhosted.org/packages/de/db/337b36e8d85a07293f5a792644fa972b53a52b13587f484c627009206697/attributedict-0.3.0-py3-none-any.whl
Collecting inspecta>=0.1.3 (from config2)
  Using cached https://files.pythonhosted.org/packages/03/aa/5ad8e223fa564d474b465771710b8b7b23896b59651cf115f510bcfda3ee/inspecta-0.1.3-py3-none-any.whl
Collecting codecov>=2.0.15 (from config2)
  Using cached https://files.pythonhosted.org/packages/8b/28/4c1950a61c3c5786f0f34d643d0d28ec832433c9a7c0bd157690d4eb1d5f/codecov-2.0.15-py2.py3-none-any.whl
Collecting deepmerge>=0.0.5 (from config2)
  Using cached https://files.pythonhosted.org/packages/ec/0a/7e82f75ac34767eba48be998a6db5d2b0ed1fae7a8079175e8158312ad72/deepmerge-0.0.5-py2.py3-none-any.whl
Collecting colour-runner>=0.0.5 (from config2)
  Using cached https://files.pythonhosted.org/packages/d4/82/ce3250026add1910739dcabc796571ad1d182cb47332716c8bb96ee5d624/colour_runner-0.1.1-py2.py3-none-any.whl
Collecting tox>=3.0.0 (from config2)
  Using cached https://files.pythonhosted.org/packages/d0/50/3daff59797eefc7c2574fbf58c7b82c599c0495e0639f656ba5f1f58cfa2/tox-3.12.1-py2.py3-none-any.whl
Collecting rootpath>=0.1.1 (from config2)
  Using cached https://files.pythonhosted.org/packages/4f/f9/959835686c78b7a95d8d806a97fa0be020c2deccb96de2b60659744319b9/rootpath-0.1.1-py3-none-any.whl
Collecting coverage>=4.5.2 (from config2)
  Using cached https://files.pythonhosted.org/packages/17/f5/d829150b4afd6420976b57d9ecab49237a979f75df4d84a88e793286d6c1/coverage-4.5.3-cp36-cp36m-macosx_10_13_x86_64.whl
Collecting termcolor>=1.1.0 (from mybad>=0.1.4->config2)
Collecting jsonpickle>=1.0 (from deepdiff>=3.3.0->config2)
  Using cached https://files.pythonhosted.org/packages/07/07/c157520a3ebd166c8c24c6ae0ecae7c3968eb4653ff0e5af369bb82f004d/jsonpickle-1.2-py2.py3-none-any.whl
Collecting ordered-set>=3.1 (from deepdiff>=3.3.0->config2)
Requirement already satisfied: setuptools>=40.8.0 in ./.pyenv/versions/3.6.5/envs/test-3/lib/python3.6/site-packages (from setupextras>=0.1.5->config2) (41.0.1)
Collecting pygments>=2.2.0 (from inspecta>=0.1.3->config2)
  Using cached https://files.pythonhosted.org/packages/5c/73/1dfa428150e3ccb0fa3e68db406e5be48698f2a979ccbcec795f28f44048/Pygments-2.4.2-py2.py3-none-any.whl
Collecting requests>=2.7.9 (from codecov>=2.0.15->config2)
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting blessings (from colour-runner>=0.0.5->config2)
  Using cached https://files.pythonhosted.org/packages/03/74/489f85a78247609c6b4f13733cbf3ba0d864b11aa565617b645d6fdf2a4a/blessings-1.7-py3-none-any.whl
Collecting pluggy<1,>=0.3.0 (from tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/06/ee/de89e0582276e3551df3110088bf20844de2b0e7df2748406876cc78e021/pluggy-0.12.0-py2.py3-none-any.whl
Collecting py<2,>=1.4.17 (from tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/76/bc/394ad449851729244a97857ee14d7cba61ddb268dce3db538ba2f2ba1f0f/py-1.8.0-py2.py3-none-any.whl
Collecting filelock<4,>=3.0.0 (from tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting virtualenv>=14.0.0 (from tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/ca/ee/8375c01412abe6ff462ec80970e6bb1c4308724d4366d7519627c98691ab/virtualenv-16.6.0-py2.py3-none-any.whl
Collecting toml>=0.9.4 (from tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting coloredlogs>=10.0 (from rootpath>=0.1.1->config2)
  Using cached https://files.pythonhosted.org/packages/08/0f/7877fc42fff0b9d70b6442df62d53b3868d3a6ad1b876bdb54335b30ff23/coloredlogs-10.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests>=2.7.9->codecov>=2.0.15->config2)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests>=2.7.9->codecov>=2.0.15->config2)
  Downloading https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl (150kB)
     |████████████████████████████████| 153kB 31.6MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.7.9->codecov>=2.0.15->config2)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=2.7.9->codecov>=2.0.15->config2)
  Using cached https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl
Collecting importlib-metadata>=0.12 (from pluggy<1,>=0.3.0->tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/7f/72/5e13a37e989bdb54ac3f52808e122cbd9b878ac980f932dc237ff64f8a00/importlib_metadata-0.17-py2.py3-none-any.whl
Collecting humanfriendly>=4.7 (from coloredlogs>=10.0->rootpath>=0.1.1->config2)
  Using cached https://files.pythonhosted.org/packages/90/df/88bff450f333114680698dc4aac7506ff7cab164b794461906de31998665/humanfriendly-4.18-py2.py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata>=0.12->pluggy<1,>=0.3.0->tox>=3.0.0->config2)
  Using cached https://files.pythonhosted.org/packages/a0/0f/9bf71d438d2e9d5fd0e4569ea4d1a2b6f5a524c234c6d221b494298bb4d1/zipp-0.5.1-py2.py3-none-any.whl
Building wheels for collected packages: pyyaml
  Building wheel for pyyaml (setup.py) ... done
  Stored in directory: /Users/grimen/Library/Caches/pip/wheels/16/27/a1/775c62ddea7bfa62324fd1f65847ed31c55dadb6051481ba3f
Successfully built pyyaml
Installing collected packages: pyyaml, jsonpickle, ordered-set, deepdiff, six, pygments, termcolor, coverage, idna, urllib3, chardet, certifi, requests, codecov, blessings, colour-runner, humanfriendly, coloredlogs, zipp, importlib-metadata, pluggy, py, filelock, virtualenv, toml, tox, rootpath, inspecta, setupextras, attributedict, mybad, deepmerge, config2
Successfully installed attributedict-0.3.0 blessings-1.7 certifi-2019.3.9 chardet-3.0.4 codecov-2.0.15 coloredlogs-10.0 colour-runner-0.1.1 config2-0.3.2 coverage-4.5.3 deepdiff-4.0.6 deepmerge-0.0.5 filelock-3.0.12 humanfriendly-4.18 idna-2.8 importlib-metadata-0.17 inspecta-0.1.3 jsonpickle-1.2 mybad-0.2.0 ordered-set-3.1.1 pluggy-0.12.0 py-1.8.0 pygments-2.4.2 pyyaml-5.1.1 requests-2.22.0 rootpath-0.1.1 setupextras-0.1.5 six-1.12.0 termcolor-1.1.0 toml-0.10.0 tox-3.12.1 urllib3-1.25.3 virtualenv-16.6.0 zipp-0.5.1
(test-3) ➜  ~ 

@jblereste Any way you could provide a shell script that reproduces this?

jblereste commented 5 years ago

setupextras module is guilty!

I attached these two scripts (using a fresh python install with docker) not-working.txt working.txt

grimen commented 5 years ago

@jblereste Oh this sucks, works with clean virtualenv (where no deps are installed) but fails when I run your example. So setup.py is not allowed to import any dependencies defined in requirements.txt...Python/PIP is so broken by design. :/

I either have to hardcode all these functions in 15 modules, or require setupextras. I don't know what is best/worst right now.

bjoluc commented 4 years ago

@grimen Looks like using Poetry would automatically solve this one as well.

reuben commented 2 years ago

You can setup a pyproject.toml file with the following contents:

[build-system]
requires = ["setuptools", "setupextras"] # any other build-time dependencies of setup.py here
build-backend = "setuptools.build_meta"
reuben commented 2 years ago

PRs here: https://github.com/grimen/python-mybad/pull/1 and here: https://github.com/grimen/python-config2/pull/22

mtr commented 2 years ago

I would really love it if you could include the PR @reuben provides. That would solve a similar problem I experience using pipenv.

mrsouthern commented 2 years ago

Please.

swarupe04 commented 1 year ago

Any update on this or any alternative option?

sdg002 commented 1 year ago

Similar problem. I was eagerly looking forward to introduce this library to my team.

Version of Python

3.9

Structure of requirements.txt

setupextras
config2

Error message while trying to install setupextras

  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "C:\Users\johndoe\MyTrials\Python\any-python\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\johndoe\MyTrials\Python\any-python\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\johndoe\MyTrials\Python\any-python\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\johndoe\AppData\Local\Temp\pip-build-env-y752hg8q\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\johndoe\AppData\Local\Temp\pip-build-env-y752hg8q\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\johndoe\AppData\Local\Temp\pip-build-env-y752hg8q\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\johndoe\AppData\Local\Temp\pip-build-env-y752hg8q\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'setupextras'
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.\

note: This error originates from a subprocess, and is likely not a problem with pip.
bjoluc commented 1 year ago

Any update on this or any alternative option?

Sorry to hijack a thread on this project again – I just couldn't resist to reply: @swarupe04 @sdg002 I wrote appcfg a few years ago as a simple, fully tested alternative to this and I'll keep maintaining it too (should you be worried about that). Unlike with config2, the root path is inferred from __name__ instead of the file system and the configuration is returned as a plain Python dict which you can always wrap in DotDict or friends if the dot syntax is important to you. Cheers!