GeoDataWB not working in Mac OS X

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
M-Rick
Posts: 38
Joined: Fri Aug 22, 2014 1:03 pm

GeoDataWB not working in Mac OS X

Postby M-Rick » Sat Feb 17, 2018 1:15 pm

I am still trying to figure out how to be able to use the GeoData WorkBench in Macos. Each time I try to import OSM data, I get a Python error, no module named cv2.
I installed OpenCV in my local Python installation, but the error is still happening.

Since GeoDataWB is now part of the official release of Freecad v17, wouldn't it be simpler to install all the Python libraries required for the release? Such as including OpenCV in FreeCAD Python distribution.

Or, maybe a way to override the FreeCAD Python path, like done in QGIS in the application settings.

In QGIS, I setted up an Anaconda environment specific to QGIS, unloaded by the system, and since this time I never get Python errors anymore.
looo
Posts: 2392
Joined: Mon Nov 11, 2013 5:29 pm

Re: GeoDataWB not working in Mac OS X

Postby looo » Sat Feb 17, 2018 1:40 pm

In QGIS, I setted up an Anaconda environment specific to QGIS, unloaded by the system, and since this time I never get Python errors anymore.
For windows and linux there are some conda binaries for FreeCAD. Maybe you can find someone who is able to create conda-packages for mac. I think this wouldn't be too much effort as the recipes should be nearly the same as the linux-recipes.
chrisb
Posts: 14463
Joined: Tue Mar 17, 2015 9:14 am

Re: GeoDataWB not working in Mac OS X

Postby chrisb » Sat Feb 17, 2018 1:46 pm

M-Rick wrote:
Sat Feb 17, 2018 1:15 pm
I am still trying to figure out how to be able to use the GeoData WorkBench in Macos. Each time I try to import OSM data, I get a Python error, no module named cv2.
Which version do you use Qt4 or Qt5? FreeCAD info? Pointer to OSM data, so we reproduce?
M-Rick
Posts: 38
Joined: Fri Aug 22, 2014 1:03 pm

Re: GeoDataWB not working in Mac OS X

Postby M-Rick » Sat Feb 17, 2018 9:10 pm

chrisb wrote:
Sat Feb 17, 2018 1:46 pm
M-Rick wrote:
Sat Feb 17, 2018 1:15 pm
I am still trying to figure out how to be able to use the GeoData WorkBench in Macos. Each time I try to import OSM data, I get a Python error, no module named cv2.
Which version do you use Qt4 or Qt5? FreeCAD info? Pointer to OSM data, so we reproduce?
I use the QT5 version.

Switching to the workbench get errors. Then when using any of the available options doesn't.

Code: Select all

--------------ERROR loading reconstruction workbench ---------------------
--------------ERROR loading reconstruction workbench ---------------------
--------------ERROR loading reconstruction workbench ---------------------
--------------ERROR loading reconstruction workbench ---------------------
--------------ERROR loading reconstruction workbench ---------------------
Arch workbench activated
Arch workbench deactivated
run import ...
Running the Python command 'Import OSM Map' failed:
Traceback (most recent call last):
  File "<string>", line 165, in Activated
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/__init__.py", line 2, in <module>
    import geodat.import_aster
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/import_aster.py", line 23, in <module>
    import geodat.geodat_lib
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/geodat_lib.py", line 11, in <module>
    import cv2

No module named cv2run import ...
Running the Python command 'Import CSV' failed:
Traceback (most recent call last):
  File "<string>", line 64, in Activated
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/__init__.py", line 2, in <module>
    import geodat.import_aster
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/import_aster.py", line 23, in <module>
    import geodat.geodat_lib
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/geodat_lib.py", line 11, in <module>
    import cv2

No module named cv2run import ...
Running the Python command 'Import GPX' failed:
Traceback (most recent call last):
  File "<string>", line 113, in Activated
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/__init__.py", line 2, in <module>
    import geodat.import_aster
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/import_aster.py", line 23, in <module>
    import geodat.geodat_lib
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/geodat_lib.py", line 11, in <module>
    import cv2

