Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

attrdict a requirement for pip install fails otherwise.

Open tatarize opened this issue 3 years ago • 24 comments

PS C:\Users\Tat\PycharmProjects\meerk40t> pip install wxPython
Collecting wxPython
  Downloading wxPython-4.2.0.tar.gz (71.0 MB)
     ---------------------------------------- 71.0/71.0 MB 735.6 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Tat\AppData\Local\Temp\pip-install-n4x9oroc\wxpython_3fcdd7a92a3246c686817597dd963d32\setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "C:\Users\Tat\AppData\Local\Temp\pip-install-n4x9oroc\wxpython_3fcdd7a92a3246c686817597dd963d32\buildtools\config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [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.

It fixed and installed after pip install attrdict but I don't usually expect failure to pip install.

tatarize avatar Aug 09 '22 06:08 tatarize

It fixed and installed after pip install attrdict but I don't usually expect failure to pip install.

But with python 3.10 on my ArchLinux it is raising the following error:

Collecting wxpython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-v2d0o325/wxpython_2d295bd40b8f4afcb9fdee5d09790f32/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-v2d0o325/wxpython_2d295bd40b8f4afcb9fdee5d09790f32/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
        File "/home/harry/.pyvenv/general/lib/python3.10/site-packages/attrdict/__init__.py", line 5, in <module>
          from attrdict.mapping import AttrMap
        File "/home/harry/.pyvenv/general/lib/python3.10/site-packages/attrdict/mapping.py", line 4, in <module>
          from collections import Mapping
      ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
      [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.

It seems that attrdict is incompatible with python 3.10. This is caused by a change in the collections interface starting with Python 3.10.

FreeHarry avatar Aug 09 '22 15:08 FreeHarry

You need attrdict3 not attrdict. Note that it is only actually used on Windows currently, so I submitted a PR to remove it on other platforms, see #2224

swt2c avatar Aug 09 '22 15:08 swt2c

My linux unittest started failing due to that too. I sort of expect those kinks to get worked out. And the wheels really should have deployed I think for my OS but I'm not too worried since it bleeding edge.

tatarize avatar Aug 10 '22 05:08 tatarize

@tatarize, what is your OS and Python version?

swt2c avatar Aug 10 '22 15:08 swt2c

@swt2c installing attrdict3 works for me for now. Thanks.

2sn avatar Aug 11 '22 04:08 2sn

@tatarize, what is your OS and Python version?

Windows 7. Python 3.8 but I also had unittest in linux fail along the same lines it was trying to install wxPython for a thing it didn't really need it for.

tatarize avatar Aug 11 '22 12:08 tatarize

I had the same issue on arch linux recently. If for some reason older versions of wxPython with python 3.10 are needed, you can change the import occurrences of from collections to from collections.abc within the attrdict library.

Flanisch avatar Aug 12 '22 00:08 Flanisch

You need attrdict3 not attrdict. Note that it is only actually used on Windows currently, so I submitted a PR to remove it on other platforms, see #2224

It's not only used on Windows, hence why builds are now failing on Linux. At the very least, it is needed when the wheel is built from source (as it always is on Linux). I'm afraid I don't know the inner workings of wxpython better to narrow it down further.

Here is my pip error log:

  Command ['/home/alex/code/iPANACEA/.venv/bin/pip', 'install', '--no-deps', '-U', 'file:///home/alex/.cache/pypoetry/artifacts/82/c0/3a/d4a405db6cce1fdd910ba65dd2db32dcba675b4efec2e445f4140c6fa6/wxPython-4.2.0.tar.gz'] errored with the following return code 1, and output: 
  Processing /home/alex/.cache/pypoetry/artifacts/82/c0/3a/d4a405db6cce1fdd910ba65dd2db32dcba675b4efec2e445f4140c6fa6/wxPython-4.2.0.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error
    
    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [8 lines of output]
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "/tmp/pip-req-build-oy_awq84/setup.py", line 27, in <module>
            from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
          File "/tmp/pip-req-build-oy_awq84/buildtools/config.py", line 30, in <module>
            from attrdict import AttrDict
        ModuleNotFoundError: No module named 'attrdict'
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: metadata-generation-failed

alexdewar avatar Aug 23 '22 16:08 alexdewar

There isn't any need to narrow it down further. You need to install attrdict3 in order to build wxPython 4.2.0. In the future, you'll only need it on Windows.

swt2c avatar Aug 23 '22 20:08 swt2c

The objection I had was that Linux stopped working. I had some github Linux thing that required wx for unit tests and it threw that error. It didn't work in my windows7 python3.8 setup either since it demanded the attrdict thing.

With the merge of not requiring this for Linux this might be closable. I'm used to just getting a valid wheels for windows rather than it trying to compile the whole thing that it doesn't seem like it should have thrown that error at me there either. But, that might be fixable and the Windows10/Python 3.10 system had it install without issue.

tatarize avatar Aug 23 '22 22:08 tatarize

I did just remove wx from the linux unittests since they were never used. So I might not be well versed on all the threads of this issue.

tatarize avatar Aug 23 '22 22:08 tatarize

There isn't any need to narrow it down further. You need to install attrdict3 in order to build wxPython 4.2.0. In the future, you'll only need it on Windows.

But the point is that you don't have a choice but to build it on Linux, so if you run pip install wxpython it currently just errors out. So on Linux it is a required dependency if you want users to be able to actually install wxpython.

alexdewar avatar Aug 24 '22 06:08 alexdewar

On Ubuntu 20.04.4 with kernel 5.15 Python 3.8 and wxPython 4.2.0

I got almost the same error:

$ pip3 install wxPython
Defaulting to user installation because normal site-packages is not writeable
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-n3c8k4cd/wxpython_e93e7db2517a413b9c0dc98d551d966a/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-n3c8k4cd/wxpython_e93e7db2517a413b9c0dc98d551d966a/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [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.

Fixed it with: pip3 install attrdict

technout avatar Aug 27 '22 17:08 technout

I am getting the same error on CentOS 7.8.2003, python version 3.6.8, wxPython version 4.2.0.

Adding attrdict and/or attrdict3 to my requirements file ahead of wxpython does not solve the issue.

forchtj avatar Sep 01 '22 12:09 forchtj

I am getting the same error on CentOS 7.8.2003, python version 3.6.8, wxPython version 4.2.0.

Adding attrdict and/or attrdict3 to my requirements file ahead of wxpython does not solve the issue.

@forchtj I have the same error on wine/windows, python version 3.6.8, wxPython version 4.2.0.

But when I downgrade to wxPython 4.1.1, the error was gone.

allenyllee avatar Sep 12 '22 15:09 allenyllee

Tbh I'm rather disappointed at the devs' lack of response here.

This breaks things for Linux users -- for example my CI is now failing for a number of projects and the only sensible fix is to pin wxpython to an older version. The offending commit should clearly just be reverted.

alexdewar avatar Sep 16 '22 15:09 alexdewar

Which offending commit?

swt2c avatar Sep 16 '22 16:09 swt2c

Thanks for your response! I think this is the one: https://github.com/wxWidgets/Phoenix/pull/2224/commits/2e9169effa9abf14f34f8436a791b8829eea7774

If I understand correctly, it removes attrdict3 as a dev dependency for Linux, meaning building wxpython (e.g. when you run pip install wxpython) will fail due to a missing import.

alexdewar avatar Sep 16 '22 16:09 alexdewar

No, sorry - that FIXES the problem you're seeing.

As a workaround for your CI, you can 'pip install attrdict3' before trying to install wxpython.

swt2c avatar Sep 16 '22 17:09 swt2c

So just to be clear, the intention of wxpython's developers is that pip install wxpython should be guaranteed to fail on Linux unless they execute another command beforehand?! That's a pretty user-hostile design :disappointed:

What's so important about that commit that it's worth breaking your users for?

alexdewar avatar Sep 16 '22 17:09 alexdewar

Sorry, but you're misunderstanding the problem. When you're running pip install wxpython what you're getting DOES NOT include that commit!

swt2c avatar Sep 16 '22 17:09 swt2c

I have the same problem today. I was expecting pip install wxpython to work. This comment matches my exact experience: https://github.com/wxWidgets/Phoenix/issues/2225#issuecomment-1209538326

greyltc avatar Sep 23 '22 10:09 greyltc

I guess building the 4.2.0 release is broken under modern linuxes because of the attrdict module import. Deleting https://github.com/wxWidgets/Phoenix/blob/b567d1e6e3aff88f900d5ec4fb148531746b211d/buildtools/config.py#L30 seems to solve the problem for me and it looks like that's already been done in the main branch via https://github.com/wxWidgets/Phoenix/commit/2e9169effa9abf14f34f8436a791b8829eea7774 So those wanting to build 4.2.0 (the latest stable release as of this writing) need to either patch it before building or wait for a new release that rolls in the fix from https://github.com/wxWidgets/Phoenix/commit/2e9169effa9abf14f34f8436a791b8829eea7774.

greyltc avatar Sep 23 '22 11:09 greyltc

I'm pretty sure the commit you cited is to fix the issue. What you actually want is the releases of 4.2.0-post1 with that commit in place. Such that installs in Linux are not strange and crashing. We need the pip version to actually work. We don't want to wait a year for that to happen.

tatarize avatar Sep 23 '22 15:09 tatarize

Any idea when that release that rolls in these fixes might be dropping? I literally can't install wxpython using pipenv at the moment (on Linux), even if I add attrdict or attrdict3 to my list of dependencies. I have a workaround, but it would be very helpful if a point release with this fix could occur somewhat soon.

artlogic avatar Oct 15 '22 20:10 artlogic

Also failing on macOS

Collecting wxpython>=4.0.7
  Downloading wxPython-4.2.0.tar.gz (71.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.0/71.0 MB 595.3 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/d_/fmfzzc2d37d8l9mw_2bblb8c0000gn/T/pip-install-d44rs5mb/wxpython_68fa328d33c84a89aa8ade7190cc500c/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/private/var/folders/d_/fmfzzc2d37d8l9mw_2bblb8c0000gn/T/pip-install-d44rs5mb/wxpython_68fa328d33c84a89aa8ade7190cc500c/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'

acorello avatar Nov 13 '22 19:11 acorello

I confirm attrdict3 is required on Ubuntu 22.04.1:

Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-sspcjaa7/wxpython_f8532717e5604e72b04bc649051e86a2/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-sspcjaa7/wxpython_f8532717e5604e72b04bc649051e86a2/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [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.

If I do this before relaunching the command that requires wxPython:

$ pip install attrdict3 
Defaulting to user installation because normal site-packages is not writeable
Collecting attrdict3
  Downloading attrdict3-2.0.2-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from attrdict3) (1.16.0)
Installing collected packages: attrdict3
Successfully installed attrdict3-2.0.2

Everything works perfecly.

SpaceFox avatar Nov 15 '22 21:11 SpaceFox

Untitled ı try install arch linux and windows 8.1 same ı can't install

gnuchanos avatar Nov 17 '22 20:11 gnuchanos

Has this been fixed on the main branch yet? When will this find its way into a point release?

alexdewar avatar Nov 18 '22 09:11 alexdewar

macOS has same issue, and already check is occur by "attrdict"

I think attrdict3 should be add into dependency, not ask developer manual install it.

linroex avatar Nov 25 '22 05:11 linroex