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

Errors from the repo and also using the conda package... #21

Closed
damianavila opened this issue Nov 26, 2015 · 17 comments
Closed

Errors from the repo and also using the conda package... #21

damianavila opened this issue Nov 26, 2015 · 17 comments
Assignees

Comments

@damianavila
Copy link
Contributor

$ python -m nbpresent.install --prefix="${CONDA_ENV_PATH}" --enable
copying /media/data/devel/continuum/notebook/nbpresent/nbpresent/static/nbpresent/nbpresent.standalone.min.js -> /home/damian/miniconda3/envs/nbpresent/share/jupyter/nbextensions/nbpresent/nbpresent.standalone.min.js
copying /media/data/devel/continuum/notebook/nbpresent/nbpresent/static/nbpresent/nbpresent.min.css -> /home/damian/miniconda3/envs/nbpresent/share/jupyter/nbextensions/nbpresent/nbpresent.min.css
copying /media/data/devel/continuum/notebook/nbpresent/nbpresent/static/nbpresent/nbpresent.min.js -> /home/damian/miniconda3/envs/nbpresent/share/jupyter/nbextensions/nbpresent/nbpresent.min.js
copying /media/data/devel/continuum/notebook/nbpresent/nbpresent/static/nbpresent/nbpresent.notebook.min.js -> /home/damian/miniconda3/envs/nbpresent/share/jupyter/nbextensions/nbpresent/nbpresent.notebook.min.js
copying /media/data/devel/continuum/notebook/nbpresent/nbpresent/static/nbpresent/nbpresent.deps.min.js -> /home/damian/miniconda3/envs/nbpresent/share/jupyter/nbextensions/nbpresent/nbpresent.deps.min.js
Enabling for /home/damian/miniconda3/envs/nbpresent/etc/jupyter
Enabling nbpresent server component...
(nbpresent)damian-S400CA :: /media/data/devel/continuum/notebook/nbpresent :: (master)
$ jupyter notebook
[W 17:35:01.865 NotebookApp] Unrecognized JSON config file version, assuming version 1
[W 17:35:01.868 NotebookApp] Unrecognized JSON config file version, assuming version 1
[I 17:35:02.340 NotebookApp] The port 8888 is already in use, trying another random port.
[W 17:35:02.431 NotebookApp] Error loading server extension nbpresent
    Traceback (most recent call last):
      File "/home/damian/miniconda3/envs/nbpresent/lib/python3.4/site-packages/notebook/notebookapp.py", line 991, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/home/damian/miniconda3/envs/nbpresent/lib/python3.4/importlib/__init__.py", line 109, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
      File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
      File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
    ImportError: No module named 'nbpresent'
