LibPack for Windows "Python packages"

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

I don't know if the warnings can be ignored or not. Maybe Werner could have a quick look?
wmayer wrote: Wed Dec 02, 2020 9:28 am .
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

While a release build works, the debug build fails:

Code: Select all

   Creating library D:/FreeCAD-build/src/App/Debug/FreeCADApp_d.lib and object D:/FreeCAD-build/src/App/Debug/FreeCADApp_d.exp
58>PropertyContainerPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>PropertyFile.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>PropertyStandard.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>ExtensionContainerPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>DocumentObjectGroup.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>FeaturePython.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>ObjectIdentifier.obj : error LNK2001: unresolved external symbol __imp__Py_NegativeRefcount
58>Application.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>ApplicationPy.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>MaterialPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>PropertyContainerPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>PropertyFile.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>PropertyLinks.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>PropertyStandard.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>DocumentPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>FeaturePython.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>LinkBaseExtensionPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>ObjectIdentifier.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>ExtensionContainerPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>GroupExtensionPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>DocumentObjectGroup.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>DocumentObjectPyImp.obj : error LNK2001: unresolved external symbol __imp__Py_RefTotal
58>D:\FreeCAD-build\bin\FreeCADApp_d.dll : fatal error LNK1120: 2 unresolved externals
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

uwestoehr wrote: Sat Dec 05, 2020 11:53 pm While a release build works, the debug build fails:
I googled around and found this workaround. I applied this solution: https://stackoverflow.com/questions/388 ... or-windows
to comment out

Code: Select all

#       define Py_DEBUG
in pyconfig.h of the LibPack AND I also had to do this in pyconfig.h of my local standalone Python installation.

-> I'll check if the problems vanishes if I use the Python that comes with the LibPack.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

uwestoehr wrote: Sun Dec 06, 2020 12:27 am -> I'll check if the problems vanishes if I use the Python that comes with the LibPack.
OK, I found the problem: the Python libraries were found by CMake but not the debug library. I see that we have these 2 properties in CMake:
PYTHON_LIBRARY_DEBUG
and
PYTHON_DEBUG_LIBRARY
(what's their difference?)

When running CMake (I have CMake 3.18.5) both are not found, I had to add for both manually the path to the LibPack:
D:/FreeCAD-build/FreeCADLibs_12.4.2_x64_VC17/bin/libs/python38_d.lib
then I can compile a debug build without modifying pyconfig.h.

However, when compiling a debug build, I get the info that 2 PDB's are missing:

Code: Select all

freetyped.lib(ftinit.obj) : warning LNK4099: PDB 'freetype.pdb' was not found with 'freetyped.lib(ftinit.obj)' or at 'D:\FreeCAD-build\Mod\Part\freetype.pdb'; linking object as if no debug info

Code: Select all

Qt5UiToolsd.lib(quiloader.obj) : warning LNK4099: PDB 'Qt5UiToolsd.pdb' was not found with 'Qt5UiToolsd.lib(quiloader.obj)' or at 'D:\FreeCAD-build\bin\Qt5UiToolsd.pdb'; linking object as if no debug info
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

There is a further issue:

When I use a2plus with my build I get this error:

Code: Select all

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
    https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
  * The Python version is: Python3.8 from "D:\FreeCAD-build\bin\FreeCAD_d.exe"
  * The NumPy version is: "1.18.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
" occurred in C:\Users\USti\AppData\Roaming\FreeCAD\Mod\A2plus\InitGui.py
Therefore I run

Code: Select all

pip install --upgrade numpy
This gives me numpy 1.9.4 (and issues a warning that my pip version is outdated:

Code: Select all

WARNING: You are using pip version 20.2.1; however, version 20.3.1 is available.
You should consider upgrading via the 'c:\program files\python38\python.exe -m pip install --upgrade pip' command.
).

But the problem persists.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: LibPack for Windows "Python packages"

Post by apeltauer »

uwestoehr wrote: Sun Dec 06, 2020 11:37 pm ...
c:\program files\python38\python.exe -m pip install --upgrade pip' command.[/code]).
...
But the problem persists.
Can you please check what python you are using? I think some how your local installation of python is used?!
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: LibPack for Windows "Python packages"

Post by apeltauer »

Updated the lib pack.
The warnings should now be gone...
https://github.com/apeltauer/FreeCAD/re ... ack_12.4.2
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

apeltauer wrote: Mon Dec 07, 2020 6:50 am Can you please check what python you are using? I think some how your local installation of python is used?!
I use the Python bundles in your LibPack:
Image

As I wrote, I had to fill the values for PYTHON_LIBRARY_DEBUG and PYTHON_DEBUG_LIBRARY manually since CMake did not fill it automatically.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: LibPack for Windows "Python packages"

Post by apeltauer »

uwestoehr wrote: Mon Dec 07, 2020 9:09 am ...
Sorry for the misslead. I thougt that some how your local python is used because pip is telling this:

Code: Select all

c:\program files\python38\python.exe -m pip install --upgrade pip' command.
).[/code]
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: LibPack for Windows "Python packages"

Post by uwestoehr »

apeltauer wrote: Mon Dec 07, 2020 9:25 am Sorry for the misslead. I thougt that some how your local python is used because pip is telling this:

Code: Select all

c:\program files\python38\python.exe -m pip install --upgrade pip' command.
).[/code]
Indeed, this is the path of my local Python installation. I'll check out your new LibPack at the moment and if the problem persists, I will remove the local Python.
Post Reply