Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode support in building script ? #283

Closed
antoineprats opened this issue Feb 3, 2015 · 8 comments
Closed

Unicode support in building script ? #283

antoineprats opened this issue Feb 3, 2015 · 8 comments
Labels

Comments

@antoineprats
Copy link

Hi,
trying to build sfepy 2014.4 on my computer, I get an error when I launch de building script ($python setup.py build_ext --inplace). The error ouput ends with something like:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)
error: 2 errors while compiling 'sfepy/discrete/fem/extmods/_fmfield.pyx' with Cython

My working directory was /home/user/Téléchargements/sfepy (I'm a french speaker). I moved to /home/user/sfepy , and I could build and test sfepy.

I am new with everything in python, but it looks like theres a problem with none-ascii characters in paths in the building script... ?

Results of run_tests.py :

  • ubuntu 14.10 : 0 failure
  • fedora 21 : 2 failures ( test_input_linear_elastic_probes.py and test_semismooth_newton.py )

Antoine

@rc rc added the defect label Feb 3, 2015
@rc
Copy link
Member

rc commented Feb 3, 2015

Thanks for the report, we will look at it. Post, please, also the output of

./run_tests.py --debug tests/test_semismooth_newton.py
./run_tests.py --debug tests/test_input_linear_elastic_probes.py

so that we can see what the problems are.

@antoineprats
Copy link
Author

Semismooth newton : 100

[antoine@antoine sfepy-2014.4]$ ./run_tests.py --debug tests/test_semismooth_newton.py
<<< directory: tests, test files: 1
<<< tests/test_semismooth_newton.py
sfepy: left over: ['fs', 'verbose', '__builtins__', 'ca', 'sps', 'convert_to_csr', 'ls_conf', '__file__', 'conf', 'alpha', '__name__', 'define_matrices', 'TestCommon', 'eval_matrix', 'nm', '_filename', 'dict_to_struct', '__package__', 'ks', 'fc', 'sm', 'sa', '__doc__']
--- test instance creation failed
Traceback (most recent call last):
  File "./run_tests.py", line 206, in <module>
    main()
  File "./run_tests.py", line 197, in main
    run_tests(stats, dirname, [filename])
  File "./run_tests.py", line 131, in run_tests
    n_fail, n_total, test_time = run_test(conf_name, options)
  File "./run_tests.py", line 83, in run_test
    test = conf.funmod.Test.from_conf(conf, options)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/tests/test_semismooth_newton.py", line 134, in from_conf
    test.m, test.ms, test.w_names = define_matrices()
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/tests/test_semismooth_newton.py", line 65, in define_matrices
    e = sm.zeros((7, 1))
  File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 1229, in zeros
    return cls.zeros(r, c)
  File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 513, in zeros
    r = as_int(r)
  File "/usr/lib/python2.7/site-packages/sympy/core/compatibility.py", line 389, in as_int
    raise ValueError('%s is not an integer' % n)
TypeError: not all arguments converted during string formatting

Linear elastic probes :

[antoine@antoine sfepy-2014.4]$ ./run_tests.py --debug tests/test_input_linear_elastic_probes.py
<<< directory: tests, test files: 1
<<< tests/test_input_linear_elastic_probes.py
sfepy: left over: ['verbose', '__builtins__', '_filename', '__file__', '__package__', 'TestInput', 'input_name', '__name__', 'output_name', '__doc__']
sfepy: left over: ['lam', 'plt', 'Struct', '__builtins__', '__file__', 'deepcopy', 'fm', 'verbose', 'par_fun', 'mu', 'data_dir', 'nm', 'solid', '__name__', 'Probe', '__package__', 'stiffness_from_lame', '_filename', 'post_process', 'os', '__doc__']
>>> test instance prepared (1 test(s))
... solving ../examples/linear_elasticity/linear_elastic_probes.py...
sfepy: reading mesh [line2, tri3, quad4, tetra4, hexa8] (/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/meshes/3d/cylinder.mesh)...
sfepy: ...done in 0.01 s
sfepy: creating regions...
sfepy:     SomewhereTop
sfepy:     Right
sfepy:     Omega
sfepy:     Left
sfepy: ...done in 0.03 s
sfepy: equation "balance_of_forces":
sfepy: dw_lin_elastic_iso.i.Omega(solid.lam, solid.mu, v, u) = 0
sfepy: using solvers:
                ts: no ts
               nls: newton
                ls: ls
sfepy: updating variables...
sfepy: ...done
sfepy: setting up dof connectivities...
sfepy: ...done in 0.00 s
sfepy: matrix shape: (886, 886)
sfepy: assembling matrix graph...
sfepy: ...done in 0.01 s
sfepy: matrix structural nonzeros: 31052 (3.96e-02% fill)
sfepy: updating materials...
sfepy:     solid
sfepy: ...done in 0.00 s
sfepy: nls: iter: 0, residual: 4.778054e-03 (rel: 1.000000e+00)
sfepy:   rezidual:    0.00 [s]
sfepy:      solve:    0.02 [s]
sfepy:     matrix:    0.01 [s]
sfepy: nls: iter: 1, residual: 7.207802e-18 (rel: 1.508522e-15)
sfepy: equation "tmp":
sfepy: ev_cauchy_strain.i.Omega( u )
sfepy: updating materials...
sfepy: ...done in 0.00 s
sfepy: equation "tmp":
sfepy: ev_cauchy_stress.i.Omega( solid.D, u )
sfepy: updating materials...
sfepy:     solid
sfepy: ...done in 0.00 s
>>> <type 'exceptions.AttributeError'>
Traceback (most recent call last):
  File "./run_tests.py", line 206, in <module>
    main()
  File "./run_tests.py", line 197, in main
    run_tests(stats, dirname, [filename])
  File "./run_tests.py", line 131, in run_tests
    n_fail, n_total, test_time = run_test(conf_name, options)
  File "./run_tests.py", line 99, in run_test
    ok, n_fail, n_total = test.run(options.debug)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/base/testing.py", line 58, in run
    ret = test_method()
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/tests/tests_basic.py", line 73, in test_input
    post_process_hook_final=self.post_process_hook_final)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/applications/pde_solver_app.py", line 55, in solve_pde
    return app(nls_status=nls_status)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/applications/application.py", line 29, in call_basic
    return self.call(**kwargs)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/applications/pde_solver_app.py", line 220, in call
    nls_status=nls_status)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/solvers/ts_solvers.py", line 37, in __call__
    file_per_var=None)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/discrete/problem.py", line 725, in save_state
    out = post_process_hook(out, self, state, extend=extend)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/examples/linear_elasticity/linear_elastic_probes.py", line 99, in post_process
    probe = Probe(out, mesh)
  File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/postprocess/probes_vtk.py", line 36, in __init__
    self.vtkprobe.SetSource(self.vtkdata)
