Open richiy opened 1 year ago
@richiy would you please provide some details on your system/setup?
For now, detectree2 has only been tested on Linux and in Colab notebooks so we would recommend either of those if available to you.
Ok,thanks!
I am using a 64-bit Windows 10 system, and Python version 3.8.10 in 64-bit.
Installing on windows can be a bit tricky. Try
GDAL (Geospatial Data Abstraction Library) is a translator library for raster and vector geospatial data formats and is necessary for rasterio to function. You can install it with conda, an open-source package management system and environment management system.
conda install -c conda-forge gdal
If you are not using Anaconda, you can download precompiled binaries for GDAL from GIS Internals.
After GDAL is installed, you need to add GDAL to your system's PATH and set the GDAL_CONFIG environment variable. This variable should point to the gdal-config script that was installed with GDAL.
The GDAL installation path will likely be something like C:\Program Files\GDAL. You should add C:\Program Files\GDAL to your PATH and set GDAL_CONFIG=C:\Program Files\GDAL\gdal-config.
If you can't find gdal-config (which can happen with some installations), then try setting the GDAL_VERSION environment variable to the version of GDAL you installed (like GDAL_VERSION=2.2.3).
You can set these variables in the "Environment Variables" section of your system settings on Windows, or you can set them in your shell before running pip:
set GDAL_CONFIG=C:\Program Files\GDAL\gdal-config
set GDAL_VERSION=2.2.3
pip install rasterio
Try installing rasterio with conda:
Since rasterio and GDAL can be tricky to install with pip on Windows, an easier option might be to just install rasterio with conda, which will also automatically handle the GDAL dependency:
conda install -c conda-forge rasterio
Please ensure that you replace the paths in the solutions above with the correct paths from your local system
Hi, I had the same issue on a Windows computer with Python version 3.10, but following these steps got me past this first error. However, now I get the following new errors during the installation of detectree2:
rasterio/_base.c(768): fatal error C1083: Cannot open include file: 'cpl_conv.h': No such file or directory error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for rasterio
error: could not create 'build\temp.win-amd64-cpython-310\Release\Users\xxx\AppData\Local\Temp\pip-install-unq9wwxu\detectron2_2daef03b29624941b7c8c5c6518219d5\detectron2': The filename or extension is too long [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for detectron2
Successfully built detectree2 Failed to build rasterio detectron2 ERROR: Could not build wheels for rasterio, detectron2, which is required to install pyproject.toml-based projects
Any suggestions on how to solve this?
I got the exact same error about rasterio but managed to build detectron2 by using:
pip install git+https://github.com/facebookresearch/detectron2.git@5aeb252b194b93dc2879b4ac34bc51a31b5aee13
I had to use: pip install rasterio though as using: conda install -c conda-forge rasterio was getting stuck at solving the environments.
I also had this problem before. Then I went through a series of experiments, and it worked. I didn't use the python environment directly but instead used anaconda.
Here are the specifications of the system I used:
Here are the steps I've done:
conda create --name detectree2 python=3.9
conda activate detectree2
conda install gdal pygeos geopandas numpy opencv -c conda-forge
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install git+https://github.com/facebookresearch/detectron2.git@5aeb252b194b93dc2879b4ac34bc51a31b5aee13
(there will be a detectron2 installation error if without @5aeb252b194b93dc2879b4ac34bc51a31b5aee13, I don't know yet because of what)where gdal-config
(example output C:\Users\AAmbarwari\anaconda3\envs\detectree2\Library\bin\gdal-config). Copy that information and paste in Edit the system environment variables for the user (yours) by click New... Variabel name: GDAL_CONFIG and Variable value: C:\Users\AAmbarwari\anaconda3\envs\detectree2\Library\bin\gdal-config (for example). Click OK and return to the terminal (Anaconda Prompt).gdalinfo --version
(example output GDAL 3.7.0, released 2023/05/02). And thenset GDAL_CONFIG=C:\Users\AAmbarwari\anaconda3\envs\detectree2\Library\bin\gdal-config
(customize with yours)set GDAL_VERSION=3.7.0
conda install -c conda-forge rasterio
git clone https://github.com/PatBall1/detectree2.git
filename = os.path.join(directory, filename)
--> line 665 (function get_filenames
). Because I have a problem related to image doesn't have shape, when running prediction.python -m pip install -e detectree2
Collecting rasterio==1.3a3 Using cached rasterio-1.3a3.tar.gz (401 kB) Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\xxxx\AppData\Local\Programs\Python\Python38\python.exe' 'C:\Users\xxxx\AppData\Local\Programs\Python\Python38\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\xxxx\AppData\Local\Temp\tmprw8grws6' cwd: C:\Users\xxxx\AppData\Local\Temp\pip-install-ozyk4_bv\rasterio_97d0b87c61a740218c42e09690312378 Complete output (2 lines): INFO:root:Building on Windows requires extra options to setup.py to locate needed GDAL files. More information is available in the README. ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.