ghislainv / forestatrisk

šŸ“¦šŸ Python package to model and forecast the risk of deforestation
https://ecology.ghislainv.fr/forestatrisk
GNU General Public License v3.0
116 stars 27 forks source link

Installation testing #56

Closed felipedantas-pi closed 3 years ago

felipedantas-pi commented 3 years ago

I did the installation via conda as described here and when testing the installation by running "forestatrisk" I get this import error:

no display found. Using non-interactive Agg backend
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):`
  File "c:\users\felip\miniconda3\envs\conda-far\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\felip\miniconda3\envs\conda-far\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\felip\miniconda3\envs\conda-far\Scripts\forestatrisk.exe\__main__.py", line 4, in <module>
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\__init__.py", line 29, in <module>
    from .model import cellneigh, cellneigh_ctry
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\model\__init__.py", line 13, in <module>
    from .model_binomial_iCAR import model_binomial_iCAR
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\model\model_binomial_iCAR.py", line 24, in <module>
    from .. import hbm
ImportError: numpy.core.multiarray failed to import
ghislainv commented 3 years ago

Dear Felipe, Thanks for your feedback. This is a dependency problem due to a wrong version of Numpy. You can try:

  1. Removing the conda-far Python virtual environment:

    conda env remove --name conda-far
  2. Re-create the environment and install the Python packages using the conda-forge channel:

    conda create --name conda-far -c conda-forge python=3.7 gdal numpy matplotlib pandas patsy pip statsmodels earthengine-api --yes
    conda activate conda-far
    pip install pywdpa sklearn
    pip install forestatrisk

    This should solve your problem. Could you try and tell me if it is working. I will update the documentation accordingly. Sincerely,

ghislainv commented 3 years ago

@felipedantas-pi, did you have time to try the installation with the conda-forge channel?