module 'qdarkstyle' has no attribute 'light'

  • MNE version: 1.2.1
  • operating system: Windows 10

when I learn mne through the tutorials, I met problem with section ‘working with sensor locations / visualizing sensors in 3D surface renderings’.
when I tried the code:

fig = mne.viz.plot_alignment(
sample_raw.info, dig=False, eeg=False,
surfaces=, meg=[‘helmet’, ‘sensors’],
coord_frame=‘meg’
)
mne.viz.set_3d_view(fig, azimuth=50, elevation=90, distance=0.5)

I get an error:
Traceback (most recent call last):

File “”, line 1, in
fig = mne.viz.plot_alignment(sample_raw.info, dig=False, eeg=False, surfaces=, meg= [‘helmet’,‘sensors’], coord_frame= ‘meg’)

File “”, line 12, in plot_alignment

File “D:\anaconda\lib\site-packages\mne\viz_3d.py”, line 737, in plot_alignment
renderer = _get_renderer(fig, name=f’Sensor alignment: {subject}',

File “D:\anaconda\lib\site-packages\mne\viz\backends\renderer.py”, line 44, in _get_renderer
return backend._Renderer(*args, **kwargs)

File “D:\anaconda\lib\site-packages\mne\viz\backends_qt.py”, line 1626, in init
self._window_initialize(fullscreen=fullscreen)

File “D:\anaconda\lib\site-packages\mne\viz\backends_qt.py”, line 1332, in _window_initialize
self._window_set_theme()

File “D:\anaconda\lib\site-packages\mne\viz\backends_qt.py”, line 1478, in _window_set_theme
stylesheet = _qt_get_stylesheet(theme)

File “D:\anaconda\lib\site-packages\mne\viz\backends_utils.py”, line 290, in _qt_get_stylesheet
klass = getattr(getattr(qdarkstyle, theme).palette,

AttributeError: module ‘qdarkstyle’ has no attribute ‘light’

Hello @longshejuhua and welcome to the forum!

Could you please share the output of

import mne
mne.sys_info()

Thanks!

Richard

I have the same problem, I’m just trying to plot raw data, my output of mne.sys_info() is the following :

Platform: Windows-10-10
Python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Users\Anaconda3\python.exe
CPU: Intel64 Family 6 Model 142 Stepping 12, GenuineIntel: 8 cores
Memory: 15.8 GB

mne: 1.0.2
numpy: 1.22.3 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.7.3
matplotlib: 3.5.1 {backend=module://matplotlib_inline.backend_inline}

sklearn: 1.0.2
numba: Not found
nibabel: 3.2.1
nilearn: 0.9.2
dipy: Not found
cupy: Not found
pandas: 1.3.5
pyvista: 0.34.2 {OpenGL 4.5.0 - Build 27.20.100.9126 via Intel(R) UHD Graphics 620}
pyvistaqt: Not found
ipyvtklink: 0.2.2
vtk: 9.1.0
PyQt5: 5.9.2
ipympl: Not found
pooch: v1.5.2

mne_bids: 0.10
mne_nirs: 0.4.0
mne_features: Not found
mne_qt_browser: 0.4.0
mne_connectivity: Not found

my output of mne.sys_info() is:

mne.sys_info()
Platform:         Windows-10-10.0.19041-SP0
Python:           3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Executable:       D:\anaconda\python.exe
CPU:              Intel64 Family 6 Model 165 Stepping 2, GenuineIntel: 16 cores
Memory:           31.9 GB

mne:              1.2.1
numpy:            1.21.5 {MKL 2021.4-Product with 8 threads}
scipy:            1.7.3
matplotlib:       3.3.2 {backend=Qt5Agg}

sklearn:          0.23.2
numba:            0.51.2
nibabel:          Not found
nilearn:          Not found
dipy:             Not found
openmeeg:         Not found
cupy:             Not found
pandas:           1.1.3
pyvista:          0.36.1 {OpenGL 4.5.0 NVIDIA 517.00 via NVIDIA GeForce RTX 2060/PCIe/SSE2}
pyvistaqt:        0.9.0
ipyvtklink:       Not found
vtk:              9.2.2
qtpy:             1.9.0 {PyQt5=5.9.7}
ipympl:           Not found
pyqtgraph:        Not found
pooch:            v1.6.0

mne_bids:         Not found
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   Not found
mne_connectivity: Not found
mne_icalabel:     Not found

Thank you!

@marsipu any idea what could be the issue here?

1 Like

are we sure that qdarkstyle is installed on your computer?

Alex

I think this indicates that the package is installed, no?

can you try in your python terminal to do:

import qdarkstyle

qdarkstyle
print(dir(qdarkstyle))

and paste here what you see

Alex

my output is the following :

[‘DEPRECATION_MSG’, ‘DarkPalette’, ‘EXAMPLE_PATH’, ‘IMAGES_PATH’, ‘LightPalette’, ‘MAIN_SCSS_FILE’, ‘PACKAGE_PATH’, ‘Palette’, ‘QRC_FILE’, ‘QSS_FILE’, ‘QSS_PATH’, ‘REPO_PATH’, ‘STYLES_SCSS_FILE’, ‘STYLES_SCSS_FILEPATH’, ‘SVG_PATH’, ‘VARIABLES_SCSS_FILE’, ‘builtins’, ‘cached’, ‘doc’, ‘file’, ‘loader’, ‘name’, ‘package’, ‘path’, ‘spec’, ‘version’, ‘_apply_application_patches’, ‘_apply_binding_patches’, ‘_apply_os_patches’, ‘_apply_version_patches’, ‘_load_stylesheet’, ‘_logger’, ‘colorsystem’, ‘dark’, ‘light’, ‘load_stylesheet’, ‘load_stylesheet_from_environment’, ‘load_stylesheet_pyqt’, ‘load_stylesheet_pyqt5’, ‘load_stylesheet_pyside’, ‘load_stylesheet_pyside2’, ‘logging’, ‘os’, ‘palette’, ‘platform’, ‘sys’, ‘warnings’]

I see ‘light’ in the list.

can you try:

print(qdarkstyle.light)
getattr(qdarkstyle, “light”)

Alex

I updated Spyder and the problem disapeared

2 Likes