LoginSignup
0

More than 5 years have passed since last update.

Python3 setup on ubuntu18

Last updated at Posted at 2018-10-13

今の所、困っていることは(PCが古くて万事が重たいこと以外)ないのだが、一応、メモを取っておく。

  • pip3 を apt-get でinstall する。
  • pip3 で必要なpython3 のモジュールをインストールする。
  • numpy, pandas, statsmodels, sci

備忘録として、
- pip3 はsudo で実行したが、sudo -H で実行したほうが良いという警告メッセージが出た。
今後はそうしよう。~/.cache/pip の権限がない、ということらしい。
- statsmodel は最初にpip3 install しただけだと関連するライブラリがproperly にinstall されなかったらしい。
ので、再度、pip3 install -U したところ、何かがインストールされ、無事に動くようになった。症状としては、これと同じだった。


$ sudo apt-get install python3-pip
$ sudo -H pip3 install pandas
$ sudo -H pip3 install statsmodels
$ sudo -H pip3 install -U statsmodels

特に意味はないが、実行時のメッセージも一部コピペしておく。

$ sudo apt-get install python3-pip
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
  libconsole-bridge-dev libconsole-bridge0.4 liburdfdom-dev liburdfdom-headers-dev liburdfdom-model liburdfdom-model-state liburdfdom-sensor liburdfdom-world
これを削除するには 'sudo apt autoremove' を利用してください。
以下の追加パッケージがインストールされます:
  python-pip-whl python3-setuptools python3-wheel
提案パッケージ:
  python-setuptools-doc
以下のパッケージが新たにインストールされます:
  python-pip-whl python3-pip python3-setuptools python3-wheel
アップグレード: 0 個、新規インストール: 4 個、削除: 0 個、保留: 7 個。
2,050 kB のアーカイブを取得する必要があります。
この操作後に追加で 3,928 kB のディスク容量が消費されます。
続行しますか? [Y/n] 
取得:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 python-pip-whl all 9.0.1-2.3~ubuntu1 [1,652 kB]
取得:2 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 python3-pip all 9.0.1-2.3~ubuntu1 [114 kB]                                                                                        
取得:3 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 python3-setuptools all 39.0.1-2 [248 kB]                                                                                                      
取得:4 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-wheel all 0.30.0-0.2 [36.5 kB]                                                                                                    
2,050 kB を 9秒 で取得しました (225 kB/s)                                                                                                                                                                  
以前に未選択のパッケージ python-pip-whl を選択しています。
(データベースを読み込んでいます ... 現在 205501 個のファイルとディレクトリがインストールされています。)
.../python-pip-whl_9.0.1-2.3~ubuntu1_all.deb を展開する準備をしています ...
python-pip-whl (9.0.1-2.3~ubuntu1) を展開しています...
以前に未選択のパッケージ python3-pip を選択しています。
.../python3-pip_9.0.1-2.3~ubuntu1_all.deb を展開する準備をしています ...
python3-pip (9.0.1-2.3~ubuntu1) を展開しています...
以前に未選択のパッケージ python3-setuptools を選択しています。
.../python3-setuptools_39.0.1-2_all.deb を展開する準備をしています ...
python3-setuptools (39.0.1-2) を展開しています...
以前に未選択のパッケージ python3-wheel を選択しています。
.../python3-wheel_0.30.0-0.2_all.deb を展開する準備をしています ...
python3-wheel (0.30.0-0.2) を展開しています...
python-pip-whl (9.0.1-2.3~ubuntu1) を設定しています ...
python3-wheel (0.30.0-0.2) を設定しています ...
python3-pip (9.0.1-2.3~ubuntu1) を設定しています ...
man-db (2.8.3-2) のトリガを処理しています ...
python3-setuptools (39.0.1-2) を設定しています ...

$ sudo -H pip3 install pandas
$ sudo -H pip3 install statsmodel
$ sudo -H pip3 install statsmodels
Collecting statsmodels
  Downloading https://files.pythonhosted.org/packages/85/d1/69ee7e757f657e7f527cbf500ec2d295396e5bcec873cf4eb68962c41024/statsmodels-0.9.0-cp36-cp36m-manylinux1_x86_64.whl (7.4MB)
    100% |████████████████████████████████| 7.4MB 26kB/s 
Requirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from statsmodels)
Collecting patsy (from statsmodels)
  Downloading https://files.pythonhosted.org/packages/5d/eb/92c4b45ca47a2dd1339c958636e083b50ffadb5162a599a1cbbe92f89832/patsy-0.5.0-py2.py3-none-any.whl (232kB)
    100% |████████████████████████████████| 235kB 494kB/s 
Requirement already satisfied: python-dateutil>=2.5.0 in /usr/local/lib/python3.6/dist-packages (from pandas->statsmodels)
Requirement already satisfied: pytz>=2011k in /usr/lib/python3/dist-packages (from pandas->statsmodels)
Requirement already satisfied: numpy>=1.9.0 in /usr/lib/python3/dist-packages (from pandas->statsmodels)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from patsy->statsmodels)
Installing collected packages: patsy, statsmodels
Successfully installed patsy-0.5.0 statsmodels-0.9.0
$ sudo -H pip3 install scipy
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/a8/0b/f163da98d3a01b3e0ef1cab8dd2123c34aee2bafbb1c5bffa354cc8a1730/scipy-1.1.0-cp36-cp36m-manylinux1_x86_64.whl (31.2MB)
    100% |████████████████████████████████| 31.2MB 13kB/s 
Requirement already satisfied: numpy>=1.8.2 in /usr/lib/python3/dist-packages (from scipy)
Installing collected packages: scipy
Successfully installed scipy-1.1.0
$ sudo -H pip3 install -U statsmodels
Requirement already up-to-date: statsmodels in /usr/local/lib/python3.6/dist-packages
Requirement already up-to-date: patsy in /usr/local/lib/python3.6/dist-packages (from statsmodels)
Requirement already up-to-date: pandas in /usr/local/lib/python3.6/dist-packages (from statsmodels)
Requirement already up-to-date: six in /usr/lib/python3/dist-packages (from patsy->statsmodels)
Collecting numpy>=1.4 (from patsy->statsmodels)
  Downloading https://files.pythonhosted.org/packages/22/02/bae88c4aaea4256d890adbf3f7cf33e59a443f9985cf91cd08a35656676a/numpy-1.15.2-cp36-cp36m-manylinux1_x86_64.whl (13.9MB)
    100% |████████████████████████████████| 13.9MB 20kB/s 
Collecting pytz>=2011k (from pandas->statsmodels)
  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 985kB/s 
Requirement already up-to-date: python-dateutil>=2.5.0 in /usr/local/lib/python3.6/dist-packages (from pandas->statsmodels)
Installing collected packages: numpy, pytz
  Found existing installation: numpy 1.13.3
    Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: pytz 2018.3
    Not uninstalling pytz at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed numpy-1.15.2 pytz-2018.5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0