add a missing Python module or package to the windows LibPack release

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

add a missing Python module or package to the windows LibPack release

Post by bernd »

Lately I had the problem to be able to run a simple own module on Windows but the Python module is not part of the FreeCAD libpack version (LP_12.1.6) which can be downloaded here: https://github.com/FreeCAD/FreeCAD/rele ... g/0.19_pre

I found a workaround to add this Python package which I would like to share ...

- download FreeCAD_0.19.xxxxx_x64_LP_12.1.6_PY3QT5-WinVS2015.7z
- extract
- download geopy tar.gz from here https://pypi.org/project/geopy/#files
- extract gz, extract tar (7zip works great here)
- in geopy-2.0.0.tar.gz\dist\geopy-2.0.0.tar\geopy-2.0.0\ there is a directory geopy
- copy this directory geopy into the FreeCAD directory FreeCAD_0.19.xxxxx_Py3Qt5\bin\Lib
- start FreeCAD
- import geopy
- no errormessage anymore :D


sgrogan wrote: :bell:
I found the above by trail and error not because I new what I was doing. Thus the question if this was done correct?
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: add a missing Python module to the windows lib pack release

Post by sgrogan »

bernd wrote: Fri Aug 07, 2020 8:59 am I found the above by trail and error not because I new what I was doing. Thus the question if this was done correct?
Hey bernd,
This will usually work. I usually place the folder in FreeCAD_0.19.xxxxx_Py3Qt5\bin\Lib\site-packages, but anywhere in FreeCAD's syspath should work.

Since the move to PY3 we now bundle pip. So you can shift + RMB on the bin directory and open a Powershell window, then

Code: Select all

./python -m pip install geopy
This has the advantage that pip should handle any dependencies. And indeed it looks like geopy has a dependency on geographiclib :o
Doing it this way, you should also be able to update with pip.
NOTE: you will get a notice to update pip, it is on my list. You can do it locally.
"fight the good fight"
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: add a missing Python module to the windows lib pack release

Post by bernd »

wow thats coool ! :D
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: add a missing Python module or package to the windows LibPack release

Post by ickby »

I intend to use this functionality, but I have some follow up questions to that:

1. Is this packaged in LP and Conda builds, hence also available on Mac?
2. Does pip install the files into the bin/Lib... folder automatically?

I'm a bit concerned with write rigths. I intend to let the user trigger the requirement installation, but he would not run freecad as admin. Maybe it is best to rederict the pip installation into a folder of my own Module, as there the chances are very high that the user has write access.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: add a missing Python module or package to the windows LibPack release

Post by bernd »

Have used the above on various packages with success. :D

BTW:
pip can also be used from inside Python ... See https://forum.freecadweb.org/viewtopic. ... 56#p526992
Post Reply