conda-forge / python-eccodes-feedstock

A conda-smithy repository for python-eccodes.
BSD 3-Clause "New" or "Revised" License
6 stars 16 forks source link

Possible Windows support #52

Closed djhoese closed 1 year ago

djhoese commented 4 years ago

What is the current state of Windows support for this package and building it on conda-forge? Was it ever attempted? I see on the PyPI page that it says the package is untested on Windows. Any gotchas or other difficulties I would run in to if I tried to add it?

Reason: I have a GUI application that currently depends on pygrib which is not Windows compatible so the conda package for my GUI application is not noarch because of this (even though it is pure python). I would like to switch to eccodes-python but if we (meaning conda-forge) can't get it built for windows then I'll have the same issue.

Side question: Why is the conda package not called eccodes-python like the PyPI package?

kmuehlbauer commented 4 years ago

Side question: Why is the conda package not called eccodes-python like the PyPI package?

Because, the PyPI packages was created first this year, and this feedstock exists for quite some time. Never thought, that there might be a dedicated PyPI package one day. Further info on the naming issue: https://github.com/conda-forge/python-eccodes-feedstock/issues/49 and https://github.com/conda-forge/eccodes-feedstock/pull/88. Not sure how to break out without breaking things for users.

No information so far on the windows issue, sorry @djhoese. But @dtip might know something.

dtip commented 4 years ago

Hi @djhoese - I can't remember for the life of me why ECMWF didn't want Windows support for the ecCodes Python interface. I added support for ecCodes, Magics, magics-python, and CodesUI. @StephanSiemen should know the answer to your question.

If we're lucky we can get windows support here for free. I'll give it a go and see what happens.

dtip commented 4 years ago

PR here: https://github.com/conda-forge/python-eccodes-feedstock/pull/53

ColinDuff commented 4 years ago

hi, i tried to download the windows python-eccodes from conda-forge but i get the following error:-

UnsatisfiableError: The following specifications were found to be in conflict:

i am running python 3.7 - any ideas

kynan commented 4 years ago

@ColinDuff wincertstore is not available for Python 3.7 in the default channel, but it is on conda-forge.

ColinDuff commented 4 years ago

hi, so i reinstalled the wincertstore fro conda-forge but now i get UnsatisfiableError: The following specifications were found to be in conflict:

thanks for your help

meso2 commented 4 years ago

@djhoese @dtip I wonder if anyone here has already got eccodes python working under Python 3.7.1 and Windows 10? Many thanks.

dtip commented 4 years ago

@meso2 I haven't tried, but it should work fine in a clean python environment. What problems are you seeing?

meso2 commented 4 years ago

@dtip Thanks.

Here is the problem I have.

This is what I've done under Windows 10 and Python 3.7.1:

(1) Download python-eccodes-2020.03.0-py37hbc2f12b_2.tar.bz2 from https://anaconda.org/conda-forge/python-eccodes/files and install eccodes-python by using 'conda install python-eccodes-2020.03.0-py37hbc2f12b_2.tar.bz2'

(2)Download eccodes 2.17.0 eccodes-2.17.0-h37af81a_0.tar.bz2 from https://anaconda.org/conda-forge/eccodes/files and installInstall eccodes by using 'conda install eccodes-2.17.0-h37af81a_0.tar.bz2'

(3) After running 'python -m eccodes selfcheck', it shows the following messages:

Found: ecCodes v2.17.0.

Your system is ready.

(4) Launch Python 3.7.1 and import eccodes, all good,

(5) When I ran the following small piece of code 'python test.py', nothing happened (no error message, no results) but it exited. I guess the script crashed. The line in the script which caused the crash is eccodes.codes_get(gid, 'dataDate').

======================================================== import eccodes

import datetime

fn = '../data/ecsf/ecsf200507.grb'

f = open(fn)

gid = eccodes.codes_grib_new_from_file(f)

if gid is None: exit(0)

try:

initial_time = datetime.datetime.strptime(str(eccodes.codes_get(gid, 'dataDate')),'%Y%m%d')

print (initial_time)

except eccodes.CodesInternalError as err:

print ('Error with key="%s" : %s' % (key, err.msg))

====================== Any ideas? Thanks.

dtip commented 4 years ago

Could you try install python-eccodes directly from conda-forge:

conda install -c conda-forge python-eccodes

You shouldn't have to mess with tarballs when using conda!

meso2 commented 4 years ago

Thanks @dtip.

I just uninstalled Python 3.7.1 and reinstalled 3.8.2.

I've done the following: conda create --name eccodes_env conda activate eccodes_env conda install -c conda-forge eccodes The installation seems to be successful. 'grib_ls' etc eccodes tools working. However, when I ran that piece of Python script. The script still exited quietly without giving any results and errors. Any thoughts please?

xylar commented 1 year ago

As far as I can tell, Windows is now supported. If there are ongoing problems 3 years later, it would be best to open a new issue.

shahramn commented 1 year ago

Also try calling the "open" function with the BINARY mode e.g., f = open(mygrib, "rb")