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

upgraded to atom 1.2.0, hydrogen now failing - Failed to activate the Hydrogen package #135

Closed
sbromberger opened this issue Nov 16, 2015 · 27 comments

Comments

@sbromberger
Copy link

Atom Version: 1.2.0
System: Mac OS X 10.10.5
Thrown From: Hydrogen package, v0.6.5

Stack Trace

Failed to activate the Hydrogen package

At Could not find module root given file: "undefined". Do you have a `package.json` file? 

Error: Could not find module root given file: "undefined". Do you have a `package.json` file? 
    at Function.getRoot (/Users/me/.atom/packages/Hydrogen/node_modules/zmq/node_modules/bindings/bindings.js:159:13)
    at bindings (/Users/me/.atom/packages/Hydrogen/node_modules/zmq/node_modules/bindings/bindings.js:55:32)
    at Object.<anonymous> (/Users/me/.atom/packages/Hydrogen/node_modules/zmq/lib/index.js:6:30)
    at Module._compile (module.js:434:26)
    at Object.defineProperty.value [as .js] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:190:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/me/.atom/packages/Hydrogen/node_modules/zmq/index.js:2:18)

Commands

     -0:24.2.0 grammar-selector:show (atom-text-editor.editor.is-focused)
  2x -0:22.5.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:21.5.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:18.2.0 core:backspace (atom-text-editor.editor.is-focused)
  2x -0:17.4.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:14 settings-view:check-for-package-updates (atom-workspace.workspace.scrollbars-visible-always.theme-atom-light-syntax.theme-unity-ui)
  3x -0:04.4.0 core:move-up (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:01.1.0 hydrogen:run (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "unity-ui",
      "atom-light-syntax"
    ],
    "ignoredNames": [
      ".git .DS_Store .pyc"
    ],
    "projectHome": "/Users/me/dev"
  }
}

Installed Packages

# User
Hydrogen, v0.6.5
language-julia, v0.4.1
minimap, v4.16.0
minimap-git-diff, v4.1.8
minimap-linter, v1.0.0
open-recent, v4.0.1
project-manager, v2.6.5
the-closer, v0.6.0
unity-ui, v2.1.2

# Dev
No dev packages

I tried apm rm hydrogen; apm install hydrogen but no luck.

@Andy-P
Copy link

Andy-P commented Nov 16, 2015

I am having the same issue

@JeremyCavanagh
Copy link

Me too!

@Hurtak
Copy link

Hurtak commented Nov 16, 2015

[Enter steps to reproduce below:]

  1. javscript file with following code var x = 5 + 5;
  2. use hydrogen keyboard shortcut on this line ctrl + alt + enter

Atom Version: 1.2.0
System: Microsoft Windows 10 Home
Thrown From: Hydrogen package, v0.6.5

Stack Trace

Failed to activate the Hydrogen package

At Could not find module root given file: "undefined". Do you have a `package.json` file? 

Error: Could not find module root given file: "undefined". Do you have a `package.json` file? 
    at Function.getRoot (C:\Users\Petr\.atom\packages\Hydrogen\node_modules\zmq\node_modules\bindings\bindings.js:159:13)
    at bindings (C:\Users\Petr\.atom\packages\Hydrogen\node_modules\zmq\node_modules\bindings\bindings.js:55:32)
    at Object.<anonymous> (C:\Users\Petr\.atom\packages\Hydrogen\node_modules\zmq\lib\index.js:6:30)
    at Module._compile (module.js:434:26)
    at Object.defineProperty.value [as .js] (C:\Users\Petr\AppData\Local\atom\app-1.2.0\resources\app.asar\src\compile-cache.js:190:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\Petr\.atom\packages\Hydrogen\node_modules\zmq\index.js:2:18)

Commands

     -0:04.4.0 hydrogen:run (atom-text-editor.editor.is-focused)
     -0:03.6.0 core:move-down (atom-text-editor.editor.is-focused)
     -0:03.3.0 core:move-up (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "about",
      "metrics",
      "timecop",
      "package-generator",
      "welcome",
      "linter-eslint",
      "minimap"
    ],
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  }
}

Installed Packages

# User
color-picker, v2.0.13
git-log, v0.4.1
Hydrogen, v0.6.5
linter, v1.11.1
linter-csslint, v1.1.0
linter-less, v2.2.0
linter-lesshint, v1.2.0
linter-xo, v0.9.0
minimap-find-and-replace, v4.3.2
minimap-git-diff, v4.1.8
minimap-highlight-selected, v4.3.1
minimap-linter, v1.0.0
minimap-selection, v4.3.1

