You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm dealing with two variables which are set in the parent conda env which are not updated by anaconda-project run that I've noticed so far, and I wonder if perhaps they should be? They are PROJ_LIB, and GDAL_DATA.
This can cause issues with packages that depend on this happening, but setting them manually based on the anaconda-project env seems to fix the issues. Here is an example with PROJ, where the PROJ_LIB var is not updated:
# empty folder, activate conda env that has GDAL and PROJ installed
$ pwd
/Users/me/scratch/test-ap
$ conda activate
(base) $ echo $PROJ_LIB
/Users/me/opt/anaconda3/share/proj
(base) $ anaconda-project init
Project configuration is in /Users/me/scratch/test-ap/anaconda-project.yml
(base) $ anaconda-project add-packages pyproj
(base) $ anaconda-project run python
>>> import pyproj
/Users/me/scratch/test-ap/envs/default/lib/python3.10/site-packages/pyproj/__init__.py:89: UserWarning: pyproj unable to set database path.
_pyproj_global_context_initialize()
>>> pyproj.crs.CRS(3338)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/me/scratch/test-ap/envs/default/lib/python3.10/site-packages/pyproj/crs/crs.py", line 326, in __init__
self._local.crs = _CRS(self.srs)
File "pyproj/_crs.pyx", line 2352, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: epsg:3338: (Internal Proj Error: proj_create: no database context specified)
>>> import os
>>> os.getenv("PROJ_LIB")
/Users/me/opt/anaconda3/share/proj
>>> exit()
# restart to set env var before import
(base) $ anaconda-project run python
>>> os.environ["PROJ_LIB"] = os.environ["CONDA_DEFAULT_ENV"] + "/share/proj"
>>> import pyproj
>>> pyproj.crs.CRS(3338)
<Derived Projected CRS: EPSG:3338>
Name: NAD83 / Alaska Albers
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: United States (USA) - Alaska.
- bounds: (172.42, 51.3, -129.99, 71.4)
Coordinate Operation:
- name: Alaska Albers (meters)
- method: Albers Equal Area
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
# ^^ no warnings or errors
Thanks! Loving the project so far! Happy to try contributing if this is indeed something to fix.
The text was updated successfully, but these errors were encountered:
Version info
anaconda-project
: 0.10.1conda
: 4.10.3I'm dealing with two variables which are set in the parent
conda
env which are not updated byanaconda-project run
that I've noticed so far, and I wonder if perhaps they should be? They arePROJ_LIB
, andGDAL_DATA
.This can cause issues with packages that depend on this happening, but setting them manually based on the
anaconda-project
env seems to fix the issues. Here is an example with PROJ, where thePROJ_LIB
var is not updated:Thanks! Loving the project so far! Happy to try contributing if this is indeed something to fix.
The text was updated successfully, but these errors were encountered: