Circular import install(?) problem

108 views
Skip to first unread message

Anton Åkesson

unread,
Oct 21, 2021, 10:27:09 AM10/21/21
to SUAVE FORUM
Hi,
I have downloaded and installed SUAVE 2.4.0 using the setup tool as per the instructions AFAIK. The recommended check
>python
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import SUAVE
>>>
seems to work fine when I run it from SUAVE\trunk. If I run it from elsewhere I get the following:
>python
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import SUAVE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\suave-2.4.0-py3.8.egg\SUAVE\__init__.py", line 20, in <module>
    from . import Plots
  File "C:\ProgramData\Anaconda3\lib\site-packages\suave-2.4.0-py3.8.egg\SUAVE\Plots\__init__.py", line 4, in <module>
    from . import Performance
ImportError: cannot import name 'Performance' from partially initialized module 'SUAVE.Plots' (most likely due to a circular import) (C:\ProgramData\Anaconda3\lib\site-packages\suave-2.4.0-py3.8.egg\SUAVE\Plots\__init__.py)

I get the same error when trying to run tut_mission_B737.py from SUAVE\tutorials.
If I put a copy of the tutorial file in SUAVE\trunk I get past that particular error, instead getting

>python tut_mission_B737.py
Traceback (most recent call last):
  File "tut_mission_B737.py", line 31, in <module>
    from SUAVE.Plots.Mission_Plots import *
ModuleNotFoundError: No module named 'SUAVE.Plots.Mission_Plots'

Commenting out 
from . import Performance
in the __init__.py of Plots produced the same result.
I have installed and uninstalled SUAVE a couple of times to no avail and I haven´t found any forum post that seems to have the same issue.

Any help would be much appreciated!

ebot...@gmail.com

unread,
Oct 23, 2021, 2:29:54 AM10/23/21
to SUAVE FORUM
I have not seen that. But I'll take note of this. Thanks for including the version of Python, that may be helpful.

Try putting before the import SUAVE:

from SUAVE.Plots import Performance

I'm curious if that works. Also do a developer install so we can try to change some import ordering.

-Emilio

Anton Åkesson

unread,
Oct 23, 2021, 1:23:47 PM10/23/21
to SUAVE FORUM
Thank you Emilio!
I tried your suggestion and it resulted in the same errors as running the tutorial. I tried removing all SUAVE files and doing the simple install via the .zip file rather than cloning via git as I first did and importing SUAVE is no longer a problem.
The tutorial will now run and produce all plots but not save them or finish. The same seems to go for the solar UAV and Concorde tutorials.
I saw a post about similar problems in an earlier version although the fix seems to have been implemented in my copy of the tutorials. Also it seemed to be more about messy plots than the code not finishing. Was that issue also resolved?

/Anton

Laurent Escalier

unread,
Oct 23, 2021, 5:14:42 PM10/23/21
to SUAVE FORUM
I have the same problem with SUAVE from git.
It seems that the Plots directory has been modified.

Git version --> 2 sub-directories "Geometry" and "Performance"
Zip version --> one "Geometry_Plots" directory and the performance files (Mission_Plots.py, Propeller_Plots.py) are at the root of the Plots directory.

The build process for the Git version is not ok, only the "Geometry" subdir is build/installed....

ebot...@gmail.com

unread,
Oct 25, 2021, 1:14:47 PM10/25/21
to SUAVE FORUM
Hi,
Thanks for bringing that to our attention. We appreciate it. A fix will be finished in under an hour.

There was a typo here. There's an extra period in the init.py name.

-Emilio

Anton Åkesson

unread,
Oct 25, 2021, 1:27:45 PM10/25/21
to SUAVE FORUM
Ah, got it now. One needs to enable saving to file in plot_mission (The tutorial page kinda implies this is already done in step 3 of making sure the installation is working properly, may be worth to make a change to the tutorial page or the .py?) and matplotlib won't finish untill the plots are closed by design.
Reply all
Reply to author
Forward
0 new messages