weecology / DeepForest

Python Package for Airborne RGB machine learning
https://deepforest.readthedocs.io/
MIT License
524 stars 176 forks source link

ImportError: DLL load failed while importing _version #841

Open wqfcv opened 3 days ago

wqfcv commented 3 days ago

Install using standard conda approach:

conda create -n deepforest python=3 pytorch torchvision cudatoolkit=10.2 -c pytorch
conda activate deepforest
conda install deepforest -c conda-forge

Then do some basic stuff. I ran this, not sure exact failure point:

from deepforest import main
from deepforest import get_data
from deepforest import visualize
import matplotlib.pyplot as plt
from deepforest.visualize import plot_predictions

model = main.deepforest()
model.load_model(model_name="weecology/deepforest-tree", revision="main")
raster_path = get_data("result.tif")
predicted_raster = model.predict_tile(raster_path, patch_size=300, patch_overlap=0.25,return_plot=True)
PS C:\Users\18774> & D:/anaconda/envs/deepforest/python.exe d:/treeDetection/tree_identify.py
Traceback (most recent call last):
  File "d:\treeDetection\tree_identify.py", line 1, in <module>
    from deepforest import main
  File "D:\anaconda\envs\deepforest\Lib\site-packages\deepforest\main.py", line 12, in <module>
    from deepforest import utilities
  File "D:\anaconda\envs\deepforest\Lib\site-packages\deepforest\utilities.py", line 10, in <module>
    import rasterio
  File "D:\anaconda\envs\deepforest\Lib\site-packages\rasterio\__init__.py", line 28, in <module>
    from rasterio._version import gdal_version, get_geos_version, get_proj_version
ImportError: DLL load failed while importing _version: 找不到指定的程序。
bw4sz commented 3 days ago

Thanks for reporting, can you print out info from conda list, it will tell us about package versions. Rasterio interacts with gdal, this is upstream of DeepForest and definitely particular to your own install. Start by creating an env, install rasterio https://rasterio.readthedocs.io/en/stable/installation.html and confirm you can achieve that first. I'll leave this open, but i'm not convinced there is anything we can do from DeepForest perspective.