Repository: spyder-ide/spyder

Issue:
Help pane doesn't show anything in rich text mode
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [X] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [X] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [X] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [X] Tried basic troubleshooting (if a bug/error)
    * [X] Restarted Spyder
    * [X] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [X] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

When inspecting an object, the help pane flashes white shortly and then displays a blank pane.

![Peek 2023-01-12 09-28](https://user-images.githubusercontent.com/14980558/212017033-8fd7aaba-d53d-45d9-92ac-530a44749841.gif)

### What steps reproduce the problem?

1. Installed spyder via `pip install spyder` inside miniconda env (this is the way I usually install spyder)
2. Click on any object and inspect, or press the key combination for inspect
3. same happens in console or editor
4. the online help suffers from the same problem

### What is the expected output? What do you see instead?

Help pane opens with the inspected object rendered in richt text. Instead, it flashes shortly and then displays a blank page. However, when switching to plain text mode, the widget works fine, so it must be a rendering issue, probably with the WebEngine.

* I do remember having this issue before when trying to setup Spyder inside WSL2 some time ago, but I don't remember what the solution was, or if there was any at all. 
* Here I'm using Kubuntu 22.04, so I could imagine that this is due to incompatibilities between the system KDE Qt5 version (`5.15.2`) and spyder Qt5 (`5.15.7`)? 
* I tried downgrading the `PyQtWebEngine` to a lower version, but that only led to Spyder not starting anylonger.
* I tried downgrading to `PyQt5==5.15.2` and `PyQtWebEngine==5.15.2` using `--force-reinstall`, but then PyQtWebEngine would not load

Probably related:
#17751
#18776
#17771 (maybe not)

trying this solutions does not fix the problem:
```
    conda create -n spyder-cf -c conda-forge spyder
    conda activate spyder-cf
    spyder
```


### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->
No traceback. Also no errors appear in verbose debug mode

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 5.4.1  (conda)
* Python version: 3.10.6 64-bit
* Qt version: 5.15.2
* PyQt5 version: 5.15.7
* Operating System: Linux 5.15.0-56-generic

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
# Mandatory:
atomicwrites >=1.2.0          :  1.4.1 (OK)
chardet >=2.0.0               :  5.1.0 (OK)
cloudpickle >=0.5.0           :  2.2.0 (OK)
cookiecutter >=1.6.0          :  2.1.1 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.31.1;<9.0.0       :  8.8.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.2 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.17.3 (OK)
keyring >=17.0.0              :  23.13.1 (OK)
nbconvert >=4.0               :  7.2.7 (OK)
numpydoc >=0.6.0              :  1.5.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.4 (OK)
pygments >=2.0                :  2.14.0 (OK)
pylint >=2.5.0;<3.0           :  2.15.10 (OK)
pylint_venv >=2.1.1           :  2.3.0 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.7.0;<1.8.0          :  1.7.0 (OK)
pylsp_black >=1.2.0           :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.2.2             :  0.2.2 (OK)
qtawesome >=1.2.1             :  1.2.2 (OK)
qtconsole >=5.4.0;<5.5.0      :  5.4.0 (OK)
qtpy >=2.1.0                  :  2.3.0 (OK)
rtree >=0.9.7                 :  1.0.1 (OK)
setuptools >=49.6.0           :  65.7.0 (OK)
sphinx >=0.6.6                :  6.1.3 (OK)
spyder_kernels >=2.4.1;<2.5.0 :  2.4.1 (OK)
textdistance >=4.2.0          :  4.5.0 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.2.1 (OK)
xdg >=0.26                    :  0.28 (OK)
zmq >=22.1.0                  :  24.0.1 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=3.0.0            :  3.6.2 (OK)
numpy >=1.7                   :  1.23.5 (OK)
pandas >=1.1.1                :  1.5.2 (OK)
scipy >=0.17.0                :  1.9.3 (OK)
sympy >=0.7.3                 :  None (NOK)
```



Discussion:
Hey @skjerns, thanks for reporting. You said:

> Installed spyder via pip install spyder inside miniconda env

Did you install other packages with conda or other packages with pip as well?

> trying this solutions does not fix the problem:
> conda create -n spyder-cf -c conda-forge spyder

I'm surprised this didn't work for you. Did you install other packages in that environment using pip?
This could also be an issue with your graphics card drivers. To check that, be sure that you have the `Software` option selected as `Rendering engine` here:

![imagen](https://user-images.githubusercontent.com/365293/212361465-30a449ae-d76f-4b2f-bdec-7da3fe588421.png)

> Did you install other packages with conda or other packages with pip as well?

I installed some basic packages like `mne`, `numba` etc with pip, nothing with conda. However, even if I remove miniconda and reinstall and at first install spyder, the same error appears


> I'm surprised this didn't work for you. Did you install other packages in that environment using pip?

In the `spyder-cf` env, I did not run any command, besides the one stated above

> This could also be an issue with your graphics card drivers. To check that, be sure that you have the `Software` option selected as `Rendering engine` here:

I tried all three different rendering engines, no difference :-/

When installing using Anaconda (which uses Python 3.9) and not MiniForge/MiniConda (which uses Python 3.10, that's why I use it), it seems to work fine. Let me know if there is anything I can do to follow up to this issue, else I'll accept using anaconda instead of miniconda as a workaround to close the issue for now. 



PS: Now suddenly this error appears, but I'm not sure it's related. It might be due to me changing too many variables and packages:

```
/home/XXX/anaconda3/envs/spyder-cf/lib/python3.9/site-packages/jupyter_client/threaded.py:73: RuntimeWarning: ZMQStream only supports the base zmq.Socket class.                                                          
                                                                                                              
                Use zmq.Socket(shadow=other_socket)                                                           
                or `ctx.socket(zmq.DEALER, socket_class=zmq.Socket)`                                          
                to create a base zmq.Socket object,                                                           
                no matter what other kind of socket your Context creates.                                     
                                                                                                              
  self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)                                                 
