Mujahed
Mujahed

Reputation: 1

pyOptSparse Error: There was an error importing the compiled snopt module during testing of OpenMDAO

I need to use open framework openMDAO for my project in Ubuntu. I have successfully installed mpi4py, petsc, petsc4py by creating new environment in anaconda. I have also installed pyoptsparse and other libraries. After installation when I run test command

$ testflo openmdao -n 1
It gives error as:

(omd) mujahed@Lenovo-G50-80:~$ testflo openmdao -n 1
.............................................................................
+------------------------------------------------------------------------------+
| pyOptSparse Error: There was an error importing the compiled snopt module    |
+------------------------------------------------------------------------------+

SSS......../home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/openmdao/core/group.py:1113: UserWarning:Group (sub): Attempted to connect from 'tgt.x' to 'cmp.x', but 'tgt.x' is an input. All connections must be from an output to an input.
.......................................................................................................................................................................................................................................................................................................................................................S...............................................................................................................................S........................................................................S.SS........................................................................................................................................................................................................................................................................SSS.SSSSSS..S.................................................................................................................................................................................................................................................................................................................S.......
+------------------------------------------------------------------------------+
| pyOptSparse Error: There was an error importing the compiled snopt module    |
+------------------------------------------------------------------------------+

.....................................................................(mpi) /home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/openmdao/core/tests/test_prob_remote2.py:ProbRemoteTestCase.test_get_remote ... FAIL (00:00:0.02, 203 MB)
Traceback (most recent call last):
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/testflo/test.py", line 425, in _try_call
    func()
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/openmdao/core/tests/test_prob_remote2.py", line 200, in test_get_remote
    prob.get_val('par.c2.x', get_remote=False)
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/unittest/case.py", line 227, in __exit__
    self._raiseFailure("{} not raised".format(exc_name))
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/unittest/case.py", line 164, in _raiseFailure
    raise self.test_case.failureException(msg)
AssertionError: RuntimeError not raised

...
+------------------------------------------------------------------------------+
| pyOptSparse Error: There was an error importing the compiled snopt module    |
+------------------------------------------------------------------------------+

SSS...............................................S.....X......................................................................................................................................................................................
+------------------------------------------------------------------------------+
| pyOptSparse Error: There was an error importing the compiled snopt module    |
+------------------------------------------------------------------------------+

..SS............S...capi_return is NULL
Call-back cb_slfunc_in_slsqp__user__routines failed.
.capi_return is NULL
Call-back cb_slfunc_in_slsqp__user__routines failed.
....S..........................SSSSSSS.......
   Normal return from subroutine COBYLA

   NFVALS =   56   F =-1.080000E+02    MAXCV = 0.000000E+00
   X = 3.500001E+00  -3.500001E+00
.................................................
   Normal return from subroutine COBYLA

   NFVALS =  124   F =-2.733333E+01    MAXCV = 0.000000E+00
   X = 6.666667E+00  -7.333332E+00
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SSSSSSSSSSSSSSSSSSSSSSSS..............
   Normal return from subroutine COBYLA

   NFVALS =   54   F =-2.700000E+01    MAXCV = 0.000000E+00
   X = 6.999999E+00  -6.999999E+00
.............................................SSS..............................................................................................................S...........................................................................................................................................................................................................................................................................................................................................................

The following tests failed:
test_prob_remote2.py:ProbRemoteTestCase.test_get_remote


Passed:  2619
Failed:  1
Skipped: 62


Ran 2682 tests using 1 processes
Wall clock time:   00:22:33.07

Passed: 2619 Failed: 1 Skipped: 62

I don’t have computer science background and this is the first time I am dealing with something like this. I am using: openMDAO 3.2.1 mpich 3.3.2 mpi4py 3.0.3 petsc 3.13.4 petsc4py 3.13.0 pyoptsparse 2.1.5 python 3.8.5

I have build pyoptsparse from https://github.com/OpenMDAO/build_pyoptsparse by command ./build_pyoptsparse.sh.

I have Ubuntu 20.04.1 LTS and I am using Anaconda3. How can I pass all the tests (Without skipping)? Can please anyone help me with this?

Upvotes: 0

Views: 264

Answers (2)

swryan
swryan

Reputation: 261

Apologies for this.. it looks like an extraneous file (test_prob_remote2.py) made it into the distribution.. This is not a legitimate test and you can ignore it.

The "pyOptSparse Error" messages are just telling you that you don't have the SNOPT optimizer installed, which is fine.

Your installation should be good.

Upvotes: 1

Justin Gray
Justin Gray

Reputation: 5710

Some of that test output can be a bit confusing. The error you're getting isn't actually with SNOPT. Thats a warning spit out by pyoptsparse, but it is not a problem.

The actual failed test is identified by this line:

The following tests failed:
test_prob_remote2.py:ProbRemoteTestCase.test_get_remote

And the error that causes the failure is here:

  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/testflo/test.py", line 425, in _try_call
    func()
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/site-packages/openmdao/core/tests/test_prob_remote2.py", line 200, in test_get_remote
    prob.get_val('par.c2.x', get_remote=False)
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/unittest/case.py", line 227, in __exit__
    self._raiseFailure("{} not raised".format(exc_name))
  File "/home/mujahed/anaconda3/envs/omd/lib/python3.8/unittest/case.py", line 164, in _raiseFailure
    raise self.test_case.failureException(msg)
AssertionError: RuntimeError not raised

For some reason your install isn't raising an error when one is expected. Im not sure why thats going on, but if you're not planning to run with MPI then its not a problem.

You have bothered to install MPI, so you are probably be planning to run things in parallel... this one failed test is certainly odd. If you had a serious problem with your MPI install you would get more failed tests I think.

You could try running testflo like this: testflo openmdao -n 1 --show_skipped to see if more MPI tests are being skipped... that might help you narrow it down.

Upvotes: 0

Related Questions