Jupyter Notebook validation failed - jupyter-notebook

When I open a file in jupyter notebook, I get this error.
Notebook validation failed: {'model_id': '47c3f67b01814c2baeeca6efa0a79e2d', 'version_major': 2, 'version_minor': 0} is not valid under any of the given schemas:
{
"model_id": "47c3f67b01814c2baeeca6efa0a79e2d",
"version_major": 2,
"version_minor": 0
}

I had the same problem and this solution works like a charm:
https://github.com/jupyter/nbformat/issues/161
TLDR: open your file on a text editor and replace "nbformat_minor": 1 with "nbformat_minor": 4

Check if you activated conda environment correctly. In my case conda environment was not correctly activated so that was the problem. As I activated correctly everything worked normal.

I think different issues cause the error, one of them is:
The bug happens because the code blocks from Colab are missing "outputs':[] and "execution_count":null.
{
"cell_type": "code",
"metadata": {
"id": "e2769b9e0005"
},
"source": [
"!pip install git+https://github.com/google/starthinker\n"
]
},
To fix add the missing fields to the colab source for any code block only not markdown:
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"metadata": {
"id": "e2769b9e0005"
},
"source": [
"!pip install git+https://github.com/google/starthinker\n"
]
},

Related

Cannot debug R in VSCode

I created a very simple .r file insider a folder and want to debug this file using VSCode.
Here are the steps taken:
Create a new folder in desktop;
Create a .r file inside the new folder and add simple R code;
Load the new folder into VSCode and open the .r file;
Click the debug icon in VSCode, create a launch.json file and save it to the .vscode folder inside the new folder;
Click start debugging, the debug floating control pane appears but the step in/out icons are greyed out.
Here is the launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "R-Debugger",
"name": "Launch R-Workspace",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}"
},
{
"type": "R-Debugger",
"name": "Debug R-File",
"request": "launch",
"debugMode": "file",
"workingDirectory": "${workspaceFolder}",
"file": "${file}"
},
{
"type": "R-Debugger",
"name": "Debug R-Function",
"request": "launch",
"debugMode": "function",
"workingDirectory": "${workspaceFolder}",
"file": "${file}",
"mainFunction": "main",
"allowGlobalDebugging": false
},
{
"type": "R-Debugger",
"name": "Debug R-Package",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}",
"includePackageScopes": true,
"loadPackages": [
"."
]
},
{
"type": "R-Debugger",
"request": "attach",
"name": "Attach to R process",
"splitOverwrittenOutput": true
}
]
}
Here is the screentshot:
Why are the step in/out icons are greyed out? I simply cannot debug R file in VSCode in current state. Thank you.
The error you are getting is:
Error: '.vsc.listenForJSON' is not an exported object from 'namespace:vscDebugger'
This is a known issue caused by an older version of the R package. According to the package maintainer, the solution to this issue is,
You can run rdebugger.updateRPackage in the command palette (ctrl+shift+p) to update the R package. If that doesn't work, there are some installation instructions in the readme.
If your problem still persists after following these instructions, I would considering opening a github issue. Someone opened what appears to be a similar issue 12 days ago so it may be the package has broken on some systems after a recent update either to this package or a dependency.

Debug Next.js App with VSCode in NX monorepo

I'm currently trying to debug a Next.js Application inside a NX monorepo.
I have enabled the Auto Attach setting in VSCode's User Settings.
When I start the Application using the serve command, I can see output in the Debug Console and also print out the current process by typing process or console.log(process) into the Debug Console.
However, I cannot set any breakpoints in the server side code, for example in getServerSideProps.
I checked Next.js Debugging Documentation for the missing pieces, and tried setting the NODE_OPTIONS='--inspect' in my Next.js Application via .env file.
Update: Seems like it's a missing feature on NX.
Got it working, thanks to the information from this Pull Request.
.vscode/launch.json
{
"version": "0.2.0",
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
"configurations": [
{
"name": "name-of-the-app – Server",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"nx",
"run",
"name-of-the-app:serve",
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"env": {
"TS_NODE_IGNORE": "false",
"TS_NODE_PROJECT": "${workspaceFolder}/apps/name-of-the-app/tsconfig.json"
},
"cwd": "${workspaceFolder}/apps/name-of-the-app/"
}
]
}
Note: I'm using yarn. You might have to replace it with npm instead.

Problem running Scrapoxy and Digital Ocean

I'm trying to run Scrapoxy with Digital Ocean. I successfully created a droplet image and configured Scrapoxy.
When I start Scrapoxy, it keeps on creating a new instance and bypassing max limit. It stops only when it reaches 10 droplets. What annoys me is that No instance found in the GUI version. Also, when I test the proxy server I get this message: "Error: No running instance found". It seems that Scrapoxy only creates droplets and can't connect to them.
I installed Scrapoxy manually. Here is my config file:
{
"commander": {
"password": ".........."
},
"instance": {
"port": 3128,
"scaling": {
"min": 1,
"max": 2
}
},
"providers": [
{
"type": "digitalocean",
"token": "5204b9654f301.............c281036bd19e283321c09680ac9c",
"region": "FRA1",
"size": "s-1vcpu-1gb",
"sshKeyName": "scrapoxy",
"imageName": "forward-proxy",
"tags": "Proxy,Amazon"
}
]
}
Did you try to put your region in lowercase in the config file
Example:
like this
"region": "fra1"
instead of
"region": "FRA1"
There are other troubleshooting steps you could take on the following github pages Issue 84 & Issue 62

Error "LB: Transpiled file would overwrite source file. Aborted!"

I've been given a coding task as part of a job interview it's a little outside my ken but I'm trying it anyway. They've given me their boilerplate and asked me to make certain changes. It is a React app built with webpack.
When I try to edit a file [addendum: I should have said "edit and save"], I get the Error "LB: Transpiled file would overwrite source file. Aborted!"
I assume the "LB" refers to language-babel. I can get it to work by disabling language-babel. Maybe I'm confused, but aren't source files exactly what I want to edit? I've never had this problem on any other project on which I've worked.
I've searched and can't find much on this error. I'm on Windows 10 with Atom 1.19.7 X64 and language-babel 2.75.2.
The .babelrc that came with the boilerplate is:
```
{
"presets": ["react", "es2015"],
"plugins": [
["import", [{
"libraryName": "antd",
"style": "css"
}, {
"libraryName": "lodash",
"libraryDirectory": "",
"camel2DashComponentName": false,
}, {
"libraryName": "components",
"libraryDirectory": "",
"camel2DashComponentName": false,
}, {
"libraryName": "HOCS",
"libraryDirectory": "",
"camel2DashComponentName": false,
}]],
"transform-runtime",
"transform-class-properties",
"transform-object-rest-spread",
"dynamic-import-node",
]
}
```
Thank you in advance for your help.

use PHPExcel with composer and Symfony2.2

I found this on SO: How to use PHPExcel correctly with Symfony 2
This works, but I want to use it with composer.
The first part I already solved: to load PHPExcel for a special tag (the last stable release)
I don't find out how to fetch a tag with this syntax:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/umpirsky/SyliusAssortmentBundle"
}
]
So I use the Package notation:
I found out, the reference should be the tag name on github.
And the version cannot be the same value (PHPExcel_1.7.8). Seems that alphabetical characters are not allowed, so it's only the version as a number (1.7.8)
"repositories": [{
"type": "package",
"package": {
"name": "PHPOffice/PHPExcel",
"version": "1.7.8",
"source": {
"url": "https://github.com/PHPOffice/PHPExcel.git",
"type": "git",
"reference": "PHPExcel_1.7.8"
}
}
}]
The next step I didn't solve. I tried out every combination for the autoloading: psr-0, classmap, different paths, relative to project/vendor/phpexcel, update composer everytime, but nothing worked.
It only works, if I put this line
$loader->add('PHPExcel', __DIR__.'/../vendor/PHPOffice/PHPExcel/Classes');
into the app/autoload.php. I found out, that the first string (PHPExcel) can also be an empty string: ''.
Is there a differnece if I use PHPExcel or ''?
So my primary question is, how can I avoid to write this line into the autoload.php, put the equivalent commands into my project's composer.json?
Regarding your primary question, the problem is that once the package is installed, if you update the definition and add autoload stuff, then running composer update will not change anything. Composer still has the old package that was already installed in its "cache", so it uses that to generate the autoload and that fails.
To resolve this you should remove the vendor/PHPOffice/PHPExcel directly and run composer update, which will reinstall it with the latest information from your composer.json, including autoload, etc. You should specify autoloading as such:
"repositories": [{
"type": "package",
"package": {
"name": "PHPOffice/PHPExcel",
"version": "1.8.0",
"source": {
"url": "https://github.com/PHPOffice/PHPExcel.git",
"type": "git",
"reference": "1.8.0"
},
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
}
}
}],
"require": {
"PHPOffice/PHPExcel": "1.8.*",
...
Regarding the secondary question and '' vs 'PHPExcel': '' just says that any namespace can be found in this directory. That means the autoloader will always scan this directory to find classes, which is convenient but slower than mapping namespaces to directories explicitly. So both work, but the more specific form is preferred, especially in packages you publish publicly.

Resources