<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Jupyter on Chang Luo</title>
		<link>https://www.luochang.ink/tags/jupyter/</link>
		<description>Recent content in Jupyter on Chang Luo</description>
		<generator>Hugo</generator>
		<language>zh-CN</language>
		
		
		
		
			<lastBuildDate>Thu, 30 May 2024 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://www.luochang.ink/tags/jupyter/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>后台管理工具介绍</title>
				<link>https://www.luochang.ink/posts/process_manager/</link>
				<pubDate>Thu, 30 May 2024 00:00:00 +0000</pubDate>
				<guid>https://www.luochang.ink/posts/process_manager/</guid>
				<description>&lt;blockquote&gt;&#xA;&lt;p&gt;呀嘞呀嘞，我的 JupyterLab 怎么又挂了。&lt;/p&gt;&#xA;&lt;p&gt;简单的 &lt;code&gt;nohup [CMD] &amp;amp;&lt;/code&gt; 已经不够用，该研究一下后台管理工具了。&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;问了一下 Qwen，大概有五款后台管理工具可用。这五款工具大致可分为两类：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;进程管理器：&lt;code&gt;systemd&lt;/code&gt;, &lt;code&gt;pm2&lt;/code&gt;, &lt;code&gt;supervisor&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;终端复用器：&lt;code&gt;screen&lt;/code&gt;, &lt;code&gt;tmux&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;总之，保持单个程序在后台运行，&lt;code&gt;systemd&lt;/code&gt; 就够用。如果要维持多个后台程序，&lt;code&gt;pm2&lt;/code&gt; 比较合适。&lt;code&gt;screen&lt;/code&gt; 和 &lt;code&gt;tmux&lt;/code&gt; 则是更临时的方案，适合偶尔用用的情况。&lt;/p&gt;&#xA;&lt;h3 id=&#34;一systemd&#34;&gt;一、systemd&lt;/h3&gt;&#xA;&lt;p&gt;使用 systemd 管理 Jupyter lab 服务，必须先创建一个 systemd unit 文件来定义服务的启动、重启等行为。以下是创建 systemd 服务的步骤。&lt;/p&gt;&#xA;&lt;h4 id=&#34;11-创建-unit-文件&#34;&gt;1.1 创建 unit 文件&lt;/h4&gt;&#xA;&lt;p&gt;用 &lt;code&gt;vi&lt;/code&gt; 新建并打开 &lt;code&gt;jupyterlab.service&lt;/code&gt; 文件：&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo vi /etc/systemd/system/jupyterlab.service&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;配置如下：&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[Unit]&#xA;Description=Jupyter Lab&#xA;After=network.target&#xA;&#xA;[Service]&#xA;Type=simple&#xA;User=[YOUR_USERNAME]&#xA;ExecStart=/home/[YOUR_USERNAME]/miniconda3/bin/jupyter lab --ip=0.0.0.0 --port=443 --no-browser --allow-root&#xA;WorkingDirectory=/home/[YOUR_USERNAME]/&#xA;Restart=on-failure&#xA;RestartSec=8s&#xA;&#xA;[Install]&#xA;WantedBy=multi-user.target&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#xA;&lt;li&gt;将 &lt;code&gt;[YOUR_USERNAME]&lt;/code&gt; 替换为你的用户名。如果你在 root 上开服务，记得在 ExecStart 后加一个 &lt;code&gt;--allow-root&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;如果你的服务不在 https 上，请用 &lt;code&gt;--port=80&lt;/code&gt; 或 &lt;code&gt;--port=8888&lt;/code&gt; 之类的其他端口&lt;/li&gt;&#xA;&lt;li&gt;在 https 上搭建 jupyter lab 服务的方法，参见 &lt;a href=&#34;https://www.luochang.ink/posts/jupyter_lab/#51-%E5%90%AF%E5%8A%A8-jupyterlab&#34; target=&#34;_blank&#34;&gt;在服务器上使用 JupyterLab&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;12-启动服务&#34;&gt;1.2 启动服务&lt;/h4&gt;&#xA;&lt;p&gt;1）重启守护进程，使新增的 systemd unit 文件生效。&lt;/p&gt;</description>
			</item>
			<item>
				<title>JupyterLab 中有哪些黑科技</title>
				<link>https://www.luochang.ink/posts/jupyter_lab/</link>
				<pubDate>Wed, 15 May 2024 00:00:00 +0000</pubDate>
				<guid>https://www.luochang.ink/posts/jupyter_lab/</guid>
				<description>&lt;p&gt;JupyterLab 你是真的火了&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;5 月 14 号 &lt;a href=&#34;https://openai.com/index/spring-update/&#34; target=&#34;_blank&#34;&gt;OpenAI 春季发布会&lt;/a&gt; 出现了这个画面：&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.luochang.ink/img/openai_jupyter_lab.PNG&#34; alt=&#34;openai_jupyter_lab&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;才知道 &lt;a href=&#34;https://jupyterlab.readthedocs.io/en/latest/&#34; target=&#34;_blank&#34;&gt;JupyterLab&lt;/a&gt; 是 OpenAI 的日常开发工具。感谢 OpenAI 亲自带货。&lt;/p&gt;&#xA;&lt;p&gt;JupyterLab 拥有丰富的功能，并不只是 Python 解释器这么简单，让我向你们展示它的强大！&lt;/p&gt;&#xA;&lt;h3 id=&#34;安装-jupyterlab&#34;&gt;〇、安装 JupyterLab&lt;/h3&gt;&#xA;&lt;p&gt;执行以下命令安装 JupyterLab：&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# For miniconda user&#xA;conda install -c conda-forge jupyterlab&#xA;&#xA;# For conda-forge user&#xA;# mamba install -c conda-forge jupyterlab&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;a href=&#34;https://github.com/mamba-org/mamba&#34; target=&#34;_blank&#34;&gt;mamba&lt;/a&gt; 是 &lt;a href=&#34;https://github.com/conda-forge/miniforge&#34; target=&#34;_blank&#34;&gt;miniforge&lt;/a&gt; 自带的包管理工具。在 miniforge 环境中，你可以用 &lt;code&gt;mamba&lt;/code&gt; 替代 &lt;code&gt;conda&lt;/code&gt;，比如 &lt;code&gt;mamba info --envs&lt;/code&gt;。使用 mamba 通常可以获得更高的下载速度。&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;一制作-ppt&#34;&gt;一、制作 PPT&lt;/h3&gt;&#xA;&lt;h4 id=&#34;11-notebook-转-ppt&#34;&gt;1.1 Notebook 转 PPT&lt;/h4&gt;&#xA;&lt;p&gt;只需两步，就能把 Notebook 转成 PPT：&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;设置 Slide Type&lt;/strong&gt;：为保证页面被正确渲染，你需要设置 Cell 的 &lt;code&gt;Slide Type&lt;/code&gt;。对于新版 Jupyter Lab，在右侧边栏上有带俩齿轮的按钮，点进去，然后一路点 &lt;code&gt;[Property Inspector] -&amp;gt; [COMMON TOOLS] -&amp;gt; [Slide Type]&lt;/code&gt;，在这里对 Cell 进行设置。&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
