Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to install on 64-bit Windows 10 system, and Python version 3.8.10 #92

Open
richiy opened this issue Apr 10, 2023 · 5 comments
Open
Labels
help wanted Extra attention is needed

Comments

@richiy
Copy link

richiy commented Apr 10, 2023

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.

@PatBall1
Copy link
Owner

@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.

@richiy
Copy link
Author

richiy commented Apr 12, 2023

Ok,thanks!
I am using a 64-bit Windows 10 system, and Python version 3.8.10 in 64-bit.

@PatBall1 PatBall1 changed the title py -3.8 -m pip install git+https://github.com/PatBall1/detectree2.git rasterio install error Failure to install on 64-bit Windows 10 system, and Python version 3.8.10 Apr 12, 2023
@PatBall1 PatBall1 added the help wanted Extra attention is needed label Apr 17, 2023
@PatBall1
Copy link
Owner

PatBall1 commented Jun 12, 2023

Installing on windows can be a bit tricky. Try

  1. Install GDAL:

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.

  1. Set GDAL environment variables:

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

@jvanpassel
Copy link

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?

@PatBall1 PatBall1 pinned this issue Nov 28, 2023
@xabierr
Copy link

xabierr commented Feb 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants