Hazy Ideas

日々の勉強の気づきを書き出しています

UbuntuにGRASSをインストールする

バージョン確認

cat /etc/os-release

conda info

grass --help

 

環境

Ubuntu 20.04.1 Focal Fossa

Anaconda version 4.9.2

Python version 3.8.5

GRASS GIS 7.8.2

 

GRASSを以下のコマンドでインストール(最新版が入るはず)

sudo apt-get install grass grass-doc

 

起動するとエラーメッセージが出る

Starting GRASS GIS...
ERROR: wxGUI requires wxPython. No module named 'wx'
You can still use GRASS GIS modules in the command line or in Python.
ERROR: Error in GUI startup. See messages above (if any) and if necessary, please report this error to the GRASS developers.
On systems with package manager, make sure you have the right GUI package, probably named grass-gui, installed.
To run GRASS GIS in text mode use the --text flag.
Use '--help' for further options
grass78 --help
See also: https://grass.osgeo.org/grass78/manuals/helptext.html
Exiting...

 

condaでwxPythonをインストールしようとすると

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

- wxpython -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

 

これはpython3.8には非対応ということ?

conda install -c anaconda wxpython

これでは失敗したので、次のコマンドでインストール

conda install -c conda-forge wxpython

https://anaconda.org/conda-forge/wxpython

これでwxpythonはインストールされた

file name: wxpython-4.0.4-py37hc99224d_0.conda

 

またエラーが出る

Failed to load module "canberra-gtk-module"

OpenCVを使うときにも出るエラーのようで、以下のコマンドを実行

sudo apt-get install libcanberra-gtk*

 

これでもだめか、未解決

 

翌日の追記。

anacondaでpython3.7の仮想環境をつくり、その上で動かしてみた。

https://stackoverflow.com/questions/53544348/grass-fails-to-start

conda create -n grass_env python=3
conda activate grass_env
conda install wxpython
grass

とりあえずGUIで起動した。またエラーが出るかもしれないけども。