[solved] Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

This forum section is only for IFC-related issues
Post Reply
User avatar
HenriqueReis
Posts: 34
Joined: Tue Mar 23, 2021 4:57 pm
Location: São Paulo - SP
Contact:

[solved] Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by HenriqueReis »

*****************
OS: Ubuntu 20.04.3 LTS (Budgie:GNOME/budgie-desktop)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 0d9536ed3e8c7f40197b5606e1b7873625e1d6fe
Python version: 3.8.10
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.5.2
Locale: Portuguese/Brazil (pt_BR)
*****************

Hey guys from the community, I come here to explain a little in detail what is happening with the FreeCAD settings, more specifically about: importing and exporting IFC files.
photo_2022-01-24_20-22-31.jpg
photo_2022-01-24_20-22-31.jpg (11.13 KiB) Viewed 9047 times
As you can see whenever I perform the import or export operation in IFC, FreeCAD displays this error message, claiming that it doesn't have the IFCOpenShell database to run the operation, so I need to install it. So far so good and I understand.

At first I went into research and saw that this flaw is already old, but it turns out that it was with the previous version of Python 2.7. Here are some links I used as a reference initially.
As you can see, in the first link, there is the instruction to go when finished and use the command:
$sudo apt install ifcopenshell
Screenshot from 2022-01-26 12-32-09.png
Screenshot from 2022-01-26 12-32-09.png (13.12 KiB) Viewed 9047 times
The message is in Portuguese, but the translation is:
Unable to find ifcopenshell package
Well, after hours trying to understand mainly the second link, I saw that the operation would be much more complex than just using a "sudo apt install", it turns out that their library is very large and laborious as I was analyzing their link on Github :
So, with this report I believe that it will be better to understand my difficulty in using the function. Due to the great complexity of installing the IFCOpenShell packages, therefore, I would like to hear from you what I can do to better run this tool.

I know it's not on the topic, but the report is just for a better understanding of my difficulties, in this case I'm referring to using the ODA File Converter, as it is necessary to install such a Qt5.14 and as you saw above, the mine is 5.12 and from what I've read it's a lot of work and also heavy to enable it, but I've already solved it, I found a site that does the virtual conversion from dwg to dxf, and it worked perfectly in FreeCAD, just the registration of my complexities.

I hope you understand me and that together we can find the least complex and less cumbersome solution to install the IFCOpenShell packages.
Last edited by HenriqueReis on Wed Jan 26, 2022 10:19 pm, edited 1 time in total.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by Kunda1 »

How did you install FreeCAD?

-----------------------------------------------------
Edit:
What does this command return for you?

Code: Select all

sudo apt search ifcopenshell
-----------------------------------------------------

Per the IfcOpenShell FreeCAD wiki page
As of v0.19, FreeCAD is able to import IFC files as long as the ifcopenshell Python module is available in the system. Likewise, the Arch and BIM Workbenches can export a building model to the IFC format so that it can be used in other applications.

To verify that IfcOpenShell is installed in your system, try to import it from the Python console; the library is correctly installed if no error message is returned.
Write this in the Python console

Code: Select all

import ifcopenshell
The document continues saying that there may be an issue with the path to the ifcopenshell library.
So it would be good to understand where FreeCAD is looking for it

You can ascertain that by writing the following in to the Python console

Code: Select all

import sys
print(sys.path)
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by Kunda1 »

Just an aside, the FreeCAD version that comes on Ubuntu is not ideal to work on especially when it comes to Arch/Bim. Better to use the development version
You can get it from AppImage or Snap
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
HenriqueReis
Posts: 34
Joined: Tue Mar 23, 2021 4:57 pm
Location: São Paulo - SP
Contact:

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by HenriqueReis »

Thanks in advance for your attention and let's get to the answers:

In the case to install on Ubuntu, following the documentation is done by the terminal using the command:

Code: Select all

