n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Installing on Ubuntu 17.10 #141

Closed marinsokol5 closed 6 years ago

marinsokol5 commented 6 years ago

Command sudo apt-get install nodejs-legacy npm ipython ipython-notebook

Throws

E: Package 'nodejs-legacy' has no installation candidate
E: Package 'ipython-notebook' has no installation candidate

Command after

sudo npm install ijavascript

Throws

prebuild-install info unpacking @ /home/marin/.npm/_prebuilds/https-github.com-zeromq-zeromq.js-releases-download-v4.6.0-zeromq-v4.6.0-node-v48-linux-x64.tar.gz
prebuild-install WARN install EACCES: permission denied, mkdir '/home/marin/node_modules/zeromq/build'

fs.js:924
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EACCES: permission denied, mkdir '/home/marin/node_modules/zeromq/zmq'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:924:18)
    at Object.<anonymous> (/home/marin/node_modules/zeromq/scripts/preinstall.js:89:8)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
npm WARN enoent ENOENT: no such file or directory, open '/home/marin/package.json'
npm WARN marin No description
npm WARN marin No repository field.
npm WARN marin No README data
npm WARN marin No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zeromq@4.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/marin/.npm/_logs/2017-12-27T12_05_13_715Z-debug.log

Which is mega strange becouse I am using sudo.

Can you help me?

n-riesco commented 6 years ago

The command to install IJavascript is sudo npm install -g ijavascript (note the -g, without -g the package will be installed locally; using sudo to install local packages will likely break the installation of local packages).

I haven't tested Ubuntu 17.10, but I expect this should work:

sudo apt install npm jupyter-notebook
marinsokol5 commented 6 years ago

Running

sudo npm install -g ijavascript

Throws

/usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js
/usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js
/usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js
/usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js
/usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js

> zeromq@4.6.0 install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq
> node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

prebuild-install info begin Prebuild-install version 2.4.1
prebuild-install info looking for local prebuild @ prebuilds/zeromq-v4.6.0-node-v48-linux-x64.tar.gz
prebuild-install WARN install EACCES: permission denied, access '/home/marin/.npm'

fs.js:924
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:924:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/scripts/preinstall.js:89:8)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zeromq@4.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/marin/.npm/_logs/2017-12-27T22_06_09_969Z-debug.log
elshor commented 6 years ago

It seems that you have a problem with permissions. The zeromq package runs some installation scripts. I would suggest trying to install using sudo su, or giving yourself permissions on the

/usr/local/lib/node_modules/ijavascript/node_modules/zeromq

dir.

On Thu, Dec 28, 2017 at 12:07 AM, marinsokol5 notifications@github.com wrote:

Running

sudo npm install -g ijavascript

Throws

/usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js /usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js /usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js /usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js /usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js

zeromq@4.6.0 install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

prebuild-install info begin Prebuild-install version 2.4.1 prebuild-install info looking for local prebuild @ prebuilds/zeromq-v4.6.0-node-v48-linux-x64.tar.gz prebuild-install WARN install EACCES: permission denied, access '/home/marin/.npm'

fs.js:924 return binding.mkdir(pathModule._makeLong(path), ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq' at Error (native) at Object.fs.mkdirSync (fs.js:924:18) at Object. (/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/scripts/preinstall.js:89:8) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:383:7) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zeromq@4.6.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zeromq@4.6.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/marin/.npm/_logs/2017-12-27T22_06_09_969Z-debug.log

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/n-riesco/ijavascript/issues/141#issuecomment-354184786, or mute the thread https://github.com/notifications/unsubscribe-auth/AHQ05LDbbzxu_4XFwmogsoK8H7ED8FeYks5tEr-sgaJpZM4RNcSl .

n-riesco commented 6 years ago

Please, could you run npm --versions and post the result here?

n-riesco commented 6 years ago

@elshor sudo su shouldn't be necessary to install npm packages.

I've seen the error message posted by @marinsokol5 when using the unstable version of node. See my comment here.

marinsokol5 commented 6 years ago

npm --versions

returns

{ npm: '5.6.0',
  ares: '1.13.0',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '6.11.4',
  openssl: '1.0.2g',
  uv: '1.9.1',
  v8: '5.1.281.108',
  zlib: '1.2.11' }
marinsokol5 commented 6 years ago

@elshor sudo su just returns the same error but as root

/usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js
/usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js
/usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js
/usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js
/usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js

> zeromq@4.6.0 install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq
> node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)

prebuild-install info begin Prebuild-install version 2.4.1
prebuild-install info looking for local prebuild @ prebuilds/zeromq-v4.6.0-node-v48-linux-x64.tar.gz
prebuild-install WARN install EACCES: permission denied, access '/root/.npm'

fs.js:924
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:924:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/scripts/preinstall.js:89:8)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zeromq@4.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-12-28T12_02_04_307Z-debug.log

Honestly I have no idea why my access is being denied.

n-riesco commented 6 years ago

@marinsokol5 I can't test your setup until I'm back from holidays.

The issue is with the installation of zeromq (and I've seen it before with node@9.2.0 and npm@5.5.1). I suspect this is what's happening in your case. If so and you don't mind downgrading, node@6 and npm@3 work for me.

To downgrade:

sudo npm install -g npm@3
marinsokol5 commented 6 years ago

can't do that unfortunately I need the latest version. Its ok man. Thank's for your troubles.

n-riesco commented 6 years ago

I'm reopening so I don't forget yo look into this issue.

elshor commented 6 years ago

@n-riesco wouldn't your suggestion from #127 to install locally (without the g) work over here?

n-riesco commented 6 years ago

@elshor #127 is caused by node@9.2.0 being incompatible with npm@5.5.1. Do you mean another issue?

elshor commented 6 years ago

Installing ijavascript locally, on ubuntu 17.10 with node 6.11.4 and npm 5.6.0 works (globally doesn't world). The same workaround can work here

amellnik commented 6 years ago

For reference, the workaround is described in "Installing locally" here: http://n-riesco.github.io/ijavascript/doc/install.md.html

IMTorg commented 6 years ago

I have the same problem when running within docker all-spark-notebook, with --user root and latest node 8.9.4.

After forcing the global npm install with --unsafe-perm, I get no errors on the installation. But, when I try to use the js kernel in the notebook, the notebook cannot find it! Any suggestions are greatly appreciated.

n-riesco commented 6 years ago

After forcing the global npm install with --unsafe-perm, I get no errors on the installation. But, when I try to use the js kernel in the notebook, the notebook cannot find it! Any suggestions are greatly appreciated

I'm guessing (without seeing what commands were run and the error messages) that ijskernel isn't in the PATH. If this is case, the kernel spec needs to be installed with full paths:

ijsinstall --spec-path=full

Note that if node is upgraded later on, kernel specs with full paths need to be reinstalled (so that they point to the new version of node).

I'm also guessing that you'd like the kernel specs to be installed for all the users. In that case, use instead:

ijsinstall --install=global --spec-path=full
n-riesco commented 6 years ago

Note to myself: npm --unsafe-perm

IMTorg commented 6 years ago

The command: ijsinstall --install=global --spec-path=full worked perfectly - thanks!

nojair commented 6 years ago

It seems to be a problem with permisions over /usr/lib/node_modules. I tried with sudo chmod 777 /usr/lib/node_modules, then I installed ijavascript without problems and came back node_modules to its original permitions. It's dangerous?

n-riesco commented 6 years ago

@llaksa

It's dangerous?

There is no need to take the risk. npm installatation with sudo now requires the flag --unsafe-perm. See the answers in #146.


I'm closing this issue in favour of #146.