martibosch / pylandstats

Computing landscape metrics in the Python ecosystem
https://doi.org/10.1371/journal.pone.0225734
GNU General Public License v3.0
82 stars 16 forks source link

warnning when import pylandstats #4

Closed guof2019 closed 4 years ago

guof2019 commented 4 years ago

Dear sir, When I run import pylandstats as pls in pycharm, it shows warnning. Module C:\Softwares\20.Python\Lib\site-packages\pylandstats\landscape.py has not been compiled for Transonic-Numba. What does it mean and how should I solve this problem? Thanks for your help.

martibosch commented 4 years ago

in order to address this, I'd need more information about your environment. There actually is an issue template to report bugs in this repository. Additionally, could you provide more information about your Python environment, e.g., if you are using conda, could you paste the output of running conda env export?

Best, Martí

Yasharjamei commented 4 years ago

Hi Marti;

Ive recently facing the same issue;

Python 3.7 Pylandstasts the latest version and 2.0.1

When I run the code on my windows 10 I face this error: \landscape.py has not been compiled for Transonic-Numba.

I used to work with this library a few days ago with no issue and I recently faced this issue

image

Cheers

martibosch commented 4 years ago

Hello Yashar,

thank you for reporting this. The main implication of this issue is that the computation of the adjacency matrix (computed the first time - and only the first time - that one of the following metrics is computed: total_edge, edge_density with count_boundary=False and contagion) will be quite slow. But the rest should function normally.

Nonetheless, I will get access to a Windows computer in order to try to shine some light into why this warning appears. Could you please provide me a list of the packages (and version) of the conda environment in which you are using PyLandStats (e.g., the output of running conda env export)?

Yasharjamei commented 4 years ago

Thanks, Marti for your reply;

after downloading the Anaconda (with python 3.7) in a new environment; I tried to download " conda install -c conda-forge/label/cf202003 pylandstats " in my Anaconda terminal ( i thought maybe i will not face this error in the previous version) as around 1 month ago I did not receive any error regarding this library;

I thought that might be related to my raster image but I tried with smaller raster however similar error comes up!

Anyway, I end up using IDRISI TERRSET for mapping the landscape metric on my Tiff ( the spatial resolution is 20 cm) ;

Normally it took a lot of time previously to generate hundreds of fishnet to keep the resolution and be able to map lots of landscape metrics in FRAGSTATS;

I assume if I run the landscape metrics one by one then this error would not show up again!

Thanks for your kind supports in advance;

Cheers

List of packages :

image

image

Numba : 0.48.0

Transonic : 0.4.2

P.S : Please let me know if you need any other information and if running this library is easier on Linux

martibosch commented 4 years ago

Hello Yashar, thank you for sending me the details.

I am glad to see that the warning does not come up anymore. Let me know if this comes up again. In any case, such a warning does not depend on your raster image - it is an issue of code compilation that is completely independent of the data used - but rather in your system (Windows and its version) the version of numba, transonic and the version of some other dependencies which I honestly do not know very well. It is most likely easier to run this library in Linux or OSX, nevertheless it should be working properly in Windows as well.

I do not know which kind of analysis you intend to perform, but if you do not need all the metrics, it might be a good idea to specify the metrics that you need with the metrics argument (see the section "Selecting the metrics to compute" in the 01-landscape-analysis example notebook) so that only those metrics are computed. This is especially relevant if you do not need to compute any euclidean nearest neighbour related metric.

Let me know if the warning comes again and I will try to get a windows computer and reproduce your environment.

Best, Martí

Yasharjamei commented 4 years ago

Thanks, Marti for the comprehensive and great reply;

I will let you know if any issue arise in the future;

Cheers

martibosch commented 4 years ago

Thank you @Yasharjamei, I am then closing this for now. Feel free to reopen if needed. Best,

Martí

ffrosch commented 3 years ago

Hi, I discovered that the conda-repository does not contain a __numba__ folder. I think transonic should compile this folder on-the-fly, but in my case it does not.

An easy fix is to run transonic landscape.py -b numba within the pylandstats package folder. Of course it is necessary to activate the respective conda environment before running the command.

Would it be possible to provide a pre-compiled __numba__ folder with the conda package?

Best, Florian

jingliu0217 commented 1 year ago

Dear Sir, This warning will still appear after I change the conda environment. Is there any other solution for it? Another question, will this warning affect the precession speed? cheers

sacridini commented 4 months ago

It worked for me just installing numba with "pip install numba"