/home/XXX/anaconda3/envs/spyder-cf/lib/python3.9/site-packages/jupyter_client/threaded.py:73: RuntimeWarning: ZMQStream only supports the base zmq.Socket class.                                                          
                                                                                                              
                Use zmq.Socket(shadow=other_socket)                                                           
                or `ctx.socket(zmq.SUB, socket_class=zmq.Socket)`                                             
                to create a base zmq.Socket object,
                no matter what other kind of socket your Context creates.
                
  self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
[73366:73532:0115/103054.201196:ERROR:backend_impl.cc(1432)] Unable to map Index file

```

PPS: when installing anaconda3 regular, spyder (currently 5.3.3) works. When I create an environment with python 3.10, the spyder==5.3.3 in this environment suffers from the same problem. A lot of the libraries in the py3.10 env are several microversions behind the ones on anaconda3, that might be the problem (e.g. qt-webengine on 5.15.9 on conda-py3.9 vs 5.15.4 on conda-py3.10)
Solution for now: 
1. Install anaconda3 regularly
2. Create Python 3.10 environment `py3.10`
3. Start Spyder in (base), then set it to use the `py3.10` env
4. Done!

I guess for now I'll just have to live with using Spyder 5.3.3 :-/
Reopening because a lot of people is experiencing this problem.
Got exactly the same problem on my Ubuntu 22.04 (Python 3.10.8, Spyder 5.4.2). Reverting to Python 3.9 and Spyder 5.3.3 made the problem go away. However, I do have the same installation (Python 3.10.8, Spyder 5.4.2) on my office computer (OpenSuse 15.4), which has exactly the same package versions for all spyder dependencies and no issue with rich text help there.

So it's maybe OS-related ... (Ubuntu 22.04 uses Linux 5.15.0 kernal, while OpenSuse 15.4 uses 5.14.21)
@tlunet, how did you install Spyder? Did you use Conda, Conda-forge or Pip packages?
> @tlunet, how did you install Spyder? Did you use Conda, Conda-forge or Pip packages?

Conda-forge only, for both systems (OpenSuse and Ubuntu)
I have the same problem (help pane does not show rich text, does show plain text). Environment is created with `mamba create -n spybin spyder python=3.10`, using conda-forge channel on Debian. 

Things I tried:
* Downgrading to Python 3.10 and Spyder 5.3.3 does not help. 
* Running Spyder from source using the master branch does not help. 
* Changing rendering engine does not help.

I also tried the example code `simple.py` on https://zetcode.com/pyqt/qwebengineview/ and that does not work either (it displays a blank window instead of the HTML document), so I don't think the problem originates from Spyder. Nevertheless, it needs to be solved.

After searching a bit, found a workaround using `export QTWEBENGINE_DISABLE_SANDBOX=1` (see https://discourse.slicer.org/t/extensions-not-showing-anything/23432/5)

Resolving patch:
diff --git a/spyder/config/manager.py b/spyder/config/manager.py
--- a/spyder/config/manager.py
+++ b/spyder/config/manager.py
@@ -689,7 +689,7 @@ def reset_shortcuts(self):
     # fallback fail.
     # See issue spyder-ide/spyder#17889
     if app is None:
-        app = QApplication(['Spyder'])
+        app = QApplication(['Spyder', '--no-sandbox'])
         app.setApplicationName('Spyder')
 
     reset_reply = QMessageBox.critical(
diff --git a/spyder/utils/qthelpers.py b/spyder/utils/qthelpers.py
--- a/spyder/utils/qthelpers.py
+++ b/spyder/utils/qthelpers.py
@@ -109,7 +109,7 @@ def qapplication(translate=True, test_time=3):
     if app is None:
         # Set Application name for Gnome 3
         # https://groups.google.com/forum/#!topic/pyside/24qxvwfrRDs
-        app = SpyderApplication(['Spyder'])
+        app = SpyderApplication(['Spyder', '--no-sandbox'])
 
         # Set application name for KDE. See spyder-ide/spyder#2207.
         app.setApplicationName('Spyder')


Test patch: