Closed Zihaobian closed 1 year ago
This issue is related to rasterio
installation on Windows. Did you use pip
to install any package in addition to using Conda? This issue usually happens when you combine using pip
and conda
. Additionally, you can try creating a new Python env using conda
and only install pygeohydro
to check if this issue still exists. Note that HyRiver packages require Python 3.8+. You can use conda create -n test_env pygeohydro
.
Thanks for your quick response. I create a new environment with conda create -n myenv python After a new Python 3.11 environment is created, I installed only pygeohydro with conda install -c conda-forge pygeohydro However, this issue still exist.
ImportError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import pygeohydro
File C:\Anaconda\envs\myenv\Lib\site-packages\pygeohydro__init__.py:4 1 """Top-level package for PyGeoHydro.""" 2 from importlib.metadata import PackageNotFoundError, version ----> 4 from pygeohydro import helpers, plot 5 from pygeohydro.exceptions import ( 6 DataNotAvailableError, 7 DependencyError, (...) 15 ZeroMatchedError, 16 ) 17 from pygeohydro.helpers import get_us_states
File C:\Anaconda\envs\myenv\Lib\site-packages\pygeohydro\plot.py:21 19 from pygeohydro import helpers 20 from pygeohydro.exceptions import InputTypeError ---> 21 from pygeohydro.nwis import NWIS 22 from pygeoogc import utils as ogc_utils 24 if TYPE_CHECKING:
File C:\Anaconda\envs\myenv\Lib\site-packages\pygeohydro\nwis.py:26 23 import xarray as xr 25 import async_retriever as ar ---> 26 import pynhd 27 from pygeohydro.exceptions import ( 28 DataNotAvailableError, 29 InputTypeError, 30 InputValueError, 31 ZeroMatchedError, 32 ) 33 from pygeoogc import ServiceURL
File C:\Anaconda\envs\myenv\Lib\site-packages\pynhd__init__.py:4 1 """Top-level package for PyNHD.""" 2 from importlib.metadata import PackageNotFoundError, version ----> 4 from pynhd.core import AGRBase, GeoConnex, ScienceBase 5 from pynhd.exceptions import ( 6 DependencyError, 7 InputRangeError, (...) 14 ZeroMatchedError, 15 ) 16 from pynhd.network_tools import ( 17 NHDTools, 18 enhd_flowlines_nx, (...) 28 vector_accumulation, 29 )
File C:\Anaconda\envs\myenv\Lib\site-packages\pynhd\core.py:12 10 import geopandas as gpd 11 import pandas as pd ---> 12 import pygeoutils as geoutils 13 import pyproj 14 import shapely
File C:\Anaconda\envs\myenv\Lib\site-packages\pygeoutils__init__.py:4 1 """Top-level package for PyGeoUtils.""" 2 from importlib.metadata import PackageNotFoundError, version ----> 4 from pygeoutils._utils import get_gtiff_attrs, get_transform, transform2tuple, xd_write_crs 5 from pygeoutils.exceptions import ( 6 EmptyResponseError, 7 InputRangeError, (...) 14 UnprojectedCRSError, 15 ) 16 from pygeoutils.geotools import ( 17 Coordinates, 18 GeoBSpline, (...) 26 snap2nearest, 27 )
File C:\Anaconda\envs\myenv\Lib\site-packages\pygeoutils_utils.py:11 9 import numpy as np 10 import pyproj ---> 11 import rasterio as rio 12 import rasterio.transform as rio_transform 13 import rioxarray._io as rxr
File C:\Anaconda\envs\myenv\Lib\site-packages\rasterio__init__.py:28 24 os.add_dll_directory(os.path.abspath(p)) 27 from rasterio._show_versions import show_versions ---> 28 from rasterio._version import gdal_version, get_geos_version, get_proj_version 29 from rasterio.crs import CRS 30 from rasterio.drivers import driver_from_extension, is_blacklisted
ImportError: DLL load failed while importing _version: The specified procedure could not be found.
Can you try creating a new environment and installing rastrio
and gdal
only and try to run the offending line:
from rasterio._version import gdal_version, get_geos_version, get_proj_version
I don't have a Windows machine, so I cannot test this.
I tried another time. This time the pygeohydro can be imported without any issues. Thanks! I tested some examples provided on the website. However, not every command works. I will keep trying.
What happened?
I just installed Pygeohydro on my Anaconda by using Conda install prompt. When I imported this package, this issue happened.
What did you expect to happen?
No response
Minimal Complete Verifiable Example
No response
MVCE confirmation
Relevant log output
Anything else we need to know?
I change the Python version to 3.6 and this issue can be solved. However, a new issue happen. AttributeError Traceback (most recent call last)