I'm trying to update some build scripts for a virtual machine and have a handful of questions about changes going from IPython 3 notebooks to Jupyter:1) in my IPython build, I had a py file in a user profile /startup dir that loads some packages, %matplotlb inline etc into each python notebook on startup. Can I continue to use this file? Where should I put it?
2) in my IPython build, I preinstalled several extensions using a custom.js script - can I continue to use this or a modified version of it? Where should it go?
3) in my IPython build, I had a load of stuff in a user /custom folder (custom.js to autoload extensions, custom.css to style the notebooks, some image various, export templates etc). Can I continue to use these or a modified version of them? Where do they go? Can I move everything to ~/.jupyter/custom/ and expect it to work?
--thankstony
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/ff2b7904-7f31-4b5e-ad7b-801c9d8aa03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
1) in my IPython build, I had a py file in a user profile /startup dir that loads some packages, %matplotlb inline etc into each python notebook on startup. Can I continue to use this file? Where should I put it?There has been no change in IPython startup files, they continue to work in IPython profiles.
2) in my IPython build, I preinstalled several extensions using a custom.js script - can I continue to use this or a modified version of it? Where should it go?Yes, you can. custom.js now lives in ~/.jupyter/custom/custom.js, but its behavior is otherwise the same.
3) in my IPython build, I had a load of stuff in a user /custom folder (custom.js to autoload extensions, custom.css to style the notebooks, some image various, export templates etc). Can I continue to use these or a modified version of them? Where do they go? Can I move everything to ~/.jupyter/custom/ and expect it to work?
Extra Javascript, frontend resources, etc. should generally go in nbextensions folder (see `jupyter nbextension install`). This has not changed from IPython 2 or 3, other than the name for installing them (formerly `ipython install-nbextension`). I'm not sure how you got export templates in the static/custom directory, or how they could be used once there. How did that work, exactly?
jupyter_dir = os.path.dirname(jupyter.__file__) custom_css_filepath = jupyter_dir + '/notebook/static/custom/custom.css' which looks far from ideal?! |
On Wed, Oct 28, 2015 at 7:32 PM, Tony Hirst <tony....@gmail.com> wrote:
Thanks for that...1) in my IPython build, I had a py file in a user profile /startup dir that loads some packages, %matplotlb inline etc into each python notebook on startup. Can I continue to use this file? Where should I put it?There has been no change in IPython startup files, they continue to work in IPython profiles.My understanding was that Jupyter doesn't do user profiles.What I want to do is just run:jupyter notebookand have the startup files preload. (I'm happy to dump the idea of profiles / different setups for different users altogether.)
Correct, Jupyter (the notebook server) doesn’t use profiles, but IPython (the Python kernel, where your code runs) still does. So anything in your profile_default/startup will still run when you start your IPython kernels.
I guess I was hoping for something like:JUPYTERCONFIGDIR=$(/usr/local/bin/jupyter --config-dir)STARTUP=$JUPYTERCONFIGDIR/startupmkdir -p $STARTUPcp $CUSTOMFILES/startup_script.ipy $STARTUP/startup_script.ipy
There’s no migration because the files in the original locations are still used. No changes are needed. The original startup files still have the same effect they always have.
Alternatively, a simple worked example showing how to migrate from something like:ipython3 notebook --profile myprofile --ip 0.0.0.0to something including:jupyter notebookthat has the same effect.
If you want to use multiple IPython profiles with the notebook, you can do this with kernelspecs. You can make copies of the default IPython kernelspec and add --profile=foo
to the argv
list that’s used to start the kernel.
What’s important the is that the notebook server configuration shouldn’t be related to the IPython kernel config. You can use many different Kernel configs with one notebook server config, and vice versa.
2) in my IPython build, I preinstalled several extensions using a custom.js script - can I continue to use this or a modified version of it? Where should it go?Yes, you can. custom.js now lives in ~/.jupyter/custom/custom.js, but its behavior is otherwise the same.Ah - ok..Hmm..from jupyter_core.paths import jupyter_config_dir, jupyter_data_dirjupyter_config_dir()-> /root/.jupyter!ls /root/.jupyter/custom/-> custom.css custom.js [as used w/ ipython custom/ previously]But it doesn't seem to be picked up at all. Notebooks show a default http://127.0.0.1:8888/custom/custom.cssAnd the custom.js doesn't appear to have done anything?Not sure if there are any log files I can check anywhere?
Hm, might be some caching. You can try running the notebook with --debug
, and also try refreshing the custom.css URL in an Incognito tab to clear the cache.
3) in my IPython build, I had a load of stuff in a user /custom folder (custom.js to autoload extensions, custom.css to style the notebooks, some image various, export templates etc). Can I continue to use these or a modified version of them? Where do they go? Can I move everything to ~/.jupyter/custom/ and expect it to work?Extra Javascript, frontend resources, etc. should generally go in nbextensions folder (see `jupyter nbextension install`). This has not changed from IPython 2 or 3, other than the name for installing them (formerly `ipython install-nbextension`). I'm not sure how you got export templates in the static/custom directory, or how they could be used once there. How did that work, exactly?The way I installed the extensions previously was to use a customised custom/custom.js including bits like:// activate extensions only after Notebook is initializedrequire(["base/js/events"], function (events) {$([IPython.events]).on("app_initialized.NotebookApp", function () {/* load your extension here */IPython.load_extensions('codefolding/main');IPython.load_extensions('rubberband/main');IPython.load_extensions('exercise/main');#....});I'm basically trying to put together some puppet and shell scripts that will build a VM containing customised jupyter notebooks and a raft of other things that can then be given to remote students and will run for them fully customised from the start.
That custom.js should work the same, I’m not sure why it isn’t getting picked up. The only difference is where the extensions are installed. Migration should have taken care of moving them to the right place. You can check with ls $(jupyter --data-dir)/nbextensions
.
--The export template thing... erm... ah -my mistake - it was actually a py file stored in custom/ that was used by an extension that made a custom nbconvert call.-MinRK--thankstony
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/ff2b7904-7f31-4b5e-ad7b-801c9d8aa03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/6dfc9a12-3e88-4767-a91f-d24efad21b0b%40googlegroups.com.
$([IPython.events]).on("notebook_loaded.Notebook", function ()
can you share the code of your extensions ?
The message also likely give you a file and line number for this error.
in you case, likely
define([‘base/js/namespace’,’notebook/js/textcell’], function(IPython, text_mod){
var MarkdownCell = text_mod.MarkdownCell
...
})
IT might be but you might be subject to race condition where it might not work if your machine is under heavy load, or only work if your machine is under heavy load.
Yes it would make sens, but it’s extremely sensitive to developer time, and it’s really hard to make a changeling with all the needed change.
Also we are a bit afraid of committing to that as we **know** it will change again in many way. We are not JS developers and me made a lot of bad design decision.
I’ve written some things that are mostly not too wrong on how JS extension work:
https://carreau.gitbooks.io/jupyter-book/content/
Thug it needs update and would greatly benefit from a rewriting and being moved to the official docs.
Hope that’s help.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/c8021198-cfeb-463e-a01a-36dc04bdcf58%40googlegroups.com.
On Oct 30, 2015, at 18:30, Tony Hirst <tony....@gmail.com> wrote:Hi Matthias
can you share the code of your extensions ?
The message also likely give you a file and line number for this error.The warning is to elsewhere...?Run oustyle_notebook27 namespace.js:21 accessing `MarkdownCell` is deprecated. Use `require("notebook/js/textcell").MarkdownCell`utils.js:21 Loaded extension: jupyter_activityCodeCellutils.js:23 Uncaught TypeError: Cannot read property 'load_ipython_extension' of undefined
in you case, likely
define([‘base/js/namespace’,’notebook/js/textcell’], function(IPython, text_mod){
var MarkdownCell = text_mod.MarkdownCell
...
})what does text_mod relate to?
IT might be but you might be subject to race condition where it might not work if your machine is under heavy load, or only work if your machine is under heavy load.ok - I have encountered races before but thought I'd sorted those...Yes it would make sens, but it’s extremely sensitive to developer time, and it’s really hard to make a changeling with all the needed change.
I appreciate that, but as someone trying to promote the use of notebooks in an institution that supports distance education students, we develop courses over an 18 month period and have software freezes a couple of months before student use, which could then last up to a year. Trying to update software on a 6 monthly basis during production, and now trying to fix a final release, creates considerable problems when trying to get stuff working, especially without internal developer support, when there are no current references.... (as has been pointed out to me before, stuff on the web on stack overflow and in old github issue threads is often flakey - not least when the underlying model is also subject to change.
I hugely appreciate all the work that's going on in the Jupyter project, but for those of us not active in the development conversations (and who are not developers), trying to find ways of using the notebooks and customising them for student use, it can also be a hugely time consuming and frustrating experience that a working reference to base things on would mitigate!;-) (Once again, I don't want to come across as negative - just saying that enthusiastic users also suffer from time constraints and error message pain!;-)
Also we are a bit afraid of committing to that as we **know** it will change again in many way. We are not JS developers and me made a lot of bad design decision.Which maybe compounds user issues when there are no exemplar, simple working examples, no matter how horrible the js?! (I shared mine above - I make no claims about it other that it seems to do what I need. I was hoping that I could just do a function working proof of concept and our institutional devs would take it as spec they could build something of production quality around, but it's not worked out like that!)
I’ve written some things that are mostly not too wrong on how JS extension work:
https://carreau.gitbooks.io/jupyter-book/content/
Thug it needs update and would greatly benefit from a rewriting and being moved to the official docs.
Hope that’s help.Thanks... if I can find ways of contributing back too, even in terms of simple write ups that could act as a starting point for further docs, I will.. time allowing!