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

Jupyter subcommands broken #11

Closed
bnavigator opened this issue Oct 28, 2021 · 6 comments
Closed

Jupyter subcommands broken #11

bnavigator opened this issue Oct 28, 2021 · 6 comments

Comments

@bnavigator
Copy link
Contributor

So I have accepted and forwarded @schubi2's submit requests in d:l:p:jupyter. It broke a lot of packages down the tree.

With notebook still on u-a

$ ls -l /usr/bin/jupyter
lrwxrwxrwx 1 root root 4 25. Okt 16:46 /usr/bin/jupyter -> alts
$ ls -l /usr/bin/jupyter-notebook
lrwxrwxrwx 1 root root 34 22. Okt 00:00 /usr/bin/jupyter-notebook -> /etc/alternatives/jupyter-notebook
$ jupyter-notebook list
Currently running servers:
$ jupyter notebook list
Currently running servers:
$ 

With alts:

$ ls -l /usr/bin/jupyter
lrwxrwxrwx 1 root root 4 Oct 27 00:02 /usr/bin/jupyter -> alts
$ ls -l /usr/bin/jupyter-notebook
lrwxrwxrwx 1 root root 4 Oct 27 11:55 /usr/bin/jupyter-notebook -> alts
$ jupyter-notebook list
Currently running servers:
$ jupyter notebook list
$ 

no output here!
The command is not called at all, jupyter notebook should start a notebook server and launch a browser, but does nothing.

Looks like libalternatives can not handle the nested calling of subcommands.

I am going to revert all packages in d:l:p:jupyter. Please resubmit when you have a working and tested solution.

@bnavigator
Copy link
Contributor Author

Some debugging info:

[ben@skylab:~]% python3 -m pdb /usr/bin/jupyter-3.8 trust-3.8 --help                                                                                                                 [0]
> /usr/bin/jupyter-3.8(3)<module>()
-> import re
(Pdb) b os.py:591
Breakpoint 1 at /usr/lib64/python3.8/os.py:591
(Pdb) c
> /usr/lib64/python3.8/os.py(591)_execvpe()
-> exec_func(file, *argrest)
(Pdb) p exec_func, file, argrest
(<built-in function execv>, '/usr/bin/jupyter-trust-3.8', (['trust-3.8', '--help'],))
(Pdb) c
Sign one or more Jupyter notebooks with your key, to trust their dynamic (HTML,
Javascript) output.

Otherwise, you will have to re-execute the notebook to see output.

Options
-------

Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.

--reset
    Delete the trusted notebook cache.
    All previously signed notebooks will become untrusted.
--debug
    set log level to logging.DEBUG (maximize logging output)
--generate-config
    generate default config file
-y
    Answer yes to any questions instead of prompting.
--log-level=<Enum> (Application.log_level)
    Default: 30
    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
    Set the log level by value or name.
--config=<Unicode> (JupyterApp.config_file)
    Default: ''
    Full path of a config file.

To see all available configurables, use `--help-all`

Examples
--------

    jupyter trust mynotebook.ipynb and_this_one.ipynb

[ben@skylab:~]% python3 -m pdb /usr/bin/jupyter-3.8 trust --help                                                                                                                     [0]
> /usr/bin/jupyter-3.8(3)<module>()
-> import re
(Pdb) b os.py:591
Breakpoint 1 at /usr/lib64/python3.8/os.py:591
(Pdb) c
> /usr/lib64/python3.8/os.py(591)_execvpe()
-> exec_func(file, *argrest)
(Pdb) p exec_func, file, argrest
(<built-in function execv>, '/usr/bin/jupyter-trust', (['trust', '--help'],))
(Pdb) c
[ben@skylab:~]%                                                                                                                                                                    [255]

Note the error code 255 in the end after calling execv()

@schubi2
Copy link
Contributor

schubi2 commented Oct 29, 2021

It seems not to be the "argv0" problem:
See https://build.opensuse.org/request/show/927749

@bnavigator
Copy link
Contributor Author

It is an argv0 problem, just in a different way than #7. When alts is called, with argv[0]='notebook', it does not know that this is meant to be 'jupyter-notebook' and does not even read the correct config file.

@AdamMajer
Copy link
Member

Correct. If argv0 is /path/something, it will then go via /usr/share/libalternatives/something/` data. If argv0 != binary_name, then there is really no way to know how the program was executed and so then this can't really work anymore.

@bnavigator
Copy link
Contributor Author

IMHO this has to be documented very excplicitly. You can only convert a package to using libalternatives, when you can guarantee that nothing calls the executable with argv[0] != binary_name. Something you actually can never guarantee.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 29, 2021
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 29, 2021
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 29, 2021
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 31, 2021
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 31, 2021
@bnavigator
Copy link
Contributor Author

Closed by jupyter/jupyter_core#248 and sr#931172

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Nov 15, 2021
https://build.opensuse.org/request/show/931208
by user bnavigator + dimstar_suse
- Update to 4.9.1
  * Add Python site user base subdirectories to config and data
    user-level paths if site.ENABLE_USER_SITE is True. One way to
    disable these directory additions is to set the
    PYTHONNOUSERSITE environment variable. These locations can be
    customized by setting the PYTHONUSERBASE environment variable.
  * Add a workaround for virtualenv for getting the user site
    directory.
- Patch for solving gh#openSUSE/libalternatives#11:
  argv0_subcommand.patch
  This patch can be removed while releasing version >4.9.1.
- Enabled using libalternatives again.
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

3 participants