简体   繁体   English

尝试在 Linux 服务器上运行 jupyter notebook

[英]Trying to run a jupyter notebook on a Linux server

I am trying to run jupyter notebook on a server I have access to but it keeps throwing out this error:我正在尝试在我有权访问的服务器上运行jupyter notebook ,但它不断抛出此错误:

I have tried using pip3 install --user sqlite3 and pip install --user pysqlite2 plus a bunch of other combinations which keeps leading me down a rabbit hole of errors.我曾尝试使用pip3 install --user sqlite3pip install --user pysqlite2加上一堆其他组合,这些组合一直让我pip3 install --user sqlite3

Any help would be great.任何帮助都会很棒。

-bash-4.2$ jupyter notebook
    Traceback (most recent call last):
      File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
        import sqlite3
      File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
        from sqlite3.dbapi2 import *
      File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
        from _sqlite3 import *
    ModuleNotFoundError: No module named '_sqlite3'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/data/users/USER/.local/bin/jupyter-notebook", line 6, in <module>
        from notebook.notebookapp import main
      File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/notebookapp.py", line 86, in <module>
        from .services.sessions.sessionmanager import SessionManager
      File "/data/users/USER/.local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
        from pysqlite2 import dbapi2 as sqlite3
    ModuleNotFoundError: No module named 'pysqlite2'

Output1:输出 1:

-bash-4.2$ hostnamectl
   Static hostname: SERVER_NAME
         Icon name: computer-server
           Chassis: server
        Machine ID: 807cc73fa4ba404192edd7c64de3cf3f
           Boot ID: 279d14738e2548d2b0622b399a9dfd40
  Operating System: Red Hat Enterprise Linux
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.6:GA:server
            Kernel: Linux 3.10.0-957.10.1.el7.x86_64
      Architecture: x86-64

Output2输出 2

-bash-4.2$ yum install sqlite-devel
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Repo rhel-7-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/766154663321574841286633-key.pem
You need to be root to perform this command.

So seems like you have multiple Python installations.所以看起来你有多个 Python 安装。

Do the following steps:执行以下步骤:

  1. Go to your home directory转到您的主目录
  2. Make a virtual environment using使用创建虚拟环境

python3.6 -m venv env

  1. Activate the venv激活 venv

source env/bin/activate

  1. Install Jupyter安装 Jupyter

python -m pip install --upgrade pip

python -m pip install jupyter

  1. Run jupyter notebook运行 jupyter 笔记本

jupyter notebook

  1. To open the notebook make sure you put localhost:8888 into your putty tunnel configuration and then open localhost:8888 on your local web browser要打开笔记本,请确保将 localhost:8888 放入腻子隧道配置中,然后在本地 Web 浏览器上打开 localhost:8888

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM