Install lisp kernel in IPython - linux

I'm trying to install cl-jupyter. (Debian)
I've done the following steps:
install gcl (apt-get install gcl)
install sbcl (apt-get install sbcl)
run command python3 ./install-cl-jupyter.py
try to run command sbcl --load ./cl-jupyter.lisp but I get the following and don't know what to do. I've tried to choose all option, but nothing happend.
Output:
This is SBCL 1.2.4.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
debugger invoked on a SB-C::INPUT-ERROR-IN-LOAD in thread
#<THREAD "main thread" RUNNING {10039CE993}>:
READ error during LOAD:
Package ASDF does not exist.
Line: 3, Column: 29, File-Position: 150
Stream: #<SB-SYS:FD-STREAM
for "file /home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp"
{10039D64A3}>
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT ] Abort loading file "/home/ivan/all/language_packages/cl-jupyter-master/./cl-jupyter.lisp".
1: [CONTINUE] Ignore runtime option --load "./cl-jupyter.lisp".
2: Skip rest of --eval and --load options.
3: Skip to toplevel READ/EVAL/PRINT loop.
4: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(SB-C:COMPILER-ERROR SB-C::INPUT-ERROR-IN-LOAD :CONDITION #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {10039D9E83}> :STREAM #<SB-SYS:FD-STREAM for "file /home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp" {10039D64A3}>)
update file ipython/your_kernel_name/kernel.json
from
{"language": "lisp", "display_name": "SBCL Lisp", "argv": ["sbcl", "--non-interactive", "--load", "/home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp", "/home/ivan/all/language_packages/cl-jupyter-master/src", "/home/ivan/all/language_packages/cl-jupyter-master", "{connection_file}"]}
to
{
"argv": [
"sbcl","--non-interactive", "--load",
"/path/to/cl-jupyter/cl-jupyter.lisp",
"/path/to/cl-jupyter/src",
"/path/to/cl-jupyter",
"{connection_file}"
],
"display_name": "SBCL Lisp",
"language": "lisp"
}
(information from here)
Now I can see the SBCL Lisp kernel in jupyter but it doesn't work and breaks all the time when I try to write and run smth.
Please, help

I've done it! Now it works fine.
1)I forgot to install quicklisp
2) here i just put right paths to cl-jupyter.lisp, /src, /cl-jupyter:
{
"argv": [
"sbcl","--non-interactive", "--load",
"/path/to/cl-jupyter/cl-jupyter.lisp",
"/path/to/cl-jupyter/src",
"/path/to/cl-jupyter",
"{connection_file}"
],
"display_name": "SBCL Lisp",
"language": "lisp"
}

Related

chrome crashes but strace chrome doesn't