# Dev
No dev packages

@willwhitney
Copy link
Collaborator

Sorry I haven't looked at this yet, I'm super slammed today. I'll dig into this tomorrow if nobody has written a PR to fix it before then.

@n-riesco
Copy link
Collaborator

The problem seems to be in the bindings package. More specifically, in the getFileName() function. This function relies on Error.captureStackTrace() calling Error.prepareStackTrace(). This doesn't happen with Atom v1.2.0.

The next thing I would investigate is why this behaviour has changed in Atom v1.2.0.

@aomader
Copy link

aomader commented Nov 17, 2015

Should be related to the upgrade from node v3.1 to v4.1.1, as described in the announcement for Atom 1.2.

@n-riesco
Copy link
Collaborator

It looks like Atom has made Error.prepareStackTrace read-only:

atom/atom@c36b4bd

@JeremyCavanagh
Copy link

Hi Will,
No big panic, I'm sure you're busy elsewhere. Just to let you know that
your package is a great contribution to the Julia/atom community,
particularly people like me who are at their early learning stages.

Thanks for your great efforts.

On 16/11/2015 21:05, Will Whitney wrote:

Sorry I haven't looked at this yet, I'm super slammed today. I'll dig
into this tomorrow if nobody has written a PR to fix it before then.


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

@willwhitney
Copy link
Collaborator

@JeremyCavanagh thanks for the support! I'm working on getting this fixed.

@n-riesco we may have to think about a new ZMQ solution for jmp. I don't know what that looks like right now.

@rgbkrk any suggestions?

@n-riesco
Copy link
Collaborator

@willwhitney My understanding is that the installation problem in Atom v1.2.0 is caused by the bindings package, not zmq. I'm trying to get the issue atom/atom#9660 reopened.

I don't see a quick solution to replacing zmq. One possibility would be a websocket-zmq bridge. I once asked @minrk about it (see https://groups.google.com/d/msg/jupyter/JPlrh2XHxB8/4u9rMYbrBAAJ ) and he mentioned the notebook server already has the functionality. We could ask him whether he thinks it's feasible to have this code as an npm package.

@danielchen26
Copy link

Dear all, has this issue been resolved?

@radix
Copy link
Contributor

radix commented Nov 19, 2015

Is anyone aware of a way to revert to an old version of atom in order to work around this problem? I really need Hydrogen to record some screencasts.

@minrk
Copy link

minrk commented Nov 19, 2015

If you'd rather connect to the notebook server from a websocket instead of zmq, we're in the midst of building npm packages for the web API provided by that application. You can try jupyter-js-services, which is the most basic part of it, but it only just became relatively complete and probably isn't super stable yet.

It doesn't make much sense to provide the zmq-websocket bridge itself as an npm package, since it's all Python.

@themiguelamador
Copy link

I revert to Atom 1.1
You can still use same .atom folder, so everything keeps the same.


just download the source code zip of the release you want: this case 1.1

cd to download folder of atom 1.1

and run on Mac:

script/build --install-dir /Applications/Atom_Source1_1.app

Note: name the app and final directory as you wich. Check code for build in other OS.

More info in build in https://github.com/atom/atom/tree/master/docs/build-instructions

Had to download the source zip, as using git and chekout kept me building version 1.4.

@willwhitney
Copy link
Collaborator

@n-riesco thanks for your work on this!

Switching over to jupyter-js-services or something similar (maintained by Jupyter, with a stable API, etc) is probably the long-term answer, but hopefully we can get the issue with Atom resolved. It sounds like a change Atom made has been causing issues for others as well.

It looks like for the moment reverting is the only workaround, but I expect to have a better answer shortly.

@gnestor
Copy link

gnestor commented Nov 23, 2015

@minrk I tried sub-ing jupyter-js-services in for jupyter-kernel-launcher for this package and atom-notebook and I am running into a CORS issue.

jupyter notebook:

[W 14:20:36.849 NotebookApp] Blocking Cross Origin API request.  Origin: file://, Host: localhost:8888
[W 14:20:36.862 NotebookApp] 404 POST /api/kernels (::1) 13.12ms referer=None

jupyter-js-services:
POST http://localhost:8888/api/kernels 404 (Not Found)

