how to launch recent Jupyter QtConsole on Windows without a console window
There are two problems here:
%CONDA_PREFIX%\Scripts\jupyter-qtconsole.exe
marked as console executable (Subsystem
field in PE optional header)- the
-m ipykernel_launcher <etc>
subprocess started withpython.exe
even if the launcher was started withpythonw
.- This one I was able to track to
%CONDA_PREFIX%\share\jupyter\kernels\python3\kernel.json
. It uses a full path to the executable thus doesn't trigger the logic injupyter_client\manager.py
that replaces certain patterns withsys.executable
.
- This one I was able to track to
Both of these are specific to Anaconda and do not happen with the stock Python. As such, file a bug against https://github.com/conda-forge/qtconsole-feedstock to get this fixed.
These are the workarounds:
- For the first bug, run
pythonw <Scripts_dir>\jupyter-qtconsole-script.py
which is the script that the.exe
wraps.
(This is Anaconda-specific. Regular Python uses a different wrapping mechanism. Anaconda must be patchingsetuptools
or something.) - For the second one, replace the full path in the aforementioned
kernel.json
with "python
". This change will be overwritten when you update theipykernel
package that this file belongs to (this can be checked by searching for it in%CONDA_PREFIX%\pkgs
).
The OP reports that this solution may break other Anaconda packages. I believe those that break make assumptions about the availability of standard streams. Though it too counts as a bug in my book, it must be coming from the fact that Anaconda packages aren't tested with this setup.
To create a shortcut/batch file to run the above command in Anaconda Prompt environment, see e.g. How to make batch files run in anaconda prompt.