ubarsc / tuiview

TuiView is a lightweight raster GIS with powerful raster attribute table manipulation abilities
http://tuiview.org/
GNU General Public License v2.0
26 stars 13 forks source link

ImportError: cannot import name 'vectorrasterizer' from 'tuiview' #29

Closed zhangch-ss closed 2 years ago

zhangch-ss commented 2 years ago

Hi, in viewerlayers.py, there is an error in "from . import vectorrasterizer", I guess the vectorrasterizer.py file is missing. But I only found that there is a vectorrasterizer.c file, are the two related? I am running tuiview under Windows Pycharm.

gillins commented 2 years ago

Yes the vectorrasterizer module is created from vectorrasterizer.c as part of the installation process. I am guessing you haven't run python setup.py install to build and install? I would note getting all this to work on Windows is very hard unless you are familiar with the Microsoft C++ Compiler. First you will need the appropriate version of MSVC for the Python you are using (see https://wiki.python.org/moin/WindowsCompilers). Secondly you will need to run vcvars.bat or whatever it is called these days to setup the environment for MSVC before running setup.py and set the GDAL_ROOT environment variable to the location of your gdal installation.

I would strongly recommend using conda-forge (https://conda-forge.org/) to install TuiView on Windows since this is all handled for you. All the required dependencies are also installed.

Compiling from source is much easier on Linux since the appropriate C/C++ compilers are installed (or very easy to obtain).

zhangch-ss commented 2 years ago

Yes the vectorrasterizer module is created from vectorrasterizer.c as part of the installation process. I am guessing you haven't run python setup.py install to build and install? I would note getting all this to work on Windows is very hard unless you are familiar with the Microsoft C++ Compiler. First you will need the appropriate version of MSVC for the Python you are using (see https://wiki.python.org/moin/WindowsCompilers). Secondly you will need to run vcvars.bat or whatever it is called these days to setup the environment for MSVC before running setup.py and set the GDAL_ROOT environment variable to the location of your gdal installation.

I would strongly recommend using conda-forge (https://conda-forge.org/) to install TuiView on Windows since this is all handled for you. All the required dependencies are also installed.

Compiling from source is much easier on Linux since the appropriate C/C++ compilers are installed (or very easy to obtain).

Thanks for your reply, I will try it

zhangch-ss commented 2 years ago

Thanks for your help, I successfully solved this problem using your suggestion