spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.29k stars 1.61k forks source link

Spyder 6.0.1 virtually crashing the whole PC upon startup + other issues (Win 11/Micromamba) #22614

Open arpitg95 opened 2 weeks ago

arpitg95 commented 2 weeks ago

Issue Report Checklist

Problem Description

I am on Windows 11 and installed python, spyder, etc. using Micromamba. After updating from Spyder 5.5.6 to 6.0.x, I first encoutered the --no-capture-output error when Spyder tried to launch a kernel. That was kind of fixed on my end by modifying envs\<env_name>\Lib\site-packages\spyder\plugins\ipythonconsole\utils\kernelspec.py -> micromamba to micromamba.exe

136: if conda_exe.endswith('micromamba.exe'):
                kernel_cmd.extend(['--attach', '""'])

That being said, after launching spyder, it just plain crashes the PC. Sometimes it causes some other applications to close. One time it caused dwm.exe to crash. Most of the time it just causes a black screen, and I have to restart the whole PC. Though I did manage to see Spyder load the IPython kernel for a second before the screen crashed to black.

What steps reproduce the problem?

  1. Modify kernelspec.py file in ipythonconsole utils and make it say micromamba.exe instead of micromamba only.
  2. Launch spyder.
  3. Restart PC and try again.

What is the expected output? What do you see instead?

Expected output - See spyder load ipython kernel Actual output - black screen

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

Dependencies

# Mandatory:
aiohttp >=3.9.3                  :  3.10.8 (OK)
asyncssh >=2.14.0,<3.0.0         :  2.17.0 (OK)
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.2.0 (OK)
cloudpickle >=0.5.0              :  3.0.0 (OK)
cookiecutter >=1.6.0             :  2.6.0 (OK)
diff_match_patch >=20181111      :  20230430 (OK)
github >=2.3.0                   :  2.4.0 (OK)
importlib_metadata >=4.6.0       :  8.5.0 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.27.0 (OK)
jedi >=0.17.2,<0.20.0            :  0.19.1 (OK)
jellyfish >=0.7                  :  1.1.0 (OK)
jsonschema >=3.2.0               :  4.23.0 (OK)
keyring >=17.0.0                 :  25.4.1 (OK)
nbconvert >=4.0                  :  7.16.4 (OK)
numpydoc >=0.6.0                 :  1.8.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.4 (OK)
pexpect >=4.4.0                  :  4.9.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  6.0.0 (OK)
pygments >=2.0                   :  2.18.0 (OK)
pylint >=3.1,<4                  :  3.3.1 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.12.0,<1.13.0           :  1.12.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
pyuca >=1.2                      :  1.2 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.3 (OK)
qtawesome >=1.3.1,<1.4.0         :  1.3.1 (OK)
qtconsole >=5.6.0,<5.7.0         :  5.6.0 (OK)
qtpy >=2.4.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.3.0 (OK)
setuptools >=49.6.0              :  75.1.0 (OK)
sphinx >=0.6.6                   :  8.0.2 (OK)
spyder_kernels >=3.0.0,<3.1.0    :  3.0.0 (OK)
superqt >=0.6.2,<1.0.0           :  0.6.7 (OK)
textdistance >=4.2.0             :  4.6.2 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  5.0.3 (OK)
yarl >=1.9.4                     :  1.13.1 (OK)
zmq >=24.0.0                     :  26.2.0 (OK)

# Optional:
cython >=0.21                    :  None (NOK)
matplotlib >=3.0.0               :  3.9.2 (OK)
numpy >=1.7                      :  2.1.1 (OK)
pandas >=1.1.1                   :  2.2.3 (OK)
scipy >=0.17.0                   :  1.14.1 (OK)
sympy >=0.7.3                    :  1.13.3 (OK)
ccordoba12 commented 2 weeks ago

Hey @arpitg95, thanks for reporting. A couple of questions for you:

arpitg95 commented 2 weeks ago

What's your micromamba version?

libmamba version : 1.5.8
micromamba version : 1.5.8

What do you by black screen? You don't even see the famous Windows blue screen of death?

I tried launching spyder a few more times since then. One time I got the message that Windows had to sign me out because DWM.exe has crashed. So, it is not exactly a hard crash to BSoD.

ccordoba12 commented 2 weeks ago

Thanks for the extra info @arpitg95.

@dalthviz, could you check if you're getting the same behavior on Windows when using micromamba? For that you also need to apply the smalll fix mentioned by @arpitg95 in the OP.

dalthviz commented 2 weeks ago

So I checked installing Spyder 6.0.1 via micromamba and got a couple of messages from the installation:

Linking spyder-6.0.1-py312h2e8e312_2
error    libmamba Creation of shortcut was not successful [json.exception.type_error.302] type must be string, but is object
"chcp" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
"chcp" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
""C:\Users\dalth\micromambaenv\condabin\micromamba"" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

Transaction finished

Launch Spyder via powershell showed another message:

C:\Users\dalth\micromambaenv\envs\micro_spyder\Lib\site-packages\qstylizer\style.py:68: SyntaxWarning: invalid escape sequence '\*'
  _split_regex = '\*|\[[A-Za-z0-9=\'"_:]+\]|\W*\w*'

Checking the IPython Console I got an error but seems to me that is related with trying to activate the micromamba created env via the conda from the Anaconda distribution I have installed?:

"chcp" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\exception_handler.py", line 17, in __call__
return func(*args, **kwargs)
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\cli\main.py", line 105, in main_sourced
print(activator.execute(), end="")
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 199, in execute
return getattr(self, self.command)()
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 165, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 343, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 367, in _build_activate_stack
return self.build_reactivate()
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 558, in build_reactivate
self._replace_prefix_in_path(conda_prefix, conda_prefix)
File "C:\Users\dalth\anaconda3\lib\site‑packages\conda\activate.py", line 677, in _replace_prefix_in_path
if path_list[last_idx + 1] == library_bin_dir:
IndexError: list index out of range

`$ C:\Users\dalth\anaconda3\Scripts\conda‑script.py shell.cmd.exe activate C:\Users\dalth\micromambaenv\envs\micro_spyder`

Closed Spyder and did the micromamba.exe change over kernelspec.py, tried to launch Spyder but I got the same error

arpitg95 commented 2 weeks ago

About that, I tried updating micromamba to 2.0.1 and I got the same chcp error. It seems like micromamba 2.0.1 is not honoring the OS's PATH, so it is not able to run system commands (You can check $Env:PATH before and after activating micromamba environment).

I would recommend trying micromamba=1.5.10 (the last version before 2.x; I should also open an issue at micromamba repo).

Update: Seems like this is also an issue with mamba as raised in https://github.com/mamba-org/mamba/issues/3405 with a temporary fix.

ccordoba12 commented 2 weeks ago

@dalthviz, I agree with @arpitg95, please test with micromamba 1.5.10 because version 2.0 seems broken or semi-broken.