Install Online 3Dmol Viewer on Linux

Q

How to install Online 3Dmol Viewer on my local Linux computer?

✍: FYIcenter.com

A

The easiest way to use the Online 3Dmol Viewer is through the hosted server at https://3dmol.org/viewer.html.

But if you want to have full control of the Online 3Dmol Viewer and faster response time, you can host it yourself on a Linux computer.

1. Make sure you have Python 3 installed:

fyicenter$ python3 --version 

Python 3.8.8

2. Install required tools:

fyicenter$ sudo dnf install npm python3-pip git

Installed:
  ...
  npm-1:6.14.11-1.10.24.0.1.module_el8.3.0+717+fa496f1d.x86_64   
  python3-pip-9.0.3-20.el8.noarch   
  git-2.27.0-1.el8.x86_64  

3. Install required Python modules:

fyicenter$ pip3 install flask flask_socketio eventlet
  
Successfully installed 
  ...
  flask-2.2.2
  flask-socketio-5.3.2 
  eventlet-0.33.2 

4. Download source code of 3Dmol.js library:

fyicenter$ git clone https://github.com/3dmol/3Dmol.js.git

Cloning into '3Dmol.js'...
remote: Enumerating objects: 27956, done.
remote: Counting objects: 100% (1587/1587), done.
remote: Compressing objects: 100% (800/800), done.
remote: Total 27956 (delta 832), reused 1456 (delta 762), pack-reused 26369
Receiving objects: 100% (27956/27956), 732.17 MiB | 16.45 MiB/s, done.
Resolving delta: 100% (15907/15907), done.
Updating files: 100% (961/961), done.

5. Install 3Dmol.js library:

fyicenter$ cd 3Dmol.js

fyicenter$ npm install
> 3dmol@1.8.0 build /home/fyicenter/3Dmol.js/packages/3dmol/3Dmol.js
> npm run build --workspaces

6. Verify installation result:

fyicenter$ ls -l learning-environment
  lrwxrwxrwx. 1 ... learning-environment -> packages/learning-environment

fyicenter$ ls -l packages/learning-environment
  -rw-r--r--. 1 ... README.md
  -rw-r--r--. 1 ... server.py
  -rw-r--r--. 1 ... sessions.js
  -rw-r--r--. 1 ... share.png
  lrwxrwxrwx. 1 ... static -> ../..

 

Start Online 3Dmol Viewer on Linux

Hosting Online 3Dmol Viewer

Hosting Online 3Dmol Viewer

⇑⇑ 3Dmol.js FAQ

2023-09-10, 350🔥, 0💬