Type Error running examples

Skip to first unread message

Christopher Jones

Jan 30, 2017, 12:04:10 AM1/30/17
to sfepy-devel
I am getting the following error while trying to run 'its2d_interactive.py'.

C:\Python36\Lib\site-packages\sfepy\linalg>python C:\Python36\Lib\site-packages\sfepy\examples\linear_elasticity\its2D_interactive.py
Traceback (most recent call last):
  File "C:\Python36\Lib\site-packages\sfepy\examples\linear_elasticity\its2D_interactive.py", line 51, in <module>
    from examples.linear_elasticity.its2D_2 import stress_strain
ModuleNotFoundError: No module named 'examples'

I have been getting this error when ever I try to run examples.

I tried changing the forward slashes to back slashes with no effect. I installed most of the dependencies from PIP, and installed a pre-built binary from Gohlke's LFD python libs page.

I've tried running from the console as seen in the above error. I've also tried running from IDLE, for python 3.6. ANd I get no error messages from the IDLE console but also, I get no output file. I'm running IDLE with elevated privelage and I created the output directory inside the sfepy install directory, i.e. C:\Python36\Lib\site-packages\sfepy\examples\results...

Ok, I see this error. I was not in the sfepy base directory. I changed this and got output in the console with the following error:

C:\Python36\Lib\site-packages\sfepy>python C:\Python36\Lib\site-packages\sfepy\examples\linear_elasticity\its2D_interactive.py
sfepy: using values:
sfepy:   Young's modulus: 2000.0
sfepy:   Poisson's ratio: 0.4
sfepy:   vertical load: -1000.0
sfepy: uniform mesh refinement level: 0
sfepy: reading mesh [line2, tri3, quad4, tetra4, hexa8] (C:\Python36\lib\site-packages\sfepy/meshes/2d/its2D.mesh)...
sfepy: ...done in 0.00 s
Traceback (most recent call last):
  File "C:\Python36\Lib\site-packages\sfepy\examples\linear_elasticity\its2D_interactive.py", line 293, in <module>
  File "C:\Python36\Lib\site-packages\sfepy\examples\linear_elasticity\its2D_interactive.py", line 175, in main
    domain = FEDomain('domain', mesh)
  File "C:\Python36\lib\site-packages\sfepy\discrete\fem\domain.py", line 50, in __init__
    gel.poly_space = PolySpace.any_from_args(key, gel, 1)
  File "C:\Python36\lib\site-packages\sfepy\discrete\fem\poly_spaces.py", line 272, in any_from_args
    return table[key](name, geometry, order)
  File "C:\Python36\lib\site-packages\sfepy\discrete\fem\poly_spaces.py", line 444, in __init__
    self.nodes, self.nts, node_coors = self._define_nodes()
  File "C:\Python36\lib\site-packages\sfepy\discrete\fem\poly_spaces.py", line 465, in _define_nodes
    nodes = nm.zeros((n_nod, n_v), nm.int32)
TypeError: 'float' object cannot be interpreted as an integer

Any ideas?


Robert Cimrman

Jan 30, 2017, 12:25:51 PM1/30/17
to sfepy...@googlegroups.com
Hi Christopher,

it looks like some compatibility error with python 3.6 or some package
versions. AFAIK SfePy was tested only with Python 3.4 or 3.5. I will try adding
Python 3.6 to our travis-ci configuration to see what is wrong.

Could you create an issue for this on [1]?

Thanks for reporting the problem.
[1] https://github.com/sfepy/sfepy/issues

Robert Cimrman

Feb 2, 2017, 4:53:52 PM2/2/17
to sfepy...@googlegroups.com
The python 3.6 issues should be fixed in the git version now.

Reply all
Reply to author
0 new messages