Chromedriver is started with xvfb-run chromedriver --disable-dev-shm-usage --enable-chrome-logs --allowed-ips=127.0.0.1.
Here's what I know:
bash-4.2# chromedriver --version
ChromeDriver 110.0.5481.77 (65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481#{#839})
bash-4.2# google-chrome --version
Google Chrome 110.0.5481.77
bash-4.2# curl -XPOST -H "Content-Type: application/json;charset=UTF-8" -H "Accept: application/json;charset=UTF-8" -d '{"capabilities":{"firstMatch":[{"goog:chromeOptions":{"args":["--no-sandbox","--user-data-dir=/tmp/chrome/2","--data-path=/tmp/chrome/3","--disk-cache-dir=/tmp/chrome/4","--no-zygote","--disable-dev-shm-usage","--disable-gpu","--single-process"]}}],"alwaysMatch":{"browserName":"chrome","pageLoadStrategy":"none"}}}' http://localhost:9515/session
{"value":{"error":"disconnected","message":"disconnected: Unable to receive message from renderer\n (failed to check if window was closed: disconnected: not connected to DevTools)\n (Session info: chrome=110.0.5481.77)","stacktrace":"#0 0x562dfdcfad93 \u003Cunknown>\n#1 0x562dfdac92d7 \u003Cunknown>\n#2 0x562dfdab36d3 \u003Cunknown>\n#3 0x562dfdab1ee2 \u003Cunknown>\n#4 0x562dfdab2682 \u003Cunknown>\n#5 0x562dfdab25d4 \u003Cunknown>\n#6 0x562dfdaa4170 \u003Cunknown>\n#7 0x562dfdaa39c0 \u003Cunknown>\n#8 0x562dfdaa2d35 \u003Cunknown>\n#9 0x562dfdb32653 \u003Cunknown>\n#10 0x562dfdb29353 \u003Cunknown>\n#11 0x562dfdaf8e40 \u003Cunknown>\n#12 0x562dfdafa038 \u003Cunknown>\n#13 0x562dfdd4e8be \u003Cunknown>\n#14 0x562dfdd528f0 \u003Cunknown>\n#15 0x562dfdd32f90 \u003Cunknown>\n#16 0x562dfdd53b7d \u003Cunknown>\n#17 0x562dfdd24578 \u003Cunknown>\n#18 0x562dfdd78348 \u003Cunknown>\n#19 0x562dfdd784d6 \u003Cunknown>\n#20 0x562dfdd92341 \u003Cunknown>\n#21 0x7fa628df844b start_thread\n"}}
Looking into the chromedriver verbose logs, Chrome was happily sitting at a new tab and then things went haywire:
[1675906446.284][DEBUG]: DevTools WebSocket Response: Target.getTargets (id=1) (session_id=) browser {
"targetInfos": [ {
"attached": false,
"browserContextId": "D38C850EC0824ADB75AD7FE1597FE262",
"canAccessOpener": false,
"targetId": "1AFD8F644C4F1088FA776DA626B4F18D",
"title": "New Tab",
"type": "page",
"url": "chrome://newtab/"
} ]
}
[1675906446.284][DEBUG]: DevTools WebSocket Command: Target.attachToTarget (id=2) (session_id=) browser {
"flatten": true,
"targetId": "1AFD8F644C4F1088FA776DA626B4F18D"
}
[0209/013406.300892:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0209/013406.300954:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[1675906446.312][SEVERE]: Unable to receive message from renderer
We know the cpufreq thing is a red herring as it is coming from the crash reporter.
But here's the insane catch: if I replace the chrome binary with
cat /opt/google/chrome/chrome
#!/bin/bash
strace -o /tmp/strace -f /opt/google/chrome/chrome-binary "$#"
Then it works. If I remove the strace and the keep the shell script it crashes again. Also tried Chrome 98 and 102, they crash just the same.
Here is the payload from above nicely formatted:
{
"capabilities": {
"firstMatch": [
{
"goog:chromeOptions": {
"args": [
"--no-sandbox",
"--user-data-dir=/tmp/chrome/2",
"--data-path=/tmp/chrome/3",
"--disk-cache-dir=/tmp/chrome/4",
"--no-zygote",
"--disable-dev-shm-usage",
"--disable-gpu",
"--single-process"
]
}
}
],
"alwaysMatch": {
"browserName": "chrome",
"pageLoadStrategy": "none"
}
}
}
note I added pageLoadStrategy after the error surfaced and it doesn't matter -- but I wanted to show I've tried.
This is some sort of CentOS, a Dockerfile based on public.ecr.aws/lambda/provided:al2 running locally (it fails the same on AWS Lambda). Here's how:
FROM public.ecr.aws/lambda/provided:al2
COPY chrome-deps.txt /tmp/
RUN yum install -q -y $(cat /tmp/chrome-deps.txt) https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
COPY install-chrome.sh /tmp/
RUN /usr/bin/bash /tmp/install-chrome.sh
The requirements is probably utter overkill to spell out but:
acl adwaita-cursor-theme adwaita-icon-theme alsa-lib at-spi2-atk at-spi2-core
atk avahi-libs cairo cairo-gobject colord-libs cryptsetup-libs cups-libs dbus
dbus-libs dconf desktop-file-utils device-mapper device-mapper-libs elfutils-default-yama-scope
elfutils-libs emacs-filesystem fribidi gdk-pixbuf2 glib-networking gnutls graphite2
gsettings-desktop-schemas gtk-update-icon-cache gtk3 harfbuzz hicolor-icon-theme hwdata jasper-libs
jbigkit-libs json-glib kmod kmod-libs lcms2 libX11 libX11-common libXau libXcomposite libXcursor libXdamage
libXext libXfixes libXft libXi libXinerama libXrandr libXrender libXtst libXxf86vm libdrm libepoxy
liberation-fonts liberation-fonts-common liberation-mono-fonts liberation-narrow-fonts liberation-sans-fonts
liberation-serif-fonts libfdisk libglvnd libglvnd-egl libglvnd-glx libgusb libidn libjpeg-turbo libmodman
libpciaccess libproxy libsemanage libsmartcols libsoup libthai libtiff libusbx libutempter libwayland-client
libwayland-cursor libwayland-egl libwayland-server libxcb libxkbcommon libxshmfence lz4 mesa-libEGL mesa-libGL
mesa-libgbm mesa-libglapi nettle pango pixman qrencode-libs rest shadow-utils systemd systemd-libs trousers ustr
util-linux vulkan vulkan-filesystem wget which xdg-utils xkeyboard-config
xorg-x11-server-Xvfb unzip
the install script is not much:
#!/usr/bin/bash
CHROMEVERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
curl -s https://chromedriver.storage.googleapis.com/$CHROMEVERSION/chromedriver_linux64.zip > /tmp/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /opt/bin/
downloaded chromium.br from https://github.com/Sparticuz/chrome-aws-lambda/blob/2fb71eb0ca2e08292973efe3ca59182debbbffc8/bin/chromium.br while this repo is deprecated, the Chromium 110 from the new repo doesn't seem to work?
brotli -d chromium.br
In Dockerfile, COPY chromium /usr/bin/google-chrome
CHROMEVERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_106.0.5249)
I still have no idea what's going on but I will take it. For the next few years being stuck on Chromium 106 is fine.

QEMU simple backend tracing dosen't print anything

I'm doing get simple trace file from QEMU.
I followed instructions docs/tracing.txt
with this command "qemu-system-x86_64 -m 2G -trace events=/tmp/events ../qemu/test.img"
i'd like to get just simple trace file.
i've got trace-pid file, however, it dosen't have anything in it.
Build with the 'simple' trace backend:
./configure --enable-trace-backends=simple
make
Create a file with the events you want to trace:
echo bdrv_aio_readv > /tmp/events
echo bdrv_aio_writev >> /tmp/events
Run the virtual machine to produce a trace file:
qemu -trace events=/tmp/events ... # your normal QEMU invocation
Pretty-print the binary trace file:
./scripts/simpletrace.py trace-events trace-* # Override * with QEMU
i followd this instructions.
please somebody give me some advise for this situation.
THANKS!
I got same problem by following the same document.
https://fossies.org/linux/qemu/docs/tracing.txt
got nothing because
bdrv_aio_readv and bdrv_aio_writev was not enabled by default, at least the version I complied, was not enabled. you need to open trace-events under source directory, looking for some line without disabled, e.g. I using:
echo "load_file" > /tmp/events
Then start qemu,
after a guest started, I run
./scripts/simpletrace.py trace-events trace-Pid
I got
load_file 1474.156 pid=5249 name=kvmvapic.bin path=qemu-2.8.0-rc0/pc-bios/kvmvapic.bin
load_file 22437.571 pid=5249 name=vgabios-stdvga.bin path=qemu-2.8.0-rc0/pc-bios/vgabios-stdvga.bin
load_file 10034.465 pid=5249 name=efi-e1000.rom
you can also add -monitor stdio to qemu command line, after it started, you can the following command in qemu CLI:
(qemu) info trace-events
load_file : state 1
vm_state_notify : state 1
balloon_event : state 0
cpu_out : state 0
cpu_in : state 0
1 means enabled events.
Modify the trace-events file in the source tree
As of v2.9.0 you also have to remove the disable from the lines you want to enable there, e.g.:
-disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
+exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
and recompile.
Here is a minimal fully automated runnable example that boots Linux and produces traces: https://github.com/cirosantilli/linux-kernel-module-cheat
For example, I used the traces to count how many boot instructions Linux has: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/c7bbc6029af7f4fab0a23a380d1607df0b2a3701/count-boot-instructions.md
I have a lightly patched QEMU as a submodule, the key commit is: https://github.com/cirosantilli/qemu/commit/e583d175e4cdfb12b4812a259e45c679743b32ad

Fix substitution of “shell_cmd” on Mac OSX in Sublime Text 3

I have a problem with my build system specified in project settings. Currently my project settings look like this
{
"build_systems":
[
{
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"name": "Anaconda Python Builder",
"selector": "source.python",
"shell_cmd": "$project_path/bin/python -u $file"
}
],
"folders":
[
{
"file_exclude_patterns":
[
"pip-selfcheck.json",
"pyvenv.cfg"
],
"folder_exclude_patterns":
[
"lib",
"include",
"bin"
],
"follow_symlinks": true,
"path": "."
}
],
"settings":
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
"*.ico",
"*.eot",
"*.pdf",
"*.swf",
"*.jar",
"*.zip",
"client/node_modules/**",
"data/**"
]
}
}
The actual problem problem is in the line:
"shell_cmd": "$project_path/bin/python -u $file"
Every time I close sublime and reopen it my shell_cmd gets substituted with this
"shell_cmd": "\"python\" -u \"$file\""
Which fails my build. Is there a way to fix this problem? What do I do to disable this automatic substitution?
Mac OS X 10.11.3
Sublime Text 3103
I already answered this question in the Anaconda's issues tracker but I will do it here for any other user that lands in this question with a similar problem.
That specific build system is used by Anaconda itself and that is why it is called "Anaconda Python Builder", it will update the "shell_cmd" with anything that you used as configuration for your "python_interpreter" setting into your anaconda's settings file (general, user or per project).
If you have specific needs for your build system, you should create a new build entry with your own options and stick to that one. Anaconda's build system is a convenience for users that need to use their configured Python interpreter instead of the embedded ST3 one.
I solved this issue without a custom build system by adding python_interpreter: 'full/path/to/python' to the settings dictionary. python part in the Anaconda Python Builder shell_cmd gets replaced with it.

