Blenderbim packaging and dependencies

Although I really do have more pressing things to do, I thought I would try and see what is needed to unbundle the blenderbim plugin from its dependencies and create a 'normal' linux package (I'm not sure I intend to continue doing this regularly as blenderbim is a moving target, but these tests may be a useful starting off point for anyone else who needs to do this).

Here is a dependency tree of blenderbim as far as I can make out (names are fedora rpm packages):

  • IfcOpenShell

    • tbb-devel
    • cmake
    • gcc-c++
    • boost-devel
    • OCE-devel
    • libicu-devel
    • openCOLLADA-devel
    • pcre-devel
    • python3-devel
    • swig
    • libxml2-devel
    • blender-rpm-macros
  • IfcOpenShell-python3

    • python3-behave
    • python3-lark-parser
    • python3-pyparsing
    • python3-xlsxwriter
    • python3-odfpy
    • python3-parse_type
    • python3-parse
    • python3-ordered-set
    • python3-defusedxml
  • IfcOpenShell-blenderbim

    • python3-jsonpickle
    • python3-elementpath
    • python3-deepdiff
    • python3-svgwrite
    • python3-pythonocc-core

      • OCE-devel
      • python3-svgwrite
      • python3-six
    • python3-bcfplugin

      • python3-pytz
      • python3-dateutil
      • python3-xmlschema
    • python3-pystache

    • python3-python-fcl
      • fcl-devel

All of these are standard fedora packages except for IfcOpenShell, pythonocc-core, bcfplugin, pystache and python-fcl -- so I needed to build these. Also I didn't realise that fedora now has both an OCE and an opencascade package, so I linked with the old OCE 'Opencascade Community Edition' by mistake, if I do this again I will just use opencascade.

All the necessary RPM packages are in this fedora IfcOpenShell copr repository.

So if you have fedora 32, you can install a snapshot of the IfcOpenShell 0.6.0 branch, yesterday's blenderbim and all dependencies like so (you still need to go into the blender preferences and enable the checkbox for the addon):

sudo dnf copr enable bpostle/IfcOpenShell
sudo dnf install IfcOpenShell-blenderbim

..as a bonus, this installs the IfcOpenShell python modules, so if you also want IFC in FreeCAD, you can just install a FreeCAD 0.19 snapshot from this FreeCAD nightly snapshot copr repository:

sudo dnf copr enable @freecad/nightly
sudo dnf install freecad

This seems to mostly work, though I haven't tested functionality that I have never got working anyway (like ifcdiff). One gotcha is that blenderbim is now installed to /usr/share, so blender doesn't have write permissions to the addon folder -- blenderbim writes cache and log files to a scene.BIMProperties.data_dir folder, which defaults to the location of the addon. So before using the addon in a project you need to change the Blender -> Properties -> Scene -> Data Directory to someplace where you have write permissions (@Moult can the addon do a check for write permission and default to someplace like ~/.local/share/blender/benderbim instead in this situation?).

[edit] another bonus is that these packages are also built for armhfp, so you can now have blenderbim on your raspberrypi!

MoultJesusbill

Comments

  • edited July 27

    I also packaged (AUR) it for Arch based distro (eg. Manjaro) :

    Also about python-fcl I opened an issue on github as there is currently no official up to date python-fcl version compatible with latest fcl. We have apparently a solution.

    @brunopostle said:One gotcha is that blenderbim is now installed to /usr/share, so blender doesn't have write permissions to the addon folder -- blenderbim writes cache and log files to a scene.BIMProperties.data_dir folder, which defaults to the location of the addon. So before using the addon in a project you need to change the Blender -> Properties -> Scene -> Data Directory to someplace where you have write permissions (@Moult can the addon do a check for write permission and default to someplace like ~/.local/share/blender/benderbim instead in this situation?).

    I got same issue. Your workaround feels better. I started investigating on how to solve this but maybe @Moult has a quicker solution.

    Edit : @brunopostle Where can I find your package build files like PKGBUILD on AUR ?

  • @Cyril If you click on Builds in the copr page, you can examine all the files related to each build. These are the RPM spec files I used for each package:

    Cyril
  • I've documented with a comment why each dependency is pulled in in the Makefile. So for example, you can see that odfpy is actually needed by IFCCOBie to provide ODS export support, not IfcOpenShell-Python.

    IFCDiff may not work for you since it requires my forked DeepDiff.

    Good idea about checking for write access. Will add that feature. Also, over time, the data dir is being progressively cleaned up so that will help... but fundamentally there still needs to be a place for it to dump files :)

  • edited July 27

    @Moult thanks, I was using the Makefile for reference, but I see that there are a bunch of python tools (that I haven't actually packaged) in IfcOpenShell that are neither part of the python api or the blender addon:

    • occ_utils.py
    • ifcclash/*
    • ifcbimtester/* (though I'm not quite sure where the 'features' sub-folder goes to still be accessible)
    • cobie.py
    • ifcdiff.py
    • ifccsv.py

    I suppose these should go in an IfcOpenShell-utils package, plus there is other stuff like a qt viewer that I didn't even think of packaging.

  • Correct, those Python tools are completely separate to the BlenderBIM Add-on, and can be bundled separately. I have only included them in the BlenderBIM Add-on package because Blender provides a GUI for them. However, they can operate as a CLI, or as a library.

    I think it would be good if FreeCAD could also provide a little GUI for them too - that would help us further share code :) Thoughts, @yorik?

    For IFC BIMTester, you can just run pyinstaller which will combine everything, including the features/ folder into a single binary. The same goes for the other utilities. I've included a little comment at the top of each file giving the appropriate pyinstaller command to run.

  • @Moult just noting a couple of things (these are not urgent, your addon bundle is the preferred way of installing blenderbim for the forseeable future):

    • none of these tools have functional shebang lines, and only ifclash.py has the executable bit set. Though they all seem to run ok as command-line tools if I prepend #!/usr/bin/python3 and chmod +x.
    • There are two slightly different versions of occ_utils.py in the v0.6.0 branch
    • There is no pyinstaller in fedora!
  • @brunopostle - would you mind submitting a PR to fix the shebangs? You're absolutely right about that!

    The occ_utils.py has a little dirty hotfix to stop it from complaining about the OCC version that I use. Details here: https://github.com/IfcOpenShell/IfcOpenShell/issues/812

    pyinstaller can be installed via pip. Does that help?

  • @Moult PR done (had to remember how to do that, it's been a long time).

    I could add pyinstaller to fedora proper, but I don't particularly fancy maintaining it forever

    Moult
Sign In or Register to comment.