sudo apt-get install freecad
About the command in the terminal it did not execute anything, as per the image
Screenshot from 2022-01-26 16-51-36.png
Screenshot from 2022-01-26 16-51-36.png (10.36 KiB) Viewed 8893 times
Regarding the function in the python console, it does not import an error, and in the second command all this text follows print screen.
Screenshot from 2022-01-26 16-37-36.png
Screenshot from 2022-01-26 16-37-36.png (82.2 KiB) Viewed 8900 times
Complete text:
['/home/pedro/.FreeCAD/Mod/ArchTextures', '/home/pedro/.FreeCAD/Mod/BCFPlugin', '/home/pedro/.FreeCAD/Mod/Curves', '/home/pedro/.FreeCAD/Mod/BIM', '/home/pedro/.FreeCAD/Mod/Render', '/home/pedro/.FreeCAD/Mod/PlannerWB', '/home/pedro/.FreeCAD/Mod/A2plus', '/home/pedro/.FreeCAD/Mod/BIMBots', '/home/pedro/.FreeCAD/Mod/ModernUI', '/home/pedro/.FreeCAD/Mod/dodo', '/home/pedro/.FreeCAD/Mod/Reinforcement', '/usr/share/freecad/Mod/Drawing', '/usr/share/freecad/Mod/Surface', '/usr/share/freecad/Mod/Measure', '/usr/share/freecad/Mod/Sketcher', '/usr/share/freecad/Mod/TechDraw', '/usr/share/freecad/Mod/Test', '/usr/share/freecad/Mod/Draft', '/usr/share/freecad/Mod/Show', '/usr/share/freecad/Mod/Idf', '/usr/share/freecad/Mod/Material', '/usr/share/freecad/Mod/OpenSCAD', '/usr/share/freecad/Mod/Points', '/usr/share/freecad/Mod/Raytracing', '/usr/share/freecad/Mod/Inspection', '/usr/share/freecad/Mod/Spreadsheet', '/usr/share/freecad/Mod/Web', '/usr/share/freecad/Mod/ReverseEngineering', '/usr/share/freecad/Mod/Arch', '/usr/share/freecad/Mod/Robot', '/usr/share/freecad/Mod/Tux', '/usr/share/freecad/Mod/AddonManager', '/usr/share/freecad/Mod/Start', '/usr/share/freecad/Mod/PartDesign', '/usr/share/freecad/Mod/Mesh', '/usr/share/freecad/Mod/Path', '/usr/share/freecad/Mod/Fem', '/usr/share/freecad/Mod/MeshPart', '/usr/share/freecad/Mod/Part', '/usr/share/freecad/Mod/Import', '/usr/share/freecad/Mod/Image', '/usr/share/freecad/Mod', '/usr/lib/freecad-python3/lib', '/usr/share/freecad/Ext', '/usr/lib/freecad/bin', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/home/pedro/.FreeCAD/Macro', '/usr/lib/freecad/Macro']
Regarding the developer version, unfortunately my experience using it here on Ubuntu was not the best, because it happened that it had the file error, where it wouldn't let save, I clicked save file and it didn't perform any function and didn't open files. So due to this experience I downgraded to 0.19.

Detail in Ubuntu the installation of the developer version only works by snap.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by Kunda1 »

Unfortunately, you can't rely on Ubuntu's available downstream FreeCAD version. You'll either need to use the PPA or Snap

See https://forum.freecadweb.org/viewtopic.php?f=39&t=31253
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by Kunda1 »

Edit: Moved to the IFC subforum
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
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by yorik »

Note that the instructions on the IfcOpenShell page are still valid: You can obtain one from here: https://github.com/IfcOpenBot/IfcOpenSh ... 44547b377e (make sure you use the same Python version as FreeCAD)

Unzip and place the "ifcopenshell" folder in one of the sys.path folders you got above...
User avatar
HenriqueReis
Posts: 34
Joined: Tue Mar 23, 2021 4:57 pm
Location: São Paulo - SP
Contact:

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by HenriqueReis »

yorik wrote: Thu Jan 27, 2022 4:55 pm
I want to thank you, the installation was successful, of course it was not as simple as I imagined, I had help from my brother who is easier to read the documentation to guide me.

what we did was
  • We found which folder your python is using to install packages
  • We copy the already compiled ifcopenshell package into this folder we found
  • and validate that python and freecad are loading it correctly[
It was manual installation actually.

This is all simplified with the command "pip install <package_name>"... But I saw here, ifcopenshell doesn't have it in PyPI (python's default python package repository), so this path we made is the easiest

So all the export and import function worked correctly.

I thank everyone who helped me
User avatar
Moult
Posts: 321
Joined: Sat Jan 05, 2019 11:46 am
Contact:

Re: Preview: Failed to use IFCOpenShell in FreeCAD with Ubuntu 20.4

Post by Moult »

An update that IfcOpenShell is now available on Pip and Conda and also has clear instructions for manual installation. https://blenderbim.org/docs-python/ifco ... ation.html
I also blog about 3D rendering, architecture, software and other on thinkMoult.com. RSS / Atom feed available for your convenience.
Post Reply