natcap / pygeoprocessing

Geoprocessing operations for Python
https://pygeoprocessing.readthedocs.io/en/latest/
Other
78 stars 8 forks source link

Not recognizing geoprocessing_core on import #98

Closed jbrownmi88 closed 4 years ago

jbrownmi88 commented 4 years ago

I'm using pygeoprocessing in a conda environment running Python 3.8 on Windows 10. Getting an error when trying to import the module


ImportError
Traceback (most recent call last)

in ----> 1 import pygeoprocessing ~\Anaconda3\envs\pygeo\lib\site-packages\pygeoprocessing\__init__.py in 7 import types 8 ----> 9 from . import geoprocessing 10 from .geoprocessing_core import calculate_slope 11 from .geoprocessing_core import raster_band_percentile ~\Anaconda3\envs\pygeo\lib\site-packages\pygeoprocessing\geoprocessing.py in 13 import time 14 ---> 15 from . import geoprocessing_core 16 from .geoprocessing_core import DEFAULT_GTIFF_CREATION_TUPLE_OPTIONS 17 from osgeo import gdal ImportError: DLL load failed while importing geoprocessing_core: The specified module could not be found. The geoprocessing_core.pyx file is present, so I'm not sure why it isn't detecting it. All required packages have been installed.
phargogh commented 4 years ago

@jbrownmi88 How did you go about installing pygeoprocessing into your conda environment?

The geoprocessing_core.pyx file is converted to C++ and then compiled as part of the build process, and so knowing how you built and installed the package would help determine why you're experiencing this error.

jbrownmi88 commented 4 years ago

@phargogh Thanks for the quick reply. I installed pygeoprocessing by first installing the packages in requirements.txt using conda install via prompt. Then I used "pip install pygeoprocessing". These processes gave me no errors.

phargogh commented 4 years ago

Interesting. Usually installing via pip puts all of the required files in the right places.

Could you provide the output of pip show pygeoprocessing here?

Could you confirm that you have a file named something like geoprocessing_core.cpython-38m-win_amd64.pyd in ~\Anaconda3\envs\pygeo\lib\site-packages\pygeoprocessing\? Are there any other .pyd files in that directory?

jbrownmi88 commented 4 years ago

Name: pygeoprocessing Version: 2.0.0 Summary: PyGeoprocessing: Geoprocessing routines for GIS Home-page: https://github.com/natcap/pygeoprocessing Author: None Author-email: None License: BSD Location: c:\users\jbrow\anaconda3\envs\pygeo\lib\site-packages Requires: Cython, numpy, Rtree, Shapely, GDAL, scipy Required-by:

geoprocessing_core.cp38-win_amd64.pyd is the name of the file in that directory, there are no other .pyd files

phargogh commented 4 years ago

Well that is curious, everything looks to be in its expected place. Could you try running python -v -c "import pygeoprocessing" > output.txt and attach output.txt here to the issue? This would help me to understand where python is looking for (and finding) the various parts of the pygeoprocessing package.

jbrownmi88 commented 4 years ago

That command made a blank text doc. Not sure if the terminal output from that command is what was supposed to end up in that text doc, but I copied and pasted the terminal output into outputs.txt. output.txt

phargogh commented 4 years ago

Well that is strange. I don't see anything clearly out of order here.

  1. Do you have pygeoprocessing's dependencies already installed?
  2. What about reinstalling from source? You'll need a compiler installed, but then the following might do the trick:
    pip uninstall -y pygeoprocessing
    pip install --no-binary :all: pygeoprocessing
jbrownmi88 commented 4 years ago

That worked! I'm able to import the package now without error.

phargogh commented 4 years ago

OK! Well, I'm still not sure what's going on there, but I'm glad you were able to get it up and running. Thanks for helping work through the issue with us!

jbrownmi88 commented 4 years ago

No problem! Glad it's working, excited to try some stuff out. Thanks again.