I am trying to setup Julia with Google Colab. Installation instructions as in https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319 have been followed. Despite that, I am unable to launch Julia.
I am trying to use Julia with Google Colab. I followed the following steps:
Install CUDA
!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt update -q
!apt install cuda gcc-6 g++-6 -y -q
!ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc
!ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++
Install Julia 1.2.0
!curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/1.2/julia-1.2.0-linux-x86_64.tar.gz" -o julia.tar.gz
!tar -xzf julia.tar.gz -C /usr --strip-components 1
!rm -rf julia.tar.gz*
!julia -e 'using Pkg; pkg"add IJulia; add CuArrays; add Flux; precompile"'
The above two steps run perfectly fine. I am unable to initiate a Julia session. I tried:
!julia
With this, the Julia start-up screen keeps showing with no command-line.
The easiest option is to use this Colab notebook template.
It supports any Julia version, and also has GPU support.
Turns out that it was just the sequence of steps that was wrong. Very helpful video posted https://www.youtube.com/watch?v=xpZo3L2dYTY. Just to reiterate:
Save the following as .ipynb file, and upload it on Google Colab:
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Julia on Colab.ipynb",
"version": "0.3.2",
"provenance": []
},
"kernelspec": {
"name": "julia-1.2",
"display_name": "Julia 1.2"
},
"accelerator": "GPU"
},
"cells": [
{
"metadata": {
"id": "oMSuTc3pDlHv",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Install CUDA in the same notebook using the commands mentioned in the question.
Install Julia 1.2.0 in the same notebook using the commands mentioned above.
Configure the settings as demonstrated in the video and you are all set!
In addition to the answer by user3856486: you can now skip the CUDA installation step (mentioned here). That saves a lot of time, especially since you have to rerun these steps whenever you close the notebook/the runtime disconnects.
Related
I am wanting to use a ternary operator in my npm script:
"scripts": {
"build" "node ${%(ENVVAR=nope.foo.bar)}.js"
}
So that I can use it like:
ENVVAR=nope yarn build
And obtain the resulting command of:
"node foo.js"
However my attempts above (tried parens and square brackets) always yield bad substitution
What is the proper syntax to include a ternary operator in my parameter expansion for this (zsh shell)
The npm docs state:
"The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of npm#5.1.0 you can customize the shell with the script-shell configuration."
Therefore given that the shell npm utilizes on *nix is typically sh consider the following npm script instead (Unless of course your npm's script-shell has actually been configured to zsh):
"scripts": {
"build": "[[ $ENVVAR = \"nope\" ]] && val=foo || val=bar; node \"${val}.js\""
}
Note: You can check which shell npm is utilizing via the npm config command: npm config get script-shell
Alternatively, for cross-platform regardless of which shell npm is configured to utilize, consider evaluating a node.js script inline which "shells-out" the node ... command. For example the following (albeit somewhat verbose) npm script utilizes execSync:
"scripts": {
"build": "node -e \"const val = process.env.ENVVAR === 'nope' ? 'foo' : 'bar'; require('child_process').execSync('node ' + val + '.js', { stdio: [0,1,2] })\""
}
I'm working on a large angular / .NET Core project and have to type e.g. dotnet run /path/to/subproject in the terminal often.
Can I use VSCode to store/manage these common commands? I've been through the vscode docs on launch.json and tasks.json but cannot find a good answer.
Thanks!
Yes, you have a couple of options.
(1) Set up a command to just rerun the last command - see Make a keybinding to run previous or last shell commands
{
"key": "alt+x", // choose your keybinding
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b[A\u000d" }
},
or (2) just put your frequently-used command into a keybinding ala:
{
"key": "alt+x", // choose your keybinding
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "dotnet run /path/to/subproject\u000d" },
// "when": "terminalFocus"
},
The \u000d is a return so the command runs immediately. I find it easiest to not have the when clause so I can run it from anywhere - editorFocus or terminalFocus, etc.
These go into your keybindings.json.
You can use variables where you have /path/to/subproject. See task - variable substitution and available variables which may help with your path.
pm2-meteor node, npm, pm2 missing error...
Hello, I am currently trying to deploy to pm2-meteor with an error.
The current situation is that I want to modify product that was developed by previous developer as meteor using mac.
I use Windows.
Although not particularly relevant, the first error that occurred was the package-lock.json error of product, which was significantly changed when meteor npm install. So I just got node modules for npm install.
Then I tried to modify the code and deploy it using the pm2-meteor.
An error occurs.
Building your app and deployment to host machine \
Missing node
Missing npm
Missing pm2
Since previous developers used nvm, I also installed nvm and now my nvm folder is configured as shown in the figure.
`
> { "appName": ",
>"appLocation": {"local": "../" },
>"meteoSettingsLocation": ",
>"meteoSettingsInRepo": false, "prebuildScript": ",
> MeteorBuildFlags: "--architecture os.linux.x86_64",
> "Env": {
> "ROOT_URL": ",
> "PORT": "3000",
> "MONGO_URL": "" }, "server": {
> "host": ",
> "username": "root",
> "deploymentDir": ",
> "loadProfile": ",
> "nvm": {
> "bin": "~/.nvm/nvm.sh",
> "use": "8.8.1"
> },
> "exec_mode": "cluster_mode",
> "instances": "0",
> "password": "" }, "allowUndeployment": true }
`
Above is a .json file. I deleted personal information.
However, I use nvm-windows because nvm does not support Windows.
This is a list I've tried so far.
Reinstall the mateor
Delete existing node.js and reinstall nvm
Reinstall pm2 and pm2-meteor
Reconfigure the json file using the command in pm2-meteor (init)
Rewrite the nvm path of the json file(above json file) to the location of the nvm on my computer
a part of my doubt
The discrepancy between nvm used by the former developer in mac and nvm-windows used in windows
Currently, pm2-meteor and pm2 are properly stored in the v8.8x folder in the nvm folder.
Please give me a good direction.
Background
Within an Electron app, sqlite3 doesn't work right after npm install --save. I got it working after doing some web research, by:
(1) downgrading my node version (via n) to match Electron's node version; and
(2) rebuilding sqlite with the right module name/targets with this package.json script:
"rebuild-sqlite3": "cd node_modules/sqlite3 && npm run prepublish && node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-darwin-x64 && node-gyp rebuild --target=1.2.6 --arch=x64 --target_platform=darwin --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-darwin-x64"
After that, Sqlite3 works in development (i.e. when I run electron . in the project dir).
Problem
I package the app with electron-packager: "./node_modules/.bin/webpack -p && ./node_modules/electron-packager/cli.js ./ --out ./bin --platform=darwin --arch=x64 --version=1.2.6 --overwrite --ignore=\"ignore|bin|node_modules\""
When I open the app by double-clicking the created (appName).app, the console complains: `Uncaught Error: Cannot find module
Question
How can I get sqlite3 to be found in the final packaged product? Even "hacks" or workarounds are welcome, as I tried various fixes to no avail.
I leave this answer for someone who has the same problem and is wasting their time to figure out.
step1
npm install sqlite3
electron .
I expected to work fine. but I had an error 'cannot find node module sqlite3'
step2
npm install electron-rebuild --save-dev
electron-rebuild -f -w sqlite3
electron .
it worked.
but if you used 'electron-packager' to package and make executable file, It didn't work. the same error occured.
"electron-packager . electron-tutorial-app --overwrite --asar --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=new --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Electron Test\"",
step3
I spent pretty much time to figure out. At the end, I figured out. the solution was using electron-packager API and integrating afterCopy with electron-rebuild.
# build.js
const packager = require('electron-packager');
const rebuild = require('electron-rebuild');
packager({
dir: '../dir',
overwrite: true,
asar: true,
platform: 'win32',
arch: 'ia32',
icon: 'assets/icons/win/icon.ico',
prune: true,
out: 'hello',
executableName: 'hello',
afterCopy: [(buildPath, electronVersion, platform, arch, callback) => {
rebuild.rebuild({ buildPath, electronVersion, arch })
.then(() => callback())
.catch((error) => callback(error));
}],
})
node build.js
reference
electron-rebuild manual 'How can I integrate this into Electron packager?'
electron-packager API doc
Doesn't the --ignore=\"ignore|bin|node_modules\" you pass to electron-packager ignore everything in the node_modules dir, the very place where the sqlite3 module is installed?
I have the following:
ipyparallel (5.0.0)
ipython (4.0.3)
I have enabled ipcluster by typing in the command line:
ipcluster nbextension enable
I'm trying to create a new cluster on the IPython Clusters tab on the Jupyter notebook, but this is what I see:
I was able to do this before. Thanks!
From here:
Instead of editing jupyter_notebook_config.py, edit jupyter_notebook_config.json and look for:
"NotebookApp": {
"server_extensions": [
<some lines>
]
change this to:
"NotebookApp": {
"server_extensions": [
<some lines>,
"ipyparallel.nbextension"
]
I've just stumbled upon the same problem, and the fix mentioned in the accepted answer worked, but let me add some context for the future visitors of this question, just in case.
I have Anaconda 5.0 for Linux, under that I first did:
jupyter notebook --generate-config
pip install ipyparallel
jupyter nbextension install --py ipyparallel --user
jupyter nbextension enable --py ipyparallel --user
jupyter serverextension enable --py ipyparallel --user
Which lead to the situation on the screenshot.
Under ~/.jupyter I have both jupyter_notebook_config.json as well as jupyter_notebook_config.py.
The json file had this inside:
{
"NotebookApp": {
"nbserver_extensions": {
"ipyparallel.nbextension": true
}
}
}
I changed the file by adding a "server_extensions" block as follows:
{
"NotebookApp": {
"nbserver_extensions": {
"ipyparallel.nbextension": true
},
"server_extensions": [
"ipyparallel.nbextension"
]
}
}
After restart, Jupyter reported in the logs:
[W 19:44:14.107 NotebookApp] server_extensions is deprecated, use nbserver_extensions
However, the Clusters tab started working as necessary. Apparently, some recent changes in the configuration logic did not propagate to all of the codebase.