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

Fix "-m jupyter [console|notebook|...]" so that it works on Windows #505

Open
ksamuel opened this issue May 13, 2020 · 1 comment
Open

Comments

@ksamuel
Copy link

ksamuel commented May 13, 2020

Using -m is the only realiable way to run command line tools written in Python outside of a virtualenv. Without it, people may end up with PATH issues and won't know which interpretter is used by the program.

python -m jupyter console|notebook|... works fine on Linux, but trying to do it in Windows results in an error:

C:\Users\user>py -m jupyter console
...
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\jupyter_core\command.py", line 133, in _jupyter_abspath
    raise Exception(
Exception: Jupyter command `jupyter-console` not found.

Of course, if you use manually jupyter-console.exe, it works:

C:\Users\user>C:\Users\user\AppData\Roaming\Python\Python38\Scripts\jupyter-console.exe
Jupyter console 6.1.0

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.14.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

In fact, you can call jupyter itself without any problem, just not any subcommand:

C:\Users\user>py -m jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.3
ipython          : 7.14.0
ipykernel        : 5.2.1
jupyter client   : 6.1.3
jupyter lab      : not installed
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3

The tests are here on Windows 10, Python 3.8.2 and pip 19.2.3, but I don't know any version that is not affected.

jupyter is probably one of the most popular command line tool installed, with black, pylint, mypy, pytest and flake8. All the later allow -m to work on all plateforms.

This makes explaining how to install and use python tooling very easy, except for jupyter, for which we have to add the instruction to fiddle with the system PATH, to use directly the exe, or anaconda, which all come with a different set of problems.

@ivanov
Copy link
Member

ivanov commented Dec 12, 2023

@ksamuel Sorry it took so many years to get here, but is the issue that we are missing .exe at the end on windows, and that if we were to add that then the subcommand would launch successfully? I don't have access to a windows machine right now, but have you tried either editing the python code to accomplish this, or even possibly hack around it by launching

python -m jupyter console.exe

to see if that gets things going properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants