From sandro.dentella at gmail.com Fri Feb 15 18:10:32 2019 From: sandro.dentella at gmail.com (Alessandro Dentella) Date: Sat, 16 Feb 2019 00:10:32 +0100 Subject: [IPython-dev] kernel spect and how to thest them Message-ID: <20190215231032.GA30925@bluff.e-den.it> Hi, I'd like to bettere understand "argv" list. It's the arguments passed to what exactely? -m and --ext are for python/ipython, who interprets -f? The setup ========= I have a django project whit a std virtualenv with a working kernel defined as follows: { "env": { "DJANGO_SETTINGS_MODULE": "web.settings", "PYTHONPATH": "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django" }, "argv": [ "/home/sandro/.virtualenvs/alma/bin/python3.6", "-m", "ipykernel_launcher", "-f", "{connection_file}", "--ext", "django_extensions.management.notebook_extension" ], "display_name": "Alma ", "language": "python" } >From a jupyter lab I can connect to that and it just works fine. In my normal setup I use buildout that means I have an "empty" vitualenv and a scipt that initializes the sys.path. So I tried to modify the configuration as follows: { "env": { "DJANGO_SETTINGS_MODULE": "web.settings", "PYTHONPATH": "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django/env" }, "argv": [ "/home/sandro/.virtualenvs/alma/bin/python3.6", "-m", "setup_jupyter", "-f", "{connection_file}", "--ext", "django_extensions.management.notebook_extension" ], "display_name": "Alma 2", "language": "python" } Where setup_jupiter is in PYTHONPATH and uses site.addsitedir(): import os import site site.addsitedir(os.path.dirname(__file__)) import ipykernel_launcher Question ======== But this modified kernel spec does not work (sys.path it's correclty setup due to a custom path.pth) Jupiter lab (run in a different virtualenv) complains: [I 20:07:27.618 LabApp] Kernel started: 11cc7c35-b88b-4f87-ad42-bdf85f28c352 [I 20:07:28.230 LabApp] KernelRestarter: restarting kernel (2/5), new random ports [I 20:07:31.236 LabApp] KernelRestarter: restarting kernel (3/5), new random ports [I 20:07:34.244 LabApp] KernelRestarter: restarting kernel (4/5), new random ports [W 20:07:37.249 LabApp] KernelRestarter: restart failed How can I debug what's wrong and particularly is there a way to start that particular kernel, based on those kernel spec alone? Sandro From takowl at gmail.com Sat Feb 16 05:46:39 2019 From: takowl at gmail.com (Thomas Kluyver) Date: Sat, 16 Feb 2019 10:46:39 +0000 Subject: [IPython-dev] kernel spect and how to thest them In-Reply-To: <20190215231032.GA30925@bluff.e-den.it> References: <20190215231032.GA30925@bluff.e-den.it> Message-ID: Hi Sandro, > I'd like to bettere understand "argv" list. It's the arguments passed to what exactely? To the operating system. It spawns a process with subprocess.Popen(), and those are the arguments for it. It's like running the command from a shell. > -m and --ext are for python/ipython, who interprets -f? The -f flag is for ipykernel, defined here: https://github.com/ipython/ipykernel/blob/34ca17011c1e79f65290b88f1deb18ac03e142af/ipykernel/kernelapp.py#L58 > How can I debug what's wrong and particularly is there a way to start that particular kernel, based on those kernel spec alone? Normally those 'restarting kernel' messages come with a traceback saying what went wrong. I'm not sure why they don't in your case. You can run a kernel through Jupyter by running 'jupyter kernel --kernel your-kernel-name' (where your-kernel-name is whatever you called the folder with kernel.json in). Alternatively, you can set the environment variables in your shell, join up argv with spaces, and run that in the shell. On Fri, 15 Feb 2019 at 23:10, Alessandro Dentella wrote: > Hi, > > I'd like to bettere understand "argv" list. It's the arguments passed > to what exactely? -m and --ext are for python/ipython, who interprets -f? > > The setup > ========= > > I have a django project whit a std virtualenv with a working kernel > defined as follows: > > { > "env": { > "DJANGO_SETTINGS_MODULE": "web.settings", > "PYTHONPATH": > "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django" }, > "argv": [ > "/home/sandro/.virtualenvs/alma/bin/python3.6", > "-m", > "ipykernel_launcher", > "-f", > "{connection_file}", > "--ext", > "django_extensions.management.notebook_extension" > ], > "display_name": "Alma ", > "language": "python" > } > > From a jupyter lab I can connect to that and it just works fine. > > In my normal setup I use buildout that means I have an "empty" > vitualenv and a scipt that initializes the sys.path. So I tried to > modify the configuration as follows: > > { > "env": { > "DJANGO_SETTINGS_MODULE": "web.settings", > "PYTHONPATH": > "$PYTHONPATH:/misc/src/hg/thunder/siti/alma/django/env" }, > "argv": [ > "/home/sandro/.virtualenvs/alma/bin/python3.6", > "-m", > "setup_jupyter", > "-f", > "{connection_file}", > "--ext", > "django_extensions.management.notebook_extension" > ], > "display_name": "Alma 2", > "language": "python" > } > > Where setup_jupiter is in PYTHONPATH and uses site.addsitedir(): > > import os > import site > site.addsitedir(os.path.dirname(__file__)) > import ipykernel_launcher > > Question > ======== > > But this modified kernel spec does not work (sys.path it's correclty > setup due to a custom path.pth) > > Jupiter lab (run in a different virtualenv) complains: > > [I 20:07:27.618 LabApp] Kernel started: > 11cc7c35-b88b-4f87-ad42-bdf85f28c352 > [I 20:07:28.230 LabApp] KernelRestarter: restarting kernel (2/5), new > random ports > [I 20:07:31.236 LabApp] KernelRestarter: restarting kernel (3/5), new > random ports > [I 20:07:34.244 LabApp] KernelRestarter: restarting kernel (4/5), new > random ports > [W 20:07:37.249 LabApp] KernelRestarter: restart failed > > > How can I debug what's wrong and particularly is there a way to start > that particular kernel, based on those kernel spec alone? > > Sandro > _______________________________________________ > IPython-dev mailing list > IPython-dev at python.org > https://mail.python.org/mailman/listinfo/ipython-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bussonniermatthias at gmail.com Wed Feb 20 21:00:17 2019 From: bussonniermatthias at gmail.com (Matthias Bussonnier) Date: Wed, 20 Feb 2019 18:00:17 -0800 Subject: [IPython-dev] IPython 7.4 out. Message-ID: See the full announce on discourse: https://discourse.jupyter.org/t/release-of-ipython-7-3/409 As usual available on PyPI, and on conda-forge. You can update with $ pip install ipython --upgrade And if you are using conda, once available on conda-forge: $ conda upgrade ipython The biggest update to this release is the addition of %conda and %pip magic that should ease the installation of packages in the current environment. If you are on the bleeding edge this also adds compatibility with Python 3.8. If you are looking to help for future 7.4 release, subscribe to this issue[1], I?ll update it with things you can help with. It is a great way to get started contributing. -- M 1: https://github.com/ipython/ipython/issues/11614 -------------- next part -------------- An HTML attachment was scrubbed... URL: From sandro at e-den.it Thu Feb 21 04:18:28 2019 From: sandro at e-den.it (Alessandro Dentella) Date: Thu, 21 Feb 2019 10:18:28 +0100 Subject: [IPython-dev] kernel spect and how to thest them In-Reply-To: References: <20190215231032.GA30925@bluff.e-den.it> Message-ID: <20190221091828.GA11372@bluff.e-den.it> Thank you Thomas for the explanations that helped me get to a working setup. Rather than settings python interpreter and invoking -m "argv": [ "/home/sandro/.virtualenvs/alma/bin/python3.6", "-m", "setup_jupyter", # this imports ipykernel_launcher "-f", "{connection_file}", "--ext", "django_extensions.management.notebook_extension" I ended with this setup: "argv": [ "/home/sandro/alma/bin/ipython", "kernel", "-f", "{connection_file}", "--ext", "django_extensions.management.notebook_extension" In my setup (I use buildout) bin/ipython is a script with the path explicitely declared and running: import IPython if __name__ == '__main__': sys.exit(IPython.start_ipython()) The reason I had to change this way is that ipykernel_launcher works only if called directly (as is the cas with -m flag since the code is in the "If __name__ == '__main__'" branch. If my operation is for some reason incorrect, please let me know. I got the impression the script jupyter should be used rather than ipython... sandro From sandro.dentella at gmail.com Thu Feb 21 04:28:28 2019 From: sandro.dentella at gmail.com (Alessandro Dentella) Date: Thu, 21 Feb 2019 10:28:28 +0100 Subject: [IPython-dev] many kernels, jupyter lab and resources Message-ID: <20190221092828.GA18912@bluff.e-den.it> Hi, As I started to use jupyter notebooks I added several kernels for different projects. Whe I start "jupyter lab" each kernel is started. Can I just start the kernel I want to use... I mean I'd like to have the icon to choose to open a notebook for that kernel but to start the kernel only if I click on the icon. How can I limit resources when they're not needed? sandro From cappy2112 at gmail.com Mon Feb 25 19:52:07 2019 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 25 Feb 2019 16:52:07 -0800 Subject: [IPython-dev] Jupyterlab Terminal launches Powershell instead of the Windows Cmd prompt Message-ID: I've just clicked on the "terminal" in JupyterLab, for the first time, and noticed that Powershell is launched instead of the cmd shell. Is this something that can be configured by the user? Powershell is pain to use and requires much more specialized knowledge than the cmd shell in Windows. Why was this decision made? Thanks Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: