peteut / ipython-file-upload

IPython file upload widget. Now obsolete, refer to widgets.https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#File-Upload
33 stars 11 forks source link

Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension" #7

Closed den-run-ai closed 8 years ago

den-run-ai commented 8 years ago

!jupyter nbextension enable --py --sys-prefix widgetsnbextension

Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: ok
def _upload():

    _upload_widget = fileupload.FileUploadWidget()

    def _cb(change):
        decoded = io.StringIO(change['owner'].data.decode('utf-8'))
        filename = change['owner'].filename
        print('Uploaded `{}` ({:.2f} kB)'.format(
            filename, len(decoded.read()) / 2 **10))

    _upload_widget.observe(_cb, names='data')
    display(_upload_widget)

_upload()
Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"
peteut commented 8 years ago

@denfromufa Did you install the widget prior usage w/ import fileupload; fileupload.nbinstall()? I'm relying on install_nbextension to install it. The relevant code is here.

den-run-ai commented 8 years ago

once I reloaded notebook and jupyter localhost server the _upload() does not generate anything. I'm using Yandex.Browser (enhanced Chromium).

here is the output of !pip install -U fileupload which shows that all requirements were satisfied:

Requirement already up-to-date: fileupload in c:\python\python27_32b\lib\site-packages
Requirement already up-to-date: ipywidgets>=4.0 in c:\python\python27_32b\lib\site-packages (from fileupload)
Requirement already up-to-date: notebook>=4.0 in c:\python\python27_32b\lib\site-packages (from fileupload)
Requirement already up-to-date: traitlets>=4.0 in c:\python\python27_32b\lib\site-packages (from fileupload)
Requirement already up-to-date: ipython>=4.0.0 in c:\python\python27_32b\lib\site-packages (from ipywidgets>=4.0->fileupload)
Requirement already up-to-date: ipykernel>=4.2.2 in c:\python\python27_32b\lib\site-packages (from ipywidgets>=4.0->fileupload)
Requirement already up-to-date: widgetsnbextension>=1.2.2 in c:\python\python27_32b\lib\site-packages (from ipywidgets>=4.0->fileupload)
Requirement already up-to-date: tornado>=4 in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: jupyter-client in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: nbformat in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: jupyter-core in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: nbconvert in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: ipython-genutils in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: jinja2 in c:\python\python27_32b\lib\site-packages (from notebook>=4.0->fileupload)
Requirement already up-to-date: pickleshare in c:\python\python27_32b\lib\site-packages (from ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: simplegeneric>0.8 in c:\python\python27_32b\lib\site-packages (from ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: backports.shutil-get-terminal-size in c:\python\python27_32b\lib\site-packages (from ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: decorator in c:\python\python27_32b\lib\site-packages (from ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: setuptools>=18.5 in c:\python\python27_32b\lib\site-packages\setuptools-21.0.0-py2.7.egg (from ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: pygments in c:\python\python27_32b\lib\site-packages (from nbconvert->notebook>=4.0->fileupload)
Requirement already up-to-date: mistune!=0.6 in c:\python\python27_32b\lib\site-packages (from nbconvert->notebook>=4.0->fileupload)
Requirement already up-to-date: entrypoints in c:\python\python27_32b\lib\site-packages (from nbconvert->notebook>=4.0->fileupload)
Requirement already up-to-date: MarkupSafe in c:\python\python27_32b\lib\site-packages (from jinja2->notebook>=4.0->fileupload)
Requirement already up-to-date: pathlib2 in c:\python\python27_32b\lib\site-packages (from pickleshare->ipython>=4.0.0->ipywidgets>=4.0->fileupload)
Requirement already up-to-date: configparser in c:\python\python27_32b\lib\site-packages (from entrypoints->nbconvert->notebook>=4.0->fileupload)
Requirement already up-to-date: six in c:\python\python27_32b\lib\site-packages (from pathlib2->pickleshare->ipython>=4.0.0->ipywidgets>=4.0->fileupload)
den-run-ai commented 8 years ago

@peteut which widget you mean?

peteut commented 8 years ago

@denfromufa fileupload is a simple python package, the example shows a simple use case. fileupload.nbinstall() needs to be invoked once to get the JS file installed. Is there a better way to get the JS file installed?

den-run-ai commented 8 years ago

@peteut I followed your installation steps including fileupload.nbinstall() but still got the issues listed above.

https://github.com/peteut/ipython-file-upload/blob/master/README.rst

peteut commented 8 years ago

@denfromufa I tested it on Debian GNU/Linux for now, what platform are you on?

den-run-ai commented 8 years ago

Python 2.7.11 |Anaconda 4.0.0 (32-bit)| (default, Mar 4 2016, 15:18:41) [MSC v.1500 32 bit (Intel)] Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.

On Tue, May 3, 2016 at 5:04 PM, Alain Péteut notifications@github.com wrote:

@denfromufa https://github.com/denfromufa I tested it on Debian GNU/Linux for now, what platform are you on?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/peteut/ipython-file-upload/issues/7#issuecomment-216678633

den-run-ai commented 8 years ago

this widget is working great for me, like it did ~ year ago:

https://github.com/ipython/ipywidgets/blob/master/docs/source/examples/File%20Upload%20Widget.ipynb

I think your package fileupload is over-complicating something!

On Tue, May 3, 2016 at 5:06 PM, Denis Akhiyarov denis.akhiyarov@gmail.com wrote:

Python 2.7.11 |Anaconda 4.0.0 (32-bit)| (default, Mar 4 2016, 15:18:41) [MSC v.1500 32 bit (Intel)] Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.

On Tue, May 3, 2016 at 5:04 PM, Alain Péteut notifications@github.com wrote:

@denfromufa https://github.com/denfromufa I tested it on Debian GNU/Linux for now, what platform are you on?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/peteut/ipython-file-upload/issues/7#issuecomment-216678633

jcb91 commented 8 years ago

@peteut you might want to add support for the new (jupyter 4.2) method for javascript installation as well as retaining a more universal version (see, e.g. this page on readthedocs)

It seems fairly clear that the issue is whether the javascript is being copied to the correct directory for the server to find it.

@denfromufa do you get any output from fileupload.nbinstall()? Are there any notebook server logs (particularly when running notebook with the --debug flag)?

peteut commented 8 years ago

@jcb91 Thanks for the hint, this is the way to go.

peteut commented 8 years ago

master is now updated to use ipywidgets>=5.1.

den-run-ai commented 8 years ago

@jcb91 @peteut latest fixes worked great! also had to use "sudo" system python.

https://github.com/peteut/ipython-file-upload/issues/13