# 於 Lubuntu 上安裝 SciDAVis
> 作者:王一哲
> 日期:2020/4/1
## 前言
以前在舊版的 Linux 上安裝 SciDAVis 相當簡單,只要輸入以下的指令即可
```shell
sudo apt-get install scidavis
```
但是在新版的 Linux 發行版中卻很困難,這是因為 SciDAVis 使用的是 **qt4**,需要先解決套件的相依性問題才能安裝 SciDAVis。由於我之前在 Lubuntu 上測試時已經安裝了太多的套件,為了找出真正需要先安裝的套件,我用 [VMware Workstation Player](https://www.vmware.com/tw/products/workstation-player/workstation-player-evaluation.html) 建立虛擬機器,再於虛擬機器上安裝 Lubuntu 19.04,從作業系統剛安裝好的狀態下試著安裝 SciDAVis。
<br />
## 步驟
由於 SciDAVis 需要使用 **qt4**,雖然LUbuntu 裡本來就有 **/usr/share/qt4/** 這個資料夾,但裡面沒有我們需要的東西,先用以下指令安裝 qt4
```shell
sudo apt install qt4-dev-tools qt4-bin-dbg
```
再用以下的指令安裝編繹套件時需要的工具
```shell
sudo apt install make g++
```
其實需要的套件很多,但是 apt 會自動幫我們安裝 make 和 g++ 相依的套件。安裝完成之後,我們再安裝另一個必要的套件 **qwt**,但這次需要編譯安裝,先從以下的連結下載壓縮檔
https://sourceforge.net/projects/qwt/files/qwt/6.1.4/
進到壓縮檔所在的資料夾將檔案解壓縮
```shell
unzip qwt-6.1.4.zip
```
進入解壓縮後的資料夾中編譯並安裝套件
```shell
cd qwt-6.1.4
/usr/share/qt4/bin/qmake qwt.pro
make
sudo make install
```
最後用以下的指令新增包含 SciDAVis 的套件庫並安裝套件
```shell
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/hpcoder1/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/home:hpcoder1.list"
wget -nv https://download.opensuse.org/repositories/home:hpcoder1/xUbuntu_18.04/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-get update
sudo apt-get install scidavis
```
第一次使用 sudo apt-get install scidavis 安裝時可能會出現以下的錯誤訊息
```shell
正在讀取套件清單... 完成
正在重建相依關係
正在讀取狀態資料... 完成
您也許得執行 'apt --fix-broken install' 以修正這些問題。
下列的套件有未滿足的相依關係:
scidavis : 相依關係: libgsl23 但它卻將不會被安裝
相依關係: libgslcblas0 但它卻將不會被安裝
相依關係: libpython2.7 (>= 2.7) 但它卻將不會被安裝
相依關係: libqwt5-qt4 但它卻將不會被安裝
相依關係: libqwtplot3d-qt4 但它卻將不會被安裝
相依關係: python-qt4 但它卻將不會被安裝
E: 未能滿足相依關係。請試著不指定套件來執行 'apt --fix-broken install'(或採取其它的解決方案)。
```
依照錯誤訊息的建議執行以下指令
```shell
sudo apt --fix-broken install
```
修正安裝的套件之後再安裝一次 SciDAVis
```shell
sudo apt-get install scidavis
```
這次就成功了!以下是我在 Lubuntu 上執行 SciDAVis 的畫面截圖。
<img height="100%" width="100%" src="https://upload.cc/i1/2020/04/01/SXFN4Z.png
" style="display: block; margin-left: auto; margin-right: auto;"/>
<div style="text-align:center">於 Lubuntu 執行 SciDAVis</div>
</br>
## 結語
我有試著按照 SciDAVis 官網的說明書編譯安裝,但是在編譯安裝 [QwtPlot3D](http://qwtplot3d.sourceforge.net/) 時遇到障礙,試過很多方法都失敗,最後使用現成的套件庫才能成功安裝。不知道 SciDAVis 下次改版會不會改用新版的 qt,這樣安裝時會方便許多。
</br>
## 參考資料
1. **Qwt User's Guide** https://qwt.sourceforge.io/qwtinstall.html
2. **How to install sciDAVis on Ubuntu 18.04?** https://stackoverflow.com/questions/50955824/how-to-install-scidavis-on-ubuntu-18-04
---
## 2020/12/18 補充:於 Ubuntu 20.04 LTS 安裝 SciDAVis
先從這個[網頁](https://software.opensuse.org/download.html?project=home%3Ahpcoder1&package=scidavis)下載編譯好的 deb 檔,我下載的版本是 2.3.0,使用以下的指令安裝
```shell
sudo dpkg -i scidavis_2.3.0-1_amd64.deb
```
但是系統會回傳錯誤訊息,缺少 libpython3.6-dev,無法完成安裝。但是在 Ubuntu 20.04 LTS 預設的套件庫裡已經沒有 python3.6,我在另一個[網頁](https://askubuntu.com/questions/1231543/problem-with-creating-python-3-6-virtual-environment-on-ubuntu-20-04)找到了解決方案,使用以下的指令新增套件庫並安裝 python3.6,接著就能安裝 SciDAVis。
```shell
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
```
<img height="100%" width="100%" src="https://imgur.com/0hVBS8q.png" style="display: block; margin-left: auto; margin-right: auto;"/><br />
<div style="text-align:center">於 Ubuntu 20.04 LTS 執行 SciDAVis</div><br /><br />
<br />
---
## 2021/1/19 補充:於 Linux Mint 20.1 Ulyssa 安裝 SciDAVis
我使用的 GUI 為 xfce,完全按照這個[網頁](https://apurbapaul.wordpress.com/2020/05/15/installing-scidavis-on-ubuntu-20-04/)的指令操作,新增套件庫並用 apt-get 安裝即可。
<img height="100%" width="100%" src="https://i.imgur.com/FaI3l4g.png" style="display: block; margin-left: auto; margin-right: auto;"/><br />
<div style="text-align:center">於 Linux Mint 20.1 Ulyssa SciDAVis</div><br /><br />
<br />
---
## 2022/10/12 補充:於 Ubuntu 22.04.1 LTS 安裝 SciDAVis
這個[網頁](https://software.opensuse.org//download.html?project=home%3Ahpcoder1&package=scidavis)上有已經編譯好的版本,於終端機中依序輸入以下指令即可。<br /><br />
```shell
echo 'deb http://download.opensuse.org/repositories/home:/hpcoder1/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/home:hpcoder1.list
curl -fsSL https://download.opensuse.org/repositories/home:hpcoder1/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_hpcoder1.gpg > /dev/null
sudo apt update
sudo apt install scidavis
```
<br />
<img height="100%" width="100%" src="https://imgur.com/iDv5krG.png" style="display: block; margin-left: auto; margin-right: auto;"/><br />
<div style="text-align:center">於 Ubuntu 22.04.1 LTS 執行 SciDAVis</div><br /><br />
---
###### tags:`SciDAVis`、`Linux`