[I 17:35:02.449 NotebookApp] Serving notebooks from local directory: /media/data/devel/continuum/notebook/nbpresent
[I 17:35:02.450 NotebookApp] 0 active kernels 
[I 17:35:02.450 NotebookApp] The IPython Notebook is running at: http://localhost:8889/
[I 17:35:02.450 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Created new window in existing browser session.
[W 17:35:05.294 NotebookApp] 404 GET /clusters?_=1448570104770 (127.0.0.1) 16.59ms referer=http://localhost:8889/tree
[I 17:35:45.713 NotebookApp] Creating new notebook in 
[I 17:35:47.424 NotebookApp] Kernel started: ed8a9195-b0dc-48f9-bcd8-fb4deded1c39
[W 17:35:54.111 NotebookApp] 404 GET /static/components/backbone/backbone-min.map (127.0.0.1) 2.78ms referer=None
[I 17:36:06.322 NotebookApp] Kernel shutdown: ed8a9195-b0dc-48f9-bcd8-fb4deded1c39
[W 17:36:06.326 NotebookApp] delete /Untitled.ipynb

I have two error here:

  1. Unrecognized JSON config file version, assuming version 1
  2. ImportError: No module named 'nbpresent'

When I tried the conda package from anaconda.org/nbcio I am seeing 1 but not 2... but even with the conda package I can not see the extension...

Starting from the repo I followed the lines you sent in the email last week...

@bollwyvl

@damianavila
Copy link
Contributor Author

OK, the import error is fixed just running setup.py.... sorry about that noise...

But still have the other error... the Unrecognized JSON config file version, assuming version 1 and I can not see the extension...

@damianavila
Copy link
Contributor Author

I found that the json config file needs a version 1 key... but even with that... it is not loading the extension for me...

@damianavila
Copy link
Contributor Author

I also see the value to have all the "enabling" in the config.json, but if it not working reliable we should use the notebook.json for the js part and a python config file for the server part...

@bollwyvl
Copy link
Contributor

Sorry, been out doing family stuff all day.

Indeed, load_extensions has to be done in user, not prefix space, which is
likely the issue.

I've just about got nbbrowserpdf pulled out, and am working on getting that
conda-installable. Then i'll shift back to nbpresent, with lessons learned!

On Thu, Nov 26, 2015 at 4:46 PM Damián Avila [email protected]
wrote:

I also see the value to have all the "enabling" in the config.json, but if
it not working reliable we should use the notebook.json for the js part and
a python config file for the server part...


Reply to this email directly or view it on GitHub
#21 (comment)
.

@bollwyvl
Copy link
Contributor

So i've gone ahead and bundled pypdf2 and ghost.py with nbbrowserpdf via pip... should be a crop of linux64 builds for 2.7-3.5 up soon!

conda install -c nbcio nbbrowserpdf

It does the a conda_env_path install and a user-space enable, which is i guess what I am going to go to for nbpresent as well.

In the meantime, you can probably just...

jupyter nbextension enable nbpresent/nbpresent.min

@bollwyvl
Copy link
Contributor

Wow, that was hair-raising. Took a number of tries to get a real build up, but it appears to be good now.

I don't have a full handle on what parts are missing from the build environment that I can't actually run tests, namely:

ImportError: libXext.so.6: cannot open shared object file: No such file or directory

(from this build)

but it's good enough to move forward.

I may still owe myself a few extension points on the new thing in order to use it with nbpresent, but it seemed like something worth getting up and running in its own right. will update!

@bollwyvl
Copy link
Contributor

Oh, man. I didn't realize ConfigManager didn't handle lists gracefully. This is obviously creates a problem with server_extensions.

Right now, whoever gets installed last is the only server extension that gets loaded. Obviously this is no good.

I was trying to call jupyter nbextension enable, but it wasn't available inside the build environment, or rather, nbextension is not a jupyter command. I really don't want to go start hacking on the JSON by name.

@damianavila
Copy link
Contributor Author

I am working in a branch to deal with server_extension in the anaconda-notebook repo... I will ping you when I finish... I took a different approach that seems to work reliable... in the mean time, enjoy Thanksgiving time 😉

@bollwyvl
Copy link
Contributor

Sounds good... Working at the Day Job today, so it may be this evening or
tomorrow before i get to continue.

I think I've got my extension points squared away.... pdf_capture will
accept a --server-class, where one can overload specific features of the
asset preparation and actual screen shot/print mechanism. I'm also abusing
the heck out of multiple inheritance, which is kind of fun.

I'm still a little unsure how to talk about the optional dependency on
nbbrowserpdf: right now, it adds it to exporter_map if it can import the
base pdf exporter... Luckily, there is a rest service for what exporters
are available, so I'll be able to bridge the server_extension/nbextension
divide and give useful feedback if the optional dep not installed. Not the
greatest, but good enough!

On 07:31, Fri, Nov 27, 2015 Damián Avila [email protected] wrote:

I am working in a branch to deal with server_extension in the
anaconda-notebook repo... I will ping you when I finish... I took a
different approach that seems to work reliable... in the mean time, enjoy
Thanksgiving time [image: 😉]


Reply to this email directly or view it on GitHub
#21 (comment)
.

@damianavila
Copy link
Contributor Author

I am working in a branch

https://github.com/Anaconda-Server/anaconda-notebook/pull/64

I will comment on the other things later... enjoy your day!

@damianavila
Copy link
Contributor Author

Btw, for your info... installing with the conda packages, when I split the notebook_config_json into 2 config files (otherwise it does not load anything for me):

$ tree jupyter/
jupyter/
├── jupyter_notebook_config.py
├── migrated
└── nbconfig
    └── notebook.json

with the following content:

damian-S400CA :: ~/miniconda3/envs/nbpresent/etc :: 
$ cat jupyter/nbconfig/notebook.json 
{
  "load_extensions": {
    "nbpresent/nbpresent.min": true
  }
}
damian-S400CA :: ~/miniconda3/envs/nbpresent/etc :: 
$ cat jupyter/jupyter_notebook_config.py 
# Configuration file to enable conda_envs extension

c = get_config()

c.NotebookApp.server_extensions.append('nbpresent')

And starting the notebook with the correct JUPYTER_CONFIG_DIR I can see the static files loaded... but regrettably, I get this error in the js console:

Loaded extension: widgets/notebook/js/extension
:8889/nbextensions/widgets/notebook/js/extension.js?v=20151127161419:81 loaded widgets
nbpresent.notebook.min.js:23 Uncaught ReferenceError: d3 is not defined

Can it be possible some dependency problem?

@bollwyvl
Copy link
Contributor

Not sure what branch you were building from... #16 was open for too long, and gathered lots of pixie dust in addition to its baseline feature. Like not being broken.

I've merged #16, and done a 0.4.0 release of nbpresent and a 0.2.0 release of nbbrowserpdf.

I've also done the pip builds... it doesn't require pyqt or pyside, so it's not bulletproof there, but otherwise looking good.

I guess the full install would now be (once the build finishes:

conda install -c nbcio nbbrowserpdf nbpresent
python -m nbpresent.install --prefix=$CONDA_ENV_PATH --enable
python -m nbbrowserpdf.install --prefix=$CONDA_ENV_PATH --enable
jupyter notebook

or

pip install nbbrowserpdf nbpresent pyside # or pyqt
python -m nbpresent.install --user --enable
python -m nbbrowserpdf.install --user --enable
jupyter notebook

I really don't like editing a python file (or code as config, anyhow).... what do you think of how i've done this? Seems to work, and keeps everything in JSON where it can be reasoned about...

@damianavila
Copy link
Contributor Author

OK, several things...

I've merged #16, and done a 0.4.0 release of nbpresent and a 0.2.0 release of nbbrowserpdf.

Thanks!

I guess the full install would now be (once the build finishes:

Well... this is how I install it...

JUPYTER_CONFIG_DIR="$CONDA_ENV_PATH"/etc/jupyter conda install -c nbcio/channel/dev nbbrowserpdf nbpresent

In this way the config manager respect you config dir and you don't have to enable it with python -m nbpresent.install --prefix=$CONDA_ENV_PATH --enable

To solve this need I would use paths.ENV_CONFIG_PATH[0] instead of jupyter_config_dir() on this line: https://github.com/Anaconda-Server/nbpresent/blob/master/nbpresent/install.py#L64

With that change you should be able to install it without any env variable and you are contained in the conda enviroment... (maybe you can look for the paths.ENV_CONFIG_PATH[0] and use jupyter_config_dir() as the fallback value, I can submit a PR if you want).

To start the notebook properly, I had to do:

JUPYTER_CONFIG_DIR="$CONDA_ENV_PATH"/etc/jupyter jupyter notebook

otherwise, it will look into the user space...

This should be solved in some way upstream... you know... but for the time being is what we have...

I really don't like editing a python file (or code as config, anyhow).... what do you think of how i've done this? Seems to work, and keeps everything in JSON where it can be reasoned about...

OK... that's much better... I really like this pattern, now that I see it working properly... I will adjust the extension in the anaconda-notebook repo to replay this pattern... I believe is the correct way to do it...

@damianavila
Copy link
Contributor Author

With that change you should be able to install it without any env variable and you are contained in the conda enviroment... (maybe you can look for the paths.ENV_CONFIG_PATH[0] and use jupyter_config_dir() as the fallback value, I can submit a PR if you want).

I think I can create a customized conda packages with my patch applied on the conda recipe, but I would like to avoid that if possible 😉 because at the end I believe the config for a conda packaged-extensions should be in the environment...

@damianavila
Copy link
Contributor Author

I have opened two PRs: #22 and https://github.com/Anaconda-Server/nbbrowserpdf/pull/2

@bollwyvl
Copy link
Contributor

bollwyvl commented Dec 1, 2015

Merged those... I am good to close this now, and as the understanding evolves, we can revisit as needed!

@bollwyvl bollwyvl closed this as completed Dec 1, 2015
@damianavila
Copy link
Contributor Author

we can revisit as needed!

Yep, not the best solution but let's see how evolves... thanks!

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

2 participants