AttributeError: SetSource

@rc
Copy link
Member

rc commented Feb 5, 2015

On 02/03/2015 10:03 PM, antoineprats wrote:

Semismooth newton : 100

[antoine@antoine sfepy-2014.4]$ ./run_tests.py --debug tests/test_semismooth_newton.py
<<< directory: tests, test files: 1
<<< tests/test_semismooth_newton.py
sfepy: left over: ['fs', 'verbose', '__builtins__', 'ca', 'sps', 'convert_to_csr', 'ls_conf', '__file__', 'conf', 'alpha', '__name__', 'define_matrices', 'TestCommon', 'eval_matrix', 'nm', '_filename', 'dict_to_struct', '__package__', 'ks', 'fc', 'sm', 'sa', '__doc__']
--- test instance creation failed
Traceback (most recent call last):
   File "./run_tests.py", line 206, in <module>
     main()
   File "./run_tests.py", line 197, in main
     run_tests(stats, dirname, [filename])
   File "./run_tests.py", line 131, in run_tests
     n_fail, n_total, test_time = run_test(conf_name, options)
   File "./run_tests.py", line 83, in run_test
     test = conf.funmod.Test.from_conf(conf, options)
   File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/tests/test_semismooth_newton.py", line 134, in from_conf
     test.m, test.ms, test.w_names = define_matrices()
   File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/tests/test_semismooth_newton.py", line 65, in define_matrices
     e = sm.zeros((7, 1))
   File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 1229, in zeros
     return cls.zeros(r, c)
   File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 513, in zeros
     r = as_int(r)
   File "/usr/lib/python2.7/site-packages/sympy/core/compatibility.py", line 389, in as_int
     raise ValueError('%s is not an integer' % n)
TypeError: not all arguments converted during string formatting

This seems like a sympy issue - I have '0.7.4.1' and the following works:

import sympy as sm
e = sm.zeros((7, 1))

How is it in your case?

Linear elastic probes :

[antoine@antoine sfepy-2014.4]$ ./run_tests.py --debug tests/test_input_linear_elastic_probes.py
<<< directory: tests, test files: 1

File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/discrete/problem.py", line 725, in save_state
out = post_process_hook(out, self, state, extend=extend)
File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/examples/linear_elasticity/linear_elastic_probes.py", line 99, in post_process
probe = Probe(out, mesh)
File "/home/antoine/sfepy/sfepy-2014.4/sfepy-2014.4/sfepy/postprocess/probes_vtk.py", line 36, in init
self.vtkprobe.SetSource(self.vtkdata)
AttributeError: SetSource

This seems related to #277. What is the vtk version?

@antoineprats
Copy link
Author

import sympy as sm 
e = sm.zeros((7, 1)) 

returns :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 1229, in zeros
    return cls.zeros(r, c)
  File "/usr/lib/python2.7/site-packages/sympy/matrices/dense.py", line 513, in zeros
    r = as_int(r)
  File "/usr/lib/python2.7/site-packages/sympy/core/compatibility.py", line 389, in as_int
    raise ValueError('%s is not an integer' % n)
TypeError: not all arguments converted during string formatting

Considering the sympy version :

$yum info sympy
...
Architecture        : noarch
Version             : 0.7.6
Révision            : 1.fc21
...

About the vtk version :

$yum info vtk : 
...
Architecture        : i686
Version             : 6.1.0
Révision            : 18.fc21
...

Hope it can help (quite lost here, I'm new to everything python-related).

@rc
Copy link
Member

rc commented Feb 9, 2015

Does rc@c6496b4 commit fix the tests/test_semismooth_newton.py problem?

@rc
Copy link
Member

rc commented Feb 10, 2015

Concerning the unicode issue, we are working on that - in the meantime, use an ascii directory name for sfepy, please.

@antoineprats
Copy link
Author

Just did $./run_tests.py --debug tests/test_semismooth_newton.py with the new version, here is the output :

<<< directory: tests, test files: 1
<<< tests/test_semismooth_newton.py
sfepy: left over: ['fs', 'verbose', '__builtins__', 'ca', 'sps', 'convert_to_csr', 'ls_conf', '__file__', 'conf', 'alpha', '__name__', 'define_matrices', 'TestCommon', 'eval_matrix', 'nm', '_filename', 'dict_to_struct', '__package__', 'ks', 'fc', 'sm', 'sa', '__doc__']
>>> test instance prepared (1 test(s))
sfepy: regular step
sfepy: nls: iter: 0, residual: 2.199618e+00 (rel: 1.000000e+00)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 1, residual: 4.381899e+00 (rel: 1.992118e+00)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.02 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.06 [s]
sfepy: regular step
sfepy: nls: iter: 2, residual: 2.234025e+00 (rel: 1.015642e+00)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.02 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 3, residual: 3.089549e-01 (rel: 1.404585e-01)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 4, residual: 2.664195e-01 (rel: 1.211208e-01)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 5, residual: 3.896123e-01 (rel: 1.771273e-01)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 6, residual: 6.624028e-02 (rel: 3.011445e-02)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 7, residual: 8.226612e-06 (rel: 3.740019e-06)
sfepy: non_active/active: 2/0
sfepy:   rezidual:    0.01 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.05 [s]
sfepy: regular step
sfepy: nls: iter: 8, residual: 1.035204e-15 (rel: 4.706291e-16)
... x: [ 0.39535153  0.38799153  1.27406675  1.36530172 -0.84134967 -0.7360006 ]
... g: [-0.01210698 -0.01472001]
... l: [ 32.65483955  26.3580986 ]
... sn: [-1.21069814 -1.4720012 ]
+++ test_semismooth_newton: ok
>>> all passed in 1.17 s
1 test file(s) executed in 1.17 s, 0 failure(s) of 1 test(s)

Looks like it works, thanks.
Ok for the unicode support.

@rc
Copy link
Member

rc commented Oct 13, 2016

Actually the unicode error is raised by Cython (just re-tried with cython 0.20dev and Python 2.7). Let us close this.

@rc rc closed this as completed Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants