CermakM / jupyter-require

Jupyter nbextension for JavaScript execution and AMD dependency management.
MIT License
21 stars 7 forks source link

OSError: Jupyter Require found itself running outside of Jupyter. #19

Open gbonazzoli opened 4 years ago

gbonazzoli commented 4 years ago

Following the guide at: https://medium.com/@marekermk/take-a-better-look-at-the-pandas-dataframes-a8d6613a46a

After the command:

jupyter nbextension install --py jupyter_require

I get always the following error:

Jupyter Require found itself running outside of Jupyter.
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-nbextension", line 10, in <module>
    sys.exit(main())
  File "/Library/Python/3.7/site-packages/jupyter_core/application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Library/Python/3.7/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/Library/Python/3.7/site-packages/notebook/nbextensions.py", line 983, in start
    super(NBExtensionApp, self).start()
  File "/Library/Python/3.7/site-packages/jupyter_core/application.py", line 257, in start
    self.subapp.start()
  File "/Library/Python/3.7/site-packages/notebook/nbextensions.py", line 711, in start
    self.install_extensions()
  File "/Library/Python/3.7/site-packages/notebook/nbextensions.py", line 690, in install_extensions
    **kwargs
  File "/Library/Python/3.7/site-packages/notebook/nbextensions.py", line 206, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/Library/Python/3.7/site-packages/notebook/nbextensions.py", line 1117, in _get_nbextension_metadata
    m = import_item(module)
  File "/Library/Python/3.7/site-packages/traitlets/utils/importstring.py", line 42, in import_item
    return __import__(parts[0])
  File "/Library/Python/3.7/site-packages/jupyter_require/__init__.py", line 34, in <module>
    from .notebook import link_css
  File "/Library/Python/3.7/site-packages/jupyter_require/notebook.py", line 30, in <module>
    from .core import execute_with_requirements
  File "/Library/Python/3.7/site-packages/jupyter_require/core.py", line 279, in <module>
    require = RequireJS()
  File "/Library/Python/3.7/site-packages/jupyter_require/core.py", line 90, in __new__
    raise EnvironmentError(msg)
OSError: Jupyter Require found itself running outside of Jupyter.

Any ideas to solve the issue ?

CermakM commented 4 years ago

Hello and thank you for reporting it.

Are you running it in a Jupyter Notebook or Jupyter Lab? The extension is only compatible with Jupyter Notebooks.

Cheers, M

gbonazzoli commented 4 years ago

I know that is possible to run it only on the classical version.

I'm sorry, but I'm new to the Jupyter world. How can I be shure if I have the righe installation ?

What I can say to you is that I run both:

jupyter notebook

and

jupyter lab

from tha MAC OS command line in order to access them.

On Thu, Jan 2, 2020 at 2:29 AM Marek Čermák notifications@github.com wrote:

Hello and thank you for reporting it.

Are you running it in a Jupyter Notebook or Jupyter Lab? The extension is only compatible with Jupyter Notebooks.

Cheers, M

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CermakM/jupyter-require/issues/19?email_source=notifications&email_token=AEHLYDSGW6DXF2OFJGJJEATQ3WJUXA5CNFSM4KB7JL7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5ZC7Y#issuecomment-570134911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHLYDRQUG5ACEAJWTSTU5DQ3WJUXANCNFSM4KB7JL7A .

deeplook commented 4 years ago

I'm running into the same error. It would be nice to state in the docs that this works only for Jupyter classic notebooks, but not in Jupyter Lab, especially as Lab is increasingly superseeding classic notebook usage.

But, in fact, I've tried it now without lab, and get this when running execute_with_requirements(script, required=['d3']):

errback@http://localhost:8888/nbextensions/jupyter-require/core.js?v=20200102160426:190:29

I'm on macOS Mojave and Python 3.7 running a recent Jupyter...

CermakM commented 4 years ago

@gbonazzoli and @deeplook Thanks for the feedback! The README does say it's an nbextension, Jupyter Lab uses labextensions, which are different and also I always explicitly say jupyter notebook in the README. As Notebook and Lab have completely different frontend, the nbextensions do not work for both in most cases, unfortunately :worried:

If the error occurs in a notebook, please provide further information, like code samples, both Python and JS console logs and we can try to figure out what's wrong together.

Cheers, M