DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
336 stars 34 forks source link

Error <!DOCTYPE HTML> when run cell (creating new notebook or using existed notebook) #36

Closed mysteriousHerb closed 7 years ago

mysteriousHerb commented 7 years ago

I have a feeling this has something to do with path.

Environment data

VS Code version: Jupyter Extension version: OS and version: windows 10

Logs

Output from Jupyter output panel

Output from Console window (Help->Developer Tools menu)

(<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">

    <title>Jupyter Notebook</title>
    <link rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=30780f272ab4aac64aa073a841546240">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />
    <link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="/static/style/style.min.css?v=f6c09475baf6beabd41f8fe518601204" type="text/css"/>

<style type="text/css">
/* disable initial hide */
div#header, div#site {
    display: block;
}
</style>

    <link rel="stylesheet" href="/custom/custom.css" type="text/css" />
    <script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>
    <script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>
    <script>
      require.config({

          urlArgs: "v=20170411094459",

          baseUrl: '/static/',
          paths: {
            'auth/js/main': 'auth/js/main.min',
            custom : '/custom',
            nbextensions : '/nbextensions',
            kernelspecs : '/kernelspecs',
            underscore : 'components/underscore/underscore-min',
            backbone : 'components/backbone/backbone-min',
            jquery: 'components/jquery/jquery.min',
            bootstrap: 'components/bootstrap/js/bootstrap.min',
            bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
            'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
            moment: 'components/moment/moment',
            codemirror: 'components/codemirror',
            termjs: 'components/term.js/src/term',
            typeahead: 'components/jquery-typeahead/dist/jquery.typeahead'
          },
      map: { // for backward compatibility
        "*": {
        "jqueryui": "jquery-ui",
        }
      },
          shim: {
            typeahead: {
              deps: ["jquery"],
              exports: "typeahead"
            },
            underscore: {
              exports: '_'
            },
            backbone: {
              deps: ["underscore", "jquery"],
              exports: "Backbone"
            },
            bootstrap: {
              deps: ["jquery"],
              exports: "bootstrap"
            },
            bootstraptour: {
              deps: ["bootstrap"],
              exports: "Tour"
            },
            "jquery-ui": {
              deps: ["jquery"],
              exports: "$"
            }
          },
          waitSeconds: 30,
      });

      require.config({
          map: {
              '*':{
                'contents': 'services/contents',
              }
          }
      });

      define("bootstrap", function () {
          return window.$;
      });

      define("jquery", function () {
          return window.$;
      });

      define("jqueryui", function () {
          return window.$;
      });

      define("jquery-ui", function () {
          return window.$;
      });
      // error-catching custom.js shim.
      define("custom", function (require, exports, module) {
          try {
              var custom = require('custom/custom');
              console.debug('loaded custom.js');
              return custom;
          } catch (e) {
              console.error("error loading custom.js", e);
              return {};
          }
      })
    </script>

</head>

<body class="" >

<noscript>
    <div id='noscript'>
      Jupyter Notebook requires JavaScript.<br>
      Please enable it to proceed.
  </div>
</noscript>

<div id="header">
  <div id="header-container" class="container">
  <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="/tree" title='dashboard'><img src='/static/base/images/logo.png?v=7c4597ba713d804995e8f8dad448a397' alt='Jupyter Notebook'/></a></div>

  </div>
  <div class="header-bar"></div>

</div>

<div id="site">

<div class="error">

    <h1>404 : Not Found</h1>

<p>You are requesting a page that does not exist!</p>

</header>

</div>

</body>

</html>)

Actual behavior

Expected behavior

Steps to reproduce:

-

DonJayamanne commented 7 years ago

What version of Jupyter are you using?

mysteriousHerb commented 7 years ago

Hi, Python 3.4.5 Jupyter 4.2.3 ipython 5.1.0

mysteriousHerb commented 7 years ago

I uninstall my jupyter notebook and pip install again. It works. Do not know what was the problem in first time.

gandhis1 commented 7 years ago

I still get this error even when uninstalling and re-installing Jupyter. My original post is here:

https://github.com/DonJayamanne/vscodeJupyter/issues/33#issuecomment-292750403

yiyang186 commented 7 years ago

I met the same case. When I disabled the extension, vscodeJupyter, it worked...== Then, I enabled... error... Then, I disabled... it worked... How crazy~

PS: I used Anaconda 4.3, python 3.6

deltaz0 commented 7 years ago

(Using VSCode with python and jupyter extensions and anaconda on Win10.)

In case it helps @gandhis1 or anyone else: I ran into this problem. For me, it was that I had set a password for my jupyter servers following this guide.

My generated configuration file was located in ~/.jupyter/jupyter_notebook_config.py and my password was set by the line in that file c.NotebookApp.password = u'sha1:(password hash)'

I commented out this line (you could also just delete the configuration file to use the default) and I can run the cells just fine now.

The "Error \<!DOCTYPE HTML>" in VSCode looks like it just means the extension got back something from jupyter that wasn't in the format it expected, so the password could be one of many things causing this issue. Most of these will probably be fixed by deleting the config file. Perhaps the extension could be updated to include a password option?

EDIT: Found an alternative solution if your issue was the password and you want to keep it. Add the following to User Settings in VSCode:

"jupyter.notebook.startupArgs": [
        "--NotebookApp.password=''",
        "--no-browser",
        "--port=8888",
        "--NotebookApp.allow_origin=\"*\""
      ]

This will make the jupyter extension in VScode run as if there was no password, but using jupyter outside of VSCode will continue to use the password in the config file.