[SOLVED] pyrate Installed but Does Not Show up as WB Option

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
cflin
Posts: 50
Joined: Sun May 14, 2017 10:21 pm

[SOLVED] pyrate Installed but Does Not Show up as WB Option

Postby cflin » Tue Dec 11, 2018 7:58 pm

I have installed the optical design WB pyrate with the add-on manager. The add-on manager shows pyrate as installed and even updates it, but no pyrate WB option shows up in the WB drop-menu. Earlier, there was a discussion thread about the aesthetics of the pyrate logo, but I think my issue is different, so I decided to start a new thread. I am running FC 0.18, fully updated, on Ubuntu 16.04, as per the info below. I remember that earlier this year I had a similar issue with the WorkFeature WB not showing up as an option on both FC 0.18 and FC 0.17 while the add-on manager showed as installed, but that issue resolved itself.

OS: Ubuntu 16.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15363 (Git)
Build type: Release
Branch: master
Hash: 9be3e633328335f1172456f5857219b7a08c70a5
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Last edited by cflin on Sat Jan 19, 2019 6:56 am, edited 1 time in total.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby triplus » Tue Dec 11, 2018 8:25 pm

Hi @cflin

Likely this isn't a question directly related to UX/UI Design. Anyway, if the workbench isn't listed an error during FreeCAD (mentioned module) start might occur. Make sure that under Edit -> Preferences -> General -> Output window -> Output all options are checked. Restart FreeCAD and look in the Report view, if any clues (errors) will emerge.
User avatar
sgrogan
Posts: 5458
Joined: Wed Oct 22, 2014 5:02 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby sgrogan » Tue Dec 11, 2018 10:45 pm

cflin wrote:
Tue Dec 11, 2018 7:58 pm
I remember that earlier this year I had a similar issue with the WorkFeature WB not showing up as an option on both FC 0.18 and FC 0.17 while the add-on manager showed as installed, but that issue resolved itself.
triplus wrote:
Tue Dec 11, 2018 8:25 pm
Restart FreeCAD and look in the Report view, if any clues (errors) will emerge.
you need to install python-scipy from your package manager
cflin
Posts: 50
Joined: Sun May 14, 2017 10:21 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby cflin » Wed Dec 12, 2018 4:18 am

@triplus: Thank you for your insightful recommendation to turn on all output options. A lot of messages come out because quite a few modules are loaded, but one of them stuck out like a sore thumb:

Code: Select all

 Init:      Initializing /home/cflin/.FreeCAD/Mod/pyrate(InitGui.py not found)... ignore 
Upon closer look, it seems that the missing 'InitGui.py' affects other modules as well, which, like 'pyrate' do not show up as WB options but the add-on manager is well-aware they are installed and updates them. I get similar warnings. So, it is probably not an issue with 'pyrate' but a more systematic one.

