Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with pyside2 (napari bundle), due to outdated black import #54

Open
psobolewskiPhD opened this issue Jul 17, 2024 · 1 comment

Comments

@psobolewskiPhD
Copy link

Failed to import command at ‘napari_chatgpt._widget:OmegaQWidget’: cannot import name ‘FileMode’ from ‘black’
Originally posted:
forum.image.sc/t/failed-to-import-command-at-napari-chatgpt/99260
The napari conda bundle uses pyside2 as Qt back end.
The issue looks like an incompatibility between the specific black import and pyside2
With black, from black import FileMode fails in the bundle or napari env with pyside2
but works with pyqt5.
Here's the error:

from black import FileMode
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 from black import FileMode

File ~/Dev/miniforge3/envs/napari-050ps2/lib/python3.9/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139, in _import(name, *args, **kwargs)
    137     default = 0 if name.split(".")[0] == "PySide2" else -1
    138     pyside_feature_dict[importing_module] = default
--> 139 return original_import(name, *args, **kwargs)

File src/black/__init__.py:67

File src/black/linegen.py:73

File src/black/trans.py:251

TypeError: mypyc classes can't have a metaclass

That import looks outdated? see:
psf/black@06f2790

@royerloic
Copy link
Member

Ok, working on a workaround, making the import of black local, should help. Will post an update here is the bug is confirmed gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants