i have standalone install GRASS from official web site, and i using python 2.7 32b and windows 10. i trying to works with python api from GRASS GIS 7.0.4. but i have import errors.
some imports work i can import in the python ide and some imports not works and i cant to using.
first i read this post grass python and i trying to take pygrass api python code :
import os, sys
import subprocess as subp
gisbase = os.environ['GISBASE'] = "C:\Program Files (x86)\GRASS GIS 7.0.4"
gisdbase = os.path.join(os.environ['HOME'])
location = "test"
mapset = "PERMANENT"
sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python","bin","extrabin","lib","driver","scripts"))
success imports
import grass.script as grass
from grass.pygrass.modules.shortcuts import general as g
from grass.pygrass.modules import Module as run_command
from grass.pygrass.modules.shortcuts import general as g
from grass import script as g
from grass.script import setup as gsetup
from grass.pygrass.modules.shortcuts import imagery as i
from pygrass.modules import Module
no success imports
from pygrass.modules import Module
error message: No module named pygrass.modules
2.from grass.pygrass.gis import Mapset
error message:
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
from grass.pygrass.gis import Mapset
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\gis\__init__.py", line 13, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
3.from grass.pygrass.vector import VectorTopo
error message :
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
from grass.pygrass.vector import VectorTopo
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\vector\__init__.py", line 3, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
4.from grass.pygrass.vector import Vector
error message :
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
from grass.pygrass.vector import Vector
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\vector\__init__.py", line 3, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
5.from grass.pygrass.raster import RasterRow
error message :
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
from grass.pygrass.raster import RasterRow
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\raster\__init__.py", line 14, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
6.from grass.pygrass.gis import Location
error message :
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
from grass.pygrass.gis import Location
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\gis\__init__.py", line 13, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
7.from grass.pygrass.gis.region import Region
error message:
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
from grass.pygrass.gis.region import Region
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\pygrass\gis\__init__.py", line 13, in <module>
import grass.lib.gis as libgis
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\gis.py", line 23, in <module>
_libs["grass_gis.7.0.4"] = load_library("grass_gis.7.0.4")
File "C:\Program Files (x86)\GRASS GIS 7.0.4\etc\python\grass\lib\ctypes_loader.py", line 57, in load_library
raise ImportError,"%s not found." % libname
ImportError: grass_gis.7.0.4 not found.
8.from grass.pygrass.modules import raster as r
error message: ImportError: cannot import name raster
9.from grass.pygrass.functions import coor2pixel
error message: No module named functions
10.import grass.scripts
error message :No module named scripts
any idea why to i can import some imports from the pygrass and why i cant import some other imports from pygrass ?