In my version of FreeCAD, to set the output options I have to select Edit→Preferences→Ouput window, which is slightly different than what you described. (I found my way, though. Thank's again.) As for this posting not being entirely appropriate for this category, could you recommend another topic area? I surely don't want to post stuff where it does not belong.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby triplus » Wed Dec 12, 2018 2:12 pm

cflin wrote:
Wed Dec 12, 2018 4:18 am
@triplus: Thank you for your insightful recommendation to turn on all output options.
You're welcome.

Code: Select all

 Init:      Initializing /home/cflin/.FreeCAD/Mod/pyrate(InitGui.py not found)... ignore 
Upon closer look, it seems that the missing 'InitGui.py' affects other modules as well, which, like 'pyrate' do not show up as WB options but the add-on manager is well-aware they are installed and updates them.
I did a quick test. This module uses a new import style and therefore that shouldn't prevent it from running. Likely, as @sgrogan indicated, there is an additional line saying some dependency is missing. Installing the module with addon managed and using FreeCAD 0.18 from PPA, having this dependencies installed on the system:

Code: Select all

sudo apt-get install python python-numpy python-scipy python-matplotlib python-yaml python-sympy
https://github.com/mess42/pyrate

It works on my side after.
As for this posting not being entirely appropriate for this category, could you recommend another topic area? I surely don't want to post stuff where it does not belong.
I see that one of the mods has already moved the thread to appropriate category.
cflin
Posts: 50
Joined: Sun May 14, 2017 10:21 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby cflin » Wed Dec 12, 2018 4:41 pm

@triplus

Thank you for your time.

Code: Select all

sudo apt-get install python python-numpy python-scipy python-matplotlib python-yaml python-sympy
Done. All these packages are now installed. (I use Anaconda for my Python needs, so Ubuntu 16.04's Python did not have some of this stuff installed.)

I also uninstalled with '--purge' freecad-daily and reinstalled it. From the ppa all the time. I also uninstalled and reinstalled pyrate, but I still don't see pyrate with the same message about 'InitGui.py' not found (and similarly other installed WBs do not show up and the warning is the same). So, it seems to me the issue is this 'InitGui.py', which seems to affect other WBs as well. Where on your installation is this elusive 'InitGui.py' installed? I don't see any other messages about dependencies, except that about the missing 'InitGui.py'.

I am not sure where this tread has been transferred by the moderator(s). I checked pyrate on github, as per the URL shown, but I did not see anything like this thread there.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby triplus » Thu Dec 13, 2018 11:05 am

cflin wrote:
Wed Dec 12, 2018 4:41 pm
I also uninstalled and reinstalled pyrate, but I still don't see pyrate with the same message about 'InitGui.py' not found (and similarly other installed WBs do not show up and the warning is the same). So, it seems to me the issue is this 'InitGui.py', which seems to affect other WBs as well. Where on your installation is this elusive 'InitGui.py' installed? I don't see any other messages about dependencies, except that about the missing 'InitGui.py'.
I get that message too, but is still works. This module is using the new import style and the produced message is therefore normal. Inside .FreeCAD/Mod folder, there should be a pyrate folder, containing some files and folders. I guess best if you temporarily move all other modules to a different location. And start FreeCAD again. If no errors will be reported, and it still won't be listed, try running this code from the FreeCAD Python console:

Code: Select all

Gui.activateWorkbench("PyrateWorkbench")
looo
Posts: 2948
Joined: Mon Nov 11, 2013 5:29 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby looo » Thu Dec 13, 2018 8:35 pm

triplus wrote:
Thu Dec 13, 2018 11:05 am
I get that message too, but is still works. This module is using the new import style and the produced message is therefore normal. Inside .FreeCAD/Mod folder, there should be a pyrate folder, containing some files and folders.
I wondered how this can work as this wasn't by design. But it seems the new-style fully works with the addon-manager and this is why:
1. The old way to load modules adds every directory in .FreeCAD/Mod to the sys.path
2. Now that the base-directory is added to sys.path everything in the .FreeCAD/Mod/<module>/freecad is accessible as a namespace-package and is initialized by the new way to load workbenches/modules.

So the addon-manager should fully work for new-style modules. Feature or bug?
please help with my conda-packaging efforts: https://liberapay.com/looooo/
cflin
Posts: 50
Joined: Sun May 14, 2017 10:21 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby cflin » Sun Dec 16, 2018 7:59 pm

@triplus: Thank you for your suggestion to keep only pyrate in '~/.FreeCAD/Mod'. Without any other module present in that directory, 'pyrate' showed up fine as a WB selection. That got me thinking. Adding (copying) the previously installed modules back to '~/.FreeCAD/Mod' one by one and checking whether the pyrate WB shows up as a selection, I determined that the problem occurs when module 'FCGear' is installed. So, it seems to me that the installation of FCGear, which does show up as a WB selection, prevents pyrate from showing up as a WB selection for some reason I don't understand.
looo
Posts: 2948
Joined: Mon Nov 11, 2013 5:29 pm

Re: pyrate Installed but Does Not Show up as WB Option

Postby looo » Mon Dec 17, 2018 10:43 am

cflin wrote:
Sun Dec 16, 2018 7:59 pm
@triplus: Thank you for your suggestion to keep only pyrate in '~/.FreeCAD/Mod'. Without any other module present in that directory, 'pyrate' showed up fine as a WB selection. That got me thinking. Adding (copying) the previously installed modules back to '~/.FreeCAD/Mod' one by one and checking whether the pyrate WB shows up as a selection, I determined that the problem occurs when module 'FCGear' is installed. So, it seems to me that the installation of FCGear, which does show up as a WB selection, prevents pyrate from showing up as a WB selection for some reason I don't understand.
I see this problem. I guess this is related to using namespace-packages with the add-on manager.
looo wrote:
Thu Dec 13, 2018 8:35 pm
So the addon-manager should fully work for new-style modules. Feature or bug?
I guess I was a bit too fast with assuming that it always works. The problem seems to be that only one name-space-package installed with the add-on-manager works. Somehow the others are hidden. I guess this is to due the way how namespace-packages are initialized.

Ok, I found the problem. Please add this to all freecad/__init__.py files in ~/.FreeCAD/Mod:

Code: Select all

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
For python3 the __init__.py file shouldn't exist. But using the __init__.py with the mentioned line will work for py3 and py2. Maybe you can also create a PR for pyrate and FCGear. (I can also do it, but currently there is no time at all ...)
please help with my conda-packaging efforts: https://liberapay.com/looooo/