MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
147 stars 66 forks source link

Installer issue with version 1.0 #83

Closed Patrick-Cole closed 5 years ago

Patrick-Cole commented 5 years ago

Hi,

I am using winpython (https://winpython.github.io/) and install missing packages from (https://www.lfd.uci.edu/~gohlke/pythonlibs/). Winpython uses pip to install packages, although there is a nice GUI for this. There is no problem with the initial install, but when importing mtpy I get the following:

GDAL_DATA environment variable is not set Please see https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable Ignore GDAL as it is not working. Will use pyproj Traceback (most recent call last):

File "", line 1, in import mtpy

File "C:\Python\WPy64-3730b2\python-3.7.3.amd64\lib\site-packages\mtpy-1.0.2-py3.7.egg\mtpy__init__.py", line 3, in from mtpy.utils.mtpylog import MtPyLog

File "C:\Python\WPy64-3730b2\python-3.7.3.amd64\lib\site-packages\mtpy-1.0.2-py3.7.egg\mtpy\utils__init__.py", line 51, in EPSG_DICT = np.load(epsg_dict_fn, allow_pickle=True).item()

File "C:\Python\WPy64-3730b2\python-3.7.3.amd64\lib\site-packages\numpy\lib\npyio.py", line 422, in load fid = open(os_fspath(file), "rb")

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Python\WPy64-3730b2\python-3.7.3.amd64\lib\site-packages\mtpy-1.0.2-py3.7.egg\mtpy\utils\epsg.npy'

There are two problems from me here: 1) It does not see the GDAL_DATA. Under my install, this is easily solved by importing gdal (which seems to set this environment variable) 2) It does not find 'epsg.npy'. I fixed this by copying the relevant file from the original .zip file but I have no idea if there are any other data files missing. I suspect that this might be able to be fixed with a tweak to setup.py.

I can get this bug by installing via pip, or by using 'python setup.py install'

Winpython is a windows python distribution. I run it on a windows machine with windows 7. I have all the dependencies installed.

Please let me know if I did something wrong or what can be done.

zhang01GA commented 5 years ago

Hi Patrick, thanks for logging the issue details. You are right that the 'epsg.npy' need to exist in the relevant dir. And this is the only data file I am aware needing to be handled.
For GDAL to function, it must be installed correctly and with GDAL_DATA env variable configured.

Patrick-Cole commented 5 years ago

Thanks for the response! I can manually copy the epsg.npy file for now, so I should be fine. Your confirmation that this is the only file affected helps me a great deal.

I suspect that my GDAL issue is unique to Winpython. Winpython is a portable distribution which does not (by default) register anything in the registry. I guess thats why (in my case) all I need to do it import gdal once (before mtpy), and upon doing so GDAL_DATA env variable suddenly is configured. I therefore have a solution to this as well.

Thanks for your help!

Patrick-Cole commented 5 years ago

Hi,

I am closing this since it it no longer an issue with version 1.1.3. Thanks for your work!