stop checking for updates

In sublime terminal (ctrl + `) every minute I got annoing lines:
Checking for updates:
Sync Enabled: True
Sync Timeout: 60000
Latest Update at: Thu Jan 1 00:00:00 1970
Thread is: Thread-4
Paths: [{'path': '', 'display': ''}]
It interrupt me from debuging sublime plugins.
How to disable this Checking for updates?
I tried 2 things to disable it:
I added line "update_check": false into /Users/maks/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings:
{
"ignored_packages":
[
"JavaScript Console",
"Vintage"
],
"update_check": false
}
And restarted sublime. But nothing...
I tried to find string 60000 in all files of sublime folder: /Users/maks/Library/Application Support/Sublime Text 3
But nothing good found. Maybe 60000 ms is default value.
Update
Created function to search text in packages and installed packages:
searchInSubl()
{
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages; zgrep -e $1 *.sublime-package ; cd ../Packages; grep -R -e $1 *
}
With help of it I searched by different words: "Checking for updates", "Sync Enabled", "Sync Timeout", "60000", "Latest Update at", "Thread is", "Paths". But nothing found.
Seemingly this update is internal sublime 3 option. Don't know how to disable it...
My current version of sublime text 3 is 3083. Here how the guys solved it HERE.
Text version
Go to Preferences -> Settings-User -> and paste that line of code in the end:
"update_check": false, or "update_check": false (without last comma if it's last item in the array). After that press CTRL + S (on Windows OS) to Save file or go to File -> Save
Image version
Since Sublime Text 3 packages are in zipped .sublime-package files, you'll need to use zgrep to search them:
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages
zgrep -e "Checking for updates" *.sublime-package
If nothing is found, try looking in the Packages directory:
cd ../Packages
grep -R -e "Checking for updates" *
Hopefully one of these will match a package. If so, add the package to your ignored_packages setting and restart Sublime.
If neither search works, try using other fragments of the message as your search term: "Sync Enabled", "Latest Update", etc.
Good luck!
Please Note:
This is not the same issue as this one, where setting "update_check": false in your user preferences does not stop Sublime Text 3 from displaying upgrade messages when a new build is released. This particular issue was caused by a plugin constantly printing a message to Sublime's console. As the OP commented below:
using turning off and on every single plugin, target plugin found, its name: "My Snippets" in Installed Packages folder.
Two solutions, depending on what exactly you want to accomplish.
Since I am not sure - possibly my English - so I give you two solutions.
BLOCK PACKAGE FROM UPDATING
I use Sublinter as an example.
Preferences > Package Settings > Package Control > Settings – User
... and add something like this to block package:
// Packages to not auto upgrade
"auto_upgrade_ignore": [
"SublimeLinter"
],
BLOCK SUBLIME FROM UPDATING
If you want Sublime to stop updating and you do not trust in-app update blocking solutions, just nuke 'em.
On Windows (system I use) go to:
C:\Windows\System32\drivers\etc
... and open file named 'hosts'.
You may have to move this file onto desktop, edit it and move it back to original location, as Windows may not allow any changes to it - even, if you try as Administrator.
Then add to 'hosts' file this line of code:
127.0.0.1 localhost www.sublimetext.com
127.0.0.1 localhost sublimetext.com
Version with 'www' will do, as sublime sends updates from 'www.sublimetext.com' location.
Above code will prevent any connection from your machine to 'www.sublimetext.com', hence no updates anymore.
That does not apply to packages, they need option #1.

How do I use (require :PACKAGE) in clisp under Ubuntu Hardy?

I am trying to evaluate the answer provided here, and am getting the error: "A file with name ASDF-INSTALL does not exist" when using clisp:
dsm#localhost:~$ clisp -q
[1]> (require :asdf-install)
*** - LOAD: A file with name ASDF-INSTALL does not exist
The following restarts are available:
ABORT :R1 ABORT
Break 1 [2]> :r1
[3]> (quit)
dsm#localhost:~$
cmucl throws a similar error:
dsm#localhost:~$ cmucl -q
Warning: #<Command Line Switch "q"> is an illegal switch
CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on crap-pile
With core: /usr/lib/cmucl/lisp.core
Dumped on: Sat, 2008-09-20 20:11:54+02:00 on localhost
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to pvaneynd#debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos
Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (require :asdf-install)
Error in function REQUIRE: Don't know how to load ASDF-INSTALL
[Condition of type SIMPLE-ERROR]
Restarts:
0: [ABORT] Return to Top-Level.
Debug (type H for help)
(REQUIRE :ASDF-INSTALL NIL)
Source:
; File: target:code/module.lisp
(ERROR "Don't know how to load ~A" MODULE-NAME)
0] (quit)
dsm#localhost:~$
But sbcl works perfectly:
dsm#localhost:~$ sbcl -q
This is SBCL 1.0.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (require :asdf-install)
; loading system definition from
; /usr/lib/sbcl/sb-bsd-sockets/sb-bsd-sockets.asd into #<PACKAGE "ASDF0">
; registering #<SYSTEM SB-BSD-SOCKETS {AB01A89}> as SB-BSD-SOCKETS
; registering #<SYSTEM SB-BSD-SOCKETS-TESTS {AC67181}> as SB-BSD-SOCKETS-TESTS
("SB-BSD-SOCKETS" "ASDF-INSTALL")
* (quit)
Any ideas on how to fix this? I found this post on the internet, but using that didn't work either.
The instructions you got mentioned SBCL explicitely, so it's expected that they'll work better using SBCL, I suppose. Some other Lisps don't come with ASDF or don't hook it up to CL:REQUIRE. In the former case, you'll have load ASDF yourself beforehand. In the latter case, you'll need to call (asdf:oos 'asdf:load-op ) instead of (require ).
wget http://cclan.cvs.sourceforge.net/checkout/cclan/asdf/asdf.lisp
It worth checking out clbuild. http://common-lisp.net/project/clbuild/
To get a lisp webserver up and running. You only need:
darcs get http://common-lisp.net/project/clbuild/clbuild
cd clbuild
chmod +x ./clbuild
./clbuild check
./clbuild build slime hunchentoot
./clbuild preloaded
Now a lisp repl will start. There you write:
* (hunchentoot:start-server :port 8080)
Testing that the server answer:
wget -O - http://localhost:8080/
<html><head><title>Hunchentoot</title></head>
<body><h2>Hunchentoot Default Page</h2>
<p>This is the Hunchentoot default page....
try this before anything else:
(require :asdf)
you can steal some ideas from the environment we use. it's available at: darcsweb
see environment.lisp that loads and sets up asdf for us. (sbcl has asdf already loaded)
use clc:clc-require in clisp. Refer to 'man common-lisp-controller'. I had the same error in clisp and resolved it by using clc:clc-require. sbcl works fine with just require though.

Resources