Testing GMT/Python on WSL (Ubuntu) on Windows 10 Pro
GMT/Pythonの開発がこちらで進められ,一通りの機能が実装されたようですので,試用してみます.現在のところ,Windows版はサポートされていませんので,WSL上のLinux (Ubuntu 16.04)で行います.
GMT-6のインストール
こちらのページを参考にインストールを行います.Anaconda3がインストールされていることを前提にします.conda environmentで専用の環境を構築することが勧められていますので,これに従います.こうすることで,これまでに構築してきた環境を汚染することなく,試用ができます.
最初にPython3.6とpipだけがインストールされたconda environment(gmt-python)を構築します.
[cc lang="bash"]
$ conda create --name gmt-python python=3.6 pip
[/cc]
この環境をactivateします.
[cc lang="bash"]
$ source activate gmt-python
[/cc]
ちなみに,現在の環境は
[cc lang="bash"]
$ conda info -e
[/cc]
で確認できます.また,元の環境に戻すには
[cc lang="bash"]
$ source deactivate
[/cc]
です.
GMT-6をインストールします.これは非常に時間がかかります.私の環境では既にGMT-6のビルドを行いましたので二重にインストールすることになりますが,干渉はしません.
[cc lang="bash"]
$ conda install gmt -c conda-forge/label/dev -c conda-forge
[/cc]
最後に他の依存関係にあるパッケージをインストールします.
[cc lang="bash"]
$ conda install numpy -c conda-forge
[/cc]
以上でGMT-6のインストールはおわりです.
GMT/Pythonのインストール
pipでGMT/Pythonをインストールします.
[cc lang="bash"]
$ pip install https://github.com/GenericMappingTools/gmt-python/archive/master.zip
[/cc]
さらに,後で必要となる依存パッケージをいくつかインストールしておきます.
[cc lang="bash"]
$ conda install pytest pytest-mpl -c conda-forge
[/cc]
テスト
最後にテストしましょう.Pythonの環境(例えば,Jupyter notebook)で以下のようにタイプします.
[cc lang="python"]
import gmt
gmt.test()
[/cc]
その結果,以下のようになり大丈夫のようです.1回目は一つWarningが出ましたが,以下のように2回目に実行したらWarningが出なくなっていました.
[cc]
================================================= test session starts ==================================================
platform linux -- Python 3.6.1, pytest-3.3.1, py-1.5.2, pluggy-0.6.0 -- /home/teem/anaconda3/bin/python
cachedir: .cache
Matplotlib: 2.1.0
Freetype: 2.7.0
rootdir: /home/teem, inifile:
plugins: mpl-0.9
collecting ... collected 87 items
anaconda3/lib/python3.6/site-packages/gmt/decorators.py::gmt.decorators.fmt_docstring PASSED [ 1%]
anaconda3/lib/python3.6/site-packages/gmt/decorators.py::gmt.decorators.kwargs_to_strings PASSED [ 2%]
anaconda3/lib/python3.6/site-packages/gmt/decorators.py::gmt.decorators.use_alias PASSED [ 3%]
anaconda3/lib/python3.6/site-packages/gmt/figure.py::gmt.figure.Figure PASSED [ 4%]
anaconda3/lib/python3.6/site-packages/gmt/utils.py::gmt.utils.build_arg_string PASSED [ 5%]
anaconda3/lib/python3.6/site-packages/gmt/utils.py::gmt.utils.data_kind PASSED [ 6%]
anaconda3/lib/python3.6/site-packages/gmt/utils.py::gmt.utils.dummy_context PASSED [ 8%]
anaconda3/lib/python3.6/site-packages/gmt/utils.py::gmt.utils.is_nonstr_iter PASSED [ 9%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT PASSED [ 10%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT._check_dtype_and_dim PASSED [ 11%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT.log_to_file PASSED [ 12%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT.matrix_to_vfile PASSED [ 13%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT.open_virtual_file PASSED [ 14%]
anaconda3/lib/python3.6/site-packages/gmt/clib/core.py::gmt.clib.core.LibGMT.vectors_to_vfile PASSED [ 16%]
anaconda3/lib/python3.6/site-packages/gmt/clib/utils.py::gmt.clib.utils.kwargs_to_ctypes_array PASSED [ 17%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_required_args PASSED [ 18%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_d PASSED [ 19%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_d_raises PASSED [ 20%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap PASSED [ 21%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_list_region PASSED [ 22%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_loglog PASSED [ 24%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_power_axis PASSED [ 25%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_polar PASSED [ 26%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_winkel_tripel PASSED [ 27%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_basemap.py::test_basemap_aliases PASSED [ 28%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_load_libgmt PASSED [ 29%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_load_libgmt_fail PASSED [ 31%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_check_libgmt PASSED [ 32%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_clib_extension PASSED [ 33%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_constant PASSED [ 34%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_create_destroy_session PASSED [ 35%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_destroy_session_fails PASSED [ 36%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_set_log_file_fails PASSED [ 37%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_errors_sent_to_log_file PASSED [ 39%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_call_module PASSED [ 40%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_call_module_error_message PASSED [ 41%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_call_module_invalid_name PASSED [ 42%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_method_no_session PASSED [ 43%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_parse_data_family_single PASSED [ 44%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_parse_data_family_via PASSED [ 45%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_parse_data_family_fails PASSED [ 47%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_create_data_dataset PASSED [ 48%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_create_data_grid_dim PASSED [ 49%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_create_data_grid_range PASSED [ 50%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_create_data_fails PASSED [ 51%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_vector PASSED [ 52%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_vector_invalid_dtype PASSED [ 54%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_vector_wrong_column PASSED [ 55%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_vector_2d_fails PASSED [ 56%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_matrix PASSED [ 57%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_put_matrix_grid PASSED [ 58%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_virtual_file PASSED [ 59%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_virtual_file_bad_direction PASSED [ 60%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_vectors_to_vfile PASSED [ 62%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_vectors_to_vfile_transpose PASSED [ 63%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_vectors_to_vfile_diff_size PASSED [ 64%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_matrix_to_vfile PASSED [ 65%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_clib.py::test_matrix_to_vfile_slice PASSED [ 66%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_coast.py::test_coast PASSED [ 67%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_coast.py::test_coast_iceland PASSED [ 68%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_coast.py::test_coast_aliases PASSED [ 70%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_coast.py::test_coast_world_mercator PASSED [ 71%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_decorators.py::test_kwargs_to_strings_fails PASSED [ 72%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_decorators.py::test_kwargs_to_strings_no_bools PASSED [ 73%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_figure.py::test_figure_unique_name PASSED [ 74%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_figure.py::test_figure_savefig_exists PASSED [ 75%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_figure.py::test_figure_savefig_transparent PASSED [ 77%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_figure.py::test_figure_savefig PASSED [ 78%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_figure.py::test_figure_show PASSED [ 79%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_gmtlogo.py::test_gmtlogo PASSED [ 80%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_gmtlogo.py::test_gmtlogo_on_a_map PASSED [ 81%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_red_circles PASSED [ 82%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_fail_no_data PASSED [ 83%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_fail_size_color PASSED [ 85%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_projection PASSED [ 86%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_colors PASSED [ 87%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_sizes PASSED [ 88%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_colors_sizes PASSED [ 89%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_colors_sizes_proj PASSED [ 90%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_matrix PASSED [ 91%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_matrix_color PASSED [ 93%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_plot.py::test_plot_from_file PASSED [ 94%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_psconvert.py::test_psconvert PASSED [ 95%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_psconvert.py::test_psconvert_twice PASSED [ 96%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_psconvert.py::test_psconvert_int_options PASSED [ 97%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_psconvert.py::test_psconvert_aliases PASSED [ 98%]
anaconda3/lib/python3.6/site-packages/gmt/tests/test_session_management.py::test_begin_end PASSED [100%]
============================================== 87 passed in 29.87 seconds ==============================================
[/cc]