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

Unable to open EPSG support file gcs.csv (GDAL 3.0.1 PROJ 6.1.1) #1787

Closed
snowman2 opened this issue Sep 24, 2019 · 9 comments
Closed

Unable to open EPSG support file gcs.csv (GDAL 3.0.1 PROJ 6.1.1) #1787

snowman2 opened this issue Sep 24, 2019 · 9 comments
Labels

Comments

@snowman2
Copy link
Member

Not sure if this is a rasterio or a GDAL problem. Currently leaning towards GDAL, but figured I would start here.

Observed behavior

CPLE_OpenFailedError                      Traceback (most recent call last)
rasterio/_crs.pyx in rasterio._crs._CRS.from_epsg()

rasterio/_err.pyx in rasterio._err.exc_wrap_int()

CPLE_OpenFailedError: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.

During handling of the above exception, another exception occurred:

CRSError                                  Traceback (most recent call last)
<ipython-input-13-2f2ceb7ed749> in <module>
      1 with rasterio.Env():
----> 2     cc = CRS.from_epsg(6933)

~/.local/lib/python3.6/site-packages/rasterio/crs.py in from_epsg(cls, code)
    301         """
    302         obj = cls()
--> 303         obj._crs = _CRS.from_epsg(code)
    304         return obj
    305 

rasterio/_crs.pyx in rasterio._crs._CRS.from_epsg()

CRSError: The EPSG code is unknown. Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.

Data directory contents

ls $GDAL_DATA | grep header.dxf
header.dxf

gcs.csv is missing from the directory.

Steps to reproduce the problem.

import rasterio
from rasterio.crs import CRS

cc = CRS.from_epsg(6933)
import rasterio
from rasterio.crs import CRS

with rasterio.Env():
    cc = CRS.from_epsg(6933)

Operating system

    python: 3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 21:52:21)  [GCC 7.3.0]
   machine: Linux-4.15.0-64-generic-x86_64-with-debian-buster-sid

Rasterio version and provenance

rasterio                  1.0.28           py36h900e953_0    conda-forge
libgdal                   3.0.1                hf47eb90_8    conda-forge
proj4                     6.1.1                hc80f0dc_1    conda-forge
@snowman2 snowman2 changed the title cannot find gcs.csv (GDAL 3.0.1 PROJ 6.1.1) Unable to open EPSG support file gcs.csv (GDAL 3.0.1 PROJ 6.1.1) Sep 24, 2019
@snowman2
Copy link
Member Author

Update: rasterio==1.0.28 works fine with GDAL 2.4.2 as $GDAL_DATA contains the gcs.csv file.

@sgillies
Copy link
Member

@snowman2 if you were really using GDAL 3.0.1, you would see this:

rasterio.errors.CRSError: The EPSG code is unknown. PROJ: proj_create_from_database: Cannot find proj.db

This is another case of a screwed up conda environment. I'm going to close.

@snowman2
Copy link
Member Author

This is another case of a screwed up conda environment. I'm going to close.

Huh, makes sense. Thanks!

@maphew
Copy link

maphew commented Oct 4, 2019

"another case of a screwed up conda environment" sounds like a frequent occurence, and like where I am right now. Anyone have pointers to docs about how to correctly use conda and rasterio?

@snowman2
Copy link
Member Author

snowman2 commented Oct 4, 2019

After re-installing with conda-forge it worked.

@sgillies
Copy link
Member

sgillies commented Oct 4, 2019

@maphew let me clarify: I don't think conda and conda-forge are extra fragile or risky. Conda-forge is a good project and Rasterio profits from its support!

Python environments, whether conda or virtualenv, can become unstable after incremental updates to them. Best practice in my opinion is to keep their configuration under version control using a requirements file or whatever (I'm not that familiar with coda) and regularly recycle them. In other words, delete them and recreate replacements.

weiji14 added a commit to weiji14/deepbedmap that referenced this issue Dec 6, 2019
Couple of minor updates due to upgrade to GMT6.0 stable. The subplots now use 0-based indexing instead of 1-based before since GenericMappingTools/gmt#1315. Also using full PROJ4 string for EPSG:3031 in data_prep.save_array_to_grid as GMT conda now pulls in GDAL 3.0 instead of 2.4 before, and that causes problems with rasterio's CRS as it can't find the gcs.csv file (see e.g. rasterio/rasterio#1787), possibly a problem because we use pypi rasterio wheels that have built-in GDAL 2.4 binaries? Newer rasterio versions up to 1.1.1 don't work either, I've tried...
@ClaireBrenner
Copy link

@snowman2 if you were really using GDAL 3.0.1, you would see this:

rasterio.errors.CRSError: The EPSG code is unknown. PROJ: proj_create_from_database: Cannot find proj.db

This is another case of a screwed up conda environment. I'm going to close.

I have the same problem with GDAL 3.0.2 installed from conda forge and rasterio also installed from conda forge. Is there a solution to this problem?

@ClaireBrenner
Copy link

@snowman2 if you were really using GDAL 3.0.1, you would see this:
rasterio.errors.CRSError: The EPSG code is unknown. PROJ: proj_create_from_database: Cannot find proj.db
This is another case of a screwed up conda environment. I'm going to close.

I have the same problem with GDAL 3.0.2 installed from conda forge and rasterio also installed from conda forge. Is there a solution to this problem?

Sorry, I missed that I have to downgrade to an older version of GDAL.

@sgillies
Copy link
Member

@ClaireBrenner no, that's not true. The lastest version of rasterio works fine with GDAL 3.

@rasterio rasterio locked as resolved and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants