インストール (01)
    Top > Python > 描画 > 地図 (cartopy)
    Abstruct
    概要
    This article is like this: I want to install cartopy. I can use pip unser virtual environment (venv), but in the first place dependant packages has not been installed. Therefore I install those packages. Note that I have no root authority in this environment. cartopyをインストールしたい.しかし,仮想環境(venv)でpipは使えるものの,そもそも依存パッケージがインストールされていない.なのでそれらのパッケージをソースからインストールする,という記事. なおルート権限は無い.
    Dependancy
    依存関係
    Following packages are required for installation. インストールには以下のパッケージが必要. > PROJ > GEOS Also, scipy and matplotlib (Python library) are necessary for runnig the sample script on the bottom. また最後のサンプルコードの実行にはscipyとmatplotlib (Pythonのライブラリ)が必要.
    Installation of SQLite
    SQLiteのインストール
    Installation of PROJ failed because the version of SQLite was too old, so I installed the latest version. PROJをインストールしようとしたらSQLiteのバージョンが古くてエラーになったので最新版をインストールした. Official web site of SQLite: SQLiteの公式サイト: + Home page + Download Compile. コンパイル Download the package, inflate and move to inflated directory. Execute: 次を実行: If you want to install to the directory which is not the default installation directory, set --prefix parameter as follows. In this example, it is installed to ~/local. デフォルトのインストール先と異なるディレクトリにインストールしたいときは--prefixパラメーターを指定する. この例では~/localにインストールされる. Then execute: 続いて次を実行: Set environment variables. 環境変数を設定する Set LD_LIBRARY_PATH and PKG_CONFIG_PATH. LD_LIBRARY_PATHとPKG_CONFIG_PATHを設定する. Add following lines to ~/.bash_profile. 次を~/.bash_profileに加える.
    Version confliction of SQLite
    SQLiteのバージョンの衝突
    When I tried to install PROJ which is dependant on SQLite, error was raised as follows: PROJをインストールしようとしたら次のようなエラーが発生した. In my case, SQLite had been already installed before I installed the latest version, and after installed the latest version, different versions of header and source were referred. It was because the positions of the path of the latest version (${HOME}/local) in two environment variables, LD_LIBRARY_PATH and PKG_CONFIG_PATH, were different; path of the latest version was in front of the path of the older version in the former one, and the oppotite in the latter one. 私の場合,SQLiteは元々インストールされており,最新版をインストールした結果,ヘッダーとソースで異なるバージョンが参照されるようになっていた. これはLD_LIBRARY_PATHとPKG_CONFIG_PATHとで最新版のパスと古いバージョンのパスの位置関係が逆になっていたためであった.
    Installation of PROJ (Linux)
    PROJのインストール (Linux)
    Official website of PROJ: PROJの公式サイト: + Home page + Installation + Download Same to SQLite. Download the package, inflate and move to inflated directory. Then configure and make. For this package, run test with "make check" at the end. SQLiteと同様.パッケージをダウンロード,展開し,展開したディレクトリに移動する.configureしてmake. このパッケージでは最後に"make check"でテストする.
    Installation of GEOS
    GEOSのインストール
    Official web site of GEOS: GEOSの公式サイト: + Home page Same to the previous packages. 上記のパッケージと同様.
    Error raised when installing cartopy (GEOS)
    cartopyインストール時に発生したエラー(GEOS)
    It says geos_c.h was not found like this: geos_c.hが見つからないという.次のようなエラーだった. + https://github.com/SciTools/cartopy/issues/1239 It was just a mistake that I didn't execute "make install" after "make". 単に"make"の後"make install"をし忘れていただけだった.
    Installation of Cartopy
    Cartopyのインストール
    Finally install cartopy. Install shapely at the same time. Carry out under the virtual environment of Python. ようやくcartopyのインストール.一緒にshapelyも入れる.Pythonの仮想環境下で実行. Activate virtual environment. 仮想環境に移行. Uninstall shapely and cartopy if they have been already installed. 既にshapelyとcartopyがインストールされている場合はアンインストールする. Install with the option to remove binary files (I don't know the reason). バイナリファイルを除くオプションを付けてインストール(理由は知らない).
    Test cartopy
    Cartopyを使ってみる
    Check if it works. ちゃんと動くか確認する.
    References
    Pythonで地理情報のマッピング!cartopy使ってみた - Qiita + https://qiita.com/hiroga/items/80b03b3cbf80650c2c2d PROJ — PROJ 7.1.1 documentation + https://proj.org/index.html SQLite Home Page + https://www.sqlite.org/index.html ソースからSQLiteをインストールする - noknow + https://noknow.info/it/os/install_sqlite_from_source?lang=ja SQLite header and source version mismatchを解決したメモ - Tales of Verifier + http://yoshikiito-el.hatenablog.com/entry/2014/11/24/121144 SQLite3でheader and source version mismatch - rougeref’s diary + https://rougeref.hatenablog.com/entry/20140121/1390283969 GEOS + https://trac.osgeo.org/geos/ Unable to install cartopy with pip3 · Issue #1239 · SciTools/cartopy · GitHub + https://github.com/SciTools/cartopy/issues/1239