cannot import name 'plot' from 'freecad.plot'

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Post Reply
zee111
Posts: 2
Joined: Wed Apr 20, 2022 7:02 am

cannot import name 'plot' from 'freecad.plot'

Post by zee111 »

Hi Guys

So I'm a new user to FreeCAD and CfdOF :), and I wanted to run a quick simulation however I am encountering the following error when I run the simulation:
<class 'ImportError'>: cannot import name 'Plot' from 'freecad.plot' (C:\Users\Zee\AppData\Roaming\FreeCAD\Mod\Plot\freecad\plot\__init__.py)

I've tried googling a few solutions however I have not been able to solve the problem as yet.

I have installed the plot workbench via the addon manager, however when I do a dependency check I get the following errors:
"Checking dependencies...
System: Windows
Runtime: MinGW
OpenFOAM directory: C:\Program Files\ESI-OpenCFD\OpenFOAM\v2012
Paraview executable: C:/Program Files/ParaView 5.5.2-Qt5-Windows-64bit/bin/paraview.exe
Could not load Plot workbench
Please install it using Tools | Addon manager
gmsh executable: C:/Program Files/FreeCAD 0.19/bin/gmsh.exe"

The addon manager explicitly shows that I have the plot workbench installed but I guess this might not be the case.
KAKM
Posts: 109
Joined: Tue May 04, 2021 12:17 am

Re: cannot import name 'plot' from 'freecad.plot'

Post by KAKM »

If you go to the workbench dropdown menu, does Plot show up there? If it doesn't, you might try reinstalling the plot workbench and/or restarting FreeCAD. You can also try opening the Plot workbench to make sure it loads (FreeCAD doesn't load all workbenches on startup to save system resources–it loads stuff when you try to use it).
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: cannot import name 'plot' from 'freecad.plot'

Post by oliveroxtoby »

zee111 wrote: Wed Apr 20, 2022 7:14 am Hi Guys

So I'm a new user to FreeCAD and CfdOF :), and I wanted to run a quick simulation however I am encountering the following error when I run the simulation:
<class 'ImportError'>: cannot import name 'Plot' from 'freecad.plot' (C:\Users\Zee\AppData\Roaming\FreeCAD\Mod\Plot\freecad\plot\__init__.py)
The problem here is that the plotting functionality has just been removed from the plot workbench (https://github.com/FreeCAD/freecad.plot/pull/16) since it was moved into the core for version 0.20. Unfortunately this had the effect of the breaking the plotting capability of CfdOF in FreeCAD 0.19, so I have copied the relevant file in to CfdOF as a backward compatibility measure. Hopefully if you update CfdOF you will find it is working now. Plot workbench no longer needed.
zee111
Posts: 2
Joined: Wed Apr 20, 2022 7:02 am

Re: cannot import name 'plot' from 'freecad.plot'

Post by zee111 »

Hi oliveroxtoby

Spot on. I've updated CfdOF and the simulation now runs perfectly :D :D :D :D
Thanks for all the help. I greatly appreciate it.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: cannot import name 'plot' from 'freecad.plot'

Post by Kunda1 »

Is there a way to make the user aware that Plot was moved to an external workbench through the error messages?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: cannot import name 'plot' from 'freecad.plot'

Post by oliveroxtoby »

Kunda1 wrote: Tue May 31, 2022 2:26 pm Is there a way to make the user aware that Plot was moved to an external workbench through the error messages?
It's actually the other way around - the plot machinery has been moved to the base code and out of the external workbench now. There should be no possibility of an error now as we have a copy of the module within CfdOF (for compatility with 0.19) and in 0.20 it is present in the base code.
Post Reply