This seems like an issue specific to Atom as the requests are originating from Node and not the browser. Is it possible to use jupyter-js-services within Atom? Would the package need to run a server in order to communicate with the notebook server?

See my fork of atom-notebook: gnestor/atom-notebook@86445b3

There seems to be some relevant discussion here: https://github.com/jupyter-incubator/kernel_gateway/wiki/notebook_kernel_gateway

@gnestor
Copy link

gnestor commented Nov 24, 2015

@willwhitney @n-riesco I've mostly migrated(1) atom-notebook from jupyter-kernel-launcher to jupyter-js-services. That means that it no longer depends on jmp, zmq, bindings, etc. It works fine in Atom >=1.2.

@minrk I was able to fix the CORS issue (by following the docs and adding XMLHttpRequest and ws to globals...can you explain how that works?) so now atom-notebook is successfully communicating with jupyter notebook and jupyter kernelgateway. However, I'm only receiving "execute_input" and "status" messages (no "execute_result"). Any idea why that may be?

  1. It requires that you run a jupyter notebook or kernelgateway server yourself (although we can easily spawn a server from inside the package) and I'm not receiving "execute_result" messages yet...

@rgbkrk
Copy link
Member

rgbkrk commented Nov 24, 2015

Now that you've got atom notebook working with the js packages, feel free to submit a PR and I'll happily merge it on in and add you to the repo.

@gnestor
Copy link

gnestor commented Nov 24, 2015

@rgbkrk @willwhitney 2 things before I submit a PR:

  • Can you take a look at the fork and try to understand why it's not receiving "execute_result" messages?
  • How would you start jupyter notebook or kernelgateway server instance from inside the package? Something as simple as:
// Inside main.activate
let spawn = require('child_process').spawn;
this.kernelGateway = spawn('jupyter kernelgateway');
this.kernelGateway.on('exit', function (code) {
  console.log('kernelGateway.exit '+code);
});
this.kernelGateway.stdout.on('data', function (data) {
  console.log('kernelGateway.stdout  ' + data);
});
this.kernelGateway.stderr.on('data', function (data) {
  console.log('kernelGateway.stderr ' + data);
});
this.kernelGateway.on('close', function (code) {
  console.log('kernelGateway.close ' + code);
});

// Inside main.deactivate
this.kernelGateway.stdin.pause();
this.kernelGateway.kill();

@gnestor
Copy link

gnestor commented Nov 24, 2015

BTW, it looks like @n-riesco was able to get the bindings issue in Atom >=1.2 patched, so the next Atom release should fix this issue for hydrogen and atom-notebook: atom/atom#9660 (comment)

@themiguelamador
Copy link

Last build from source, with Atom 1.4dev already works!

@slavaGanzin
Copy link
Contributor

@themiguelamador Where did you get 1.4, if the last version is 1.3beta? Am I loosing something?

@themiguelamador
Copy link

1.4dev is the version if you build from Source.

On a mac, just do this, and it will create the Atom app in your Applications folder.

clone https://github.com/atom/atom.git
cd atom
script/build --install-dir /Applications/Atom_Source_Source.app

Note: name the app and final directory as you wich. Check code for build in other OS in https://github.com/atom/atom/tree/master/docs/build-instructions

@gnestor
Copy link

gnestor commented Nov 28, 2015

I tried to build and run 1.4.0-dev and encountered the following issue (which seems like it may be related to this patch): atom/atom#9860

@themiguelamador
Copy link

No error at least on running some code in Julia Kernel. Build version 1.4.0-dev-f2155fa yesterday. 1.3 should be more stable when they release the version with the patch mentioned above. I have it above how to build from a previous version, since you have to download the source zip from the release (at least checkout did not work with me to move to a different tag).

@gnestor
Copy link

gnestor commented Nov 29, 2015

atom-notebook is now fully working using jupyter-js-services and jupyter-kernel-gateway. You can see details on how to migrate in the jupyter-js-services branch of my fork: https://github.com/gnestor/atom-notebook/tree/jupyter-js-services

I was also able to fix the path issue that requires Atom to be launched from the command line: gnestor/atom-notebook@419174f

@rgbkrk I've submitted a PR.

@gnestor
Copy link

gnestor commented Nov 30, 2015

Confirmed that Hydrogen is working again on Atom 1.4.0-dev-c0bc38a (current master branch).

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