I get this from time to time also. If I don't actually need gmsh to be
called I just monkey patch the function that checks for gmsh like so:

import fipy
fipy.meshes.gmshMesh._gmshVersion = lambda **kwargs : 2.0

which makes the error go away.

On Fri, Jan 2, 2015 at 9:32 AM, Daniel Wheeler
<[email protected]> wrote:
> On Thu, Jan 1, 2015 at 10:00 PM, Kyle Lawlor <[email protected]> wrote:
>
>> To start the error crops up running the following lines of code:
>>
>> from fipy import *
>> file_path="C:\path\square.msh"
>> mesh=Gmsh2D(file_path)
>>
>> The error I get is:
>>
>> line 3, in <module>
>>     mesh=Gmsh2D(file_path)
>>   File "C:\Python27\lib\site-packages\fipy\meshes\gmshMesh.py", line 1578,
>> in __init__
>>     background=background)
>>   File "C:\Python27\lib\site-packages\fipy\meshes\gmshMesh.py", line 151, in
>> openMSHFile
>>     raise EnvironmentError("Gmsh version must be >= 2.0.")
>> EnvironmentError: Gmsh version must be >= 2.0.
>
> This often pops up in the context of parallel simulations when the
> environment isn't the same on all PIDs, but also for other reasons
> that I can't recall.
>
>> As far as the trouble shooting I've done thus far, I opened up the
>> gmshMesh.py file to check out where the errors were coming from. I copy and
>> paste up to the openMSHFile() definition in that code, and run it to see if
>> I could get some info about what the code was getting in terms of
>> recognizing gmsh and what version it was getting. As a note I have gmsh 2.8
>> installed.
>>
>> Oddly enough, when I run the segment of code from the gmshMesh.py I find
>> that that:
>> _checkForGmsh()  -- True
>> _gmshVersion() -- 2.8
>>
>> I'm puzzled as to why this works when I run the segment of code but not when
>> I call on the Gmsh2D() function. I think that likely, it is how I have gmsh
>> installed on my computer. But the code seems to recognize it. Is there a
>> specific location that I should have the gmsh program? Hopefully, this is an
>> easy fix and I have complicated things. Looking forward to hearing back.
>
> No idea why there is a discrepancy and it's difficult to diagnose
> remotely. I think you'll just have to debug the broken version. Start
> here
>
>    https://github.com/usnistgov/fipy/blob/develop/fipy/meshes/gmshMesh.py#L149
>
> and find out what "gmshVersion" is. I suspect it's "None" or something
> like that and Gmsh is not even being found. I often use the
> Interactive Python Debugger for this sort of thing and it's a great
> help.
>
> Cheers,
>
> Daniel
>
> --
> Daniel Wheeler
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to