No module named cv2run import ...
Running the Python command 'Import Heights' failed:
Traceback (most recent call last):
  File "<string>", line 183, in Activated
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/__init__.py", line 2, in <module>
    import geodat.import_aster
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/import_aster.py", line 23, in <module>
    import geodat.geodat_lib
  File "/Users/aymeric/Library/Preferences/FreeCAD/Mod/geodata/geodat/geodat_lib.py", line 11, in <module>
    import cv2

No module named cv2
chrisb
Posts: 14463
Joined: Tue Mar 17, 2015 9:14 am

Re: GeoDataWB not working in Mac OS X

Postby chrisb » Sun Feb 18, 2018 12:18 am

M-Rick wrote:
Sat Feb 17, 2018 1:15 pm
Since GeoDataWB is now part of the official release of Freecad v17, wouldn't it be simpler to install all the Python libraries required for the release?
I just installed a fresh version (see below), but I cannot see the GeoData workbench in this release. Perhaps there is a misunderstanding: The Workbenches available in the Addon Manager are not part of the official release, they are third party addons.

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13303 (Git)
Build type: Release
Branch: (HEAD detached at b47e011)
Hash: b47e011c1cc6357fa776624d371ed434989c79b1
Python version: 2.7.14
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
M-Rick
Posts: 38
Joined: Fri Aug 22, 2014 1:03 pm

Re: GeoDataWB not working in Mac OS X

Postby M-Rick » Sun Jun 03, 2018 3:10 pm

On MacOS X, the geotools are provided by KyngChaos who is the leed developper of the MacOS version of QGIS.
http://www.kyngchaos.com/software/qgis

It installs GDAL, SQLITE with Spatialite, GEOS, Proj frameworks packages and the specific Pythons modules packages used by QGIS, NumPy, SciPy, PIL, Matplotlib, psycopg2, RPy2 and PySAL.

The problem is FreeCAD GeoData tools are using OpenCV. OpenCV can be run that's not the problem, it is even necessary to run some QGIS extensions.
But MacOS uses several Python paths and the GeoData workbench uses the python installation included inside the FreeCAD application itself. On the other platforms, Python isn't included with FreeCAD, it is necessary to install additional libraries.

I made a try on Wine with the Windows version. FreeCAD installed right out of the box and then the workbench just run as expected without any additional tricks.
Capture d’écran 2018-05-13 à 16.06.33.png
Capture d’écran 2018-05-13 à 16.06.33.png (144.25 KiB) Viewed 379 times

I tried to modify the files included in the workbench but I got errors all the time because the Python modules weren't able to know which module was referring to.

That’s not big deal for now because the GeoData workbench has limited use for now. But maybe it will be necessary to think in the future how to organise the external Python modules for the additional workbenches, or to add other Python modules directly in the basic FreeCAD installation.
User avatar
Kunda1
Posts: 3916
Joined: Thu Jan 05, 2017 9:03 pm

Re: GeoDataWB not working in Mac OS X

Postby Kunda1 » Sun Jun 03, 2018 3:43 pm

microelly2 wrote:ping
Hopefully @microelly2 can participate in this discussion
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
microelly2
Posts: 4228
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: GeoDataWB not working in Mac OS X

Postby microelly2 » Mon Jun 04, 2018 7:06 am

I will add a configurable sys path extension to the workbench. this should solve the prblem.
M-Rick
Posts: 38
Joined: Fri Aug 22, 2014 1:03 pm

Re: GeoDataWB not working in Mac OS X

Postby M-Rick » Fri Jun 08, 2018 7:14 pm

Great 👍
TimN
Posts: 1
Joined: Mon Jan 21, 2019 4:18 pm

Re: GeoDataWB not working in Mac OS X

Postby TimN » Mon Jan 21, 2019 4:30 pm

Hey Guys,

I just started into FreeCAD and I'm also on Mac OS, using v17.
I'm not that big in python but developed a basic understanding of where and how to look for.
I encountered the same problems as described here before, so I'm curious about how to solve the Problem.
@microelly2 - is there already anywhere in FC the configurable sys path extension you were writing of? I haven't found this jet, nor any other solution.

Would be great to get some update of this topic, or figure out if I should rather try the "wine way", as I couldn't find any other workaround.

Best regards,
Tim