Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Porting to python3

Post by ebrahim raeyat »

triplus wrote: Tue Dec 11, 2018 8:20 pm
That is try out this option again, only this time install pandas from Conda.
I examined that, but it also gives me that error. I guess it's related to lic6, isn't that? it works on old manjaro. I also wanted to update hole of my system, but it told me that's every thing is up to date :D
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Today i don't have more time, but for the future reference, can you describe the procedure more in detail? Procedure leading to crash. I am guessing crash happens when using some command from your module/workbench?

P.S. Ideally you would narrow it down to a code snippet.
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Porting to python3

Post by ebrahim raeyat »

triplus wrote: Tue Dec 11, 2018 8:37 pm Today i don't have more time, but for the future reference, can you describe the procedure more in detail? Procedure leading to crash. I am guessing crash happens when using some command from your module/workbench?

P.S. Ideally you would narrow it down to a code snippet.
yes. in interactive python consol in FreeCAD type this:

Code: Select all

import pandas as pd
df = pd.DataFrame()
df.to_excel('/home/ebi/df1.xlsx')
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

ebrahim raeyat wrote: Tue Dec 11, 2018 8:26 pm I examined that, but it also gives me that error. I guess it's related to lic6, isn't that? it works on old manjaro. I also wanted to update hole of my system, but it told me that's every thing is up to date :D
if you have installed pandas with pip-tools it is installed in a local directory. So maybe this package hides the conda-package which is installed in another location. You can check this with:

Code: Select all

import pandas as pd
pd.__file__
For me your code-snippet worked after installing pandas and xlwt from conda. So I still believe your problem is related to an incompatible pandas.
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Porting to python3

Post by ebrahim raeyat »

looo wrote: Tue Dec 11, 2018 9:52 pm

Code: Select all

import pandas as pd
pd.__file__
For me your code-snippet worked after installing pandas and xlwt from conda. So I still believe your problem is related to an incompatible pandas.
in both miniconda and AppImage pandas's path is:

Code: Select all

'/home/ebi/.local/lib/python3.6/site-packages/pandas/__init__.py'
my pythons in manjaro linux are pyhton2.7 and python3.7 and when i type $python in bash it runs python3.7.

python 3.6 is for conda and AppImage. it is my site-package in AppImage:
pandas.png
pandas.png (39.91 KiB) Viewed 1668 times
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

ebrahim raeyat wrote: Wed Dec 12, 2018 6:33 am in both miniconda and AppImage pandas's path is:

'/home/ebi/.local/lib/python3.6/site-packages
Exactly this is the problem. This local Install of pandas hides the system/ conda package. Simple remove the pandas in .local/lib/python3.6 and test again.
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Porting to python3

Post by ebrahim raeyat »

looo wrote: Wed Dec 12, 2018 7:00 am Exactly this is the problem. This local Install of pandas hides the system/ conda package. Simple remove the pandas in .local/lib/python3.6 and test again.
when I moved site-packages in loacal and run miniconda FreeCAD, pandas's path is:

'/home/ebi/miniconda3/envs/fc_test/lib/python3.6/site-packages/pandas/__init__.py'

but same problem still exist. in AppImage it not recognize pandas at all. how can i install pandas? I extract AppImage and go to the bin folder and run:

Code: Select all

./python
it gives me Python 3.6.7 | packaged by conda-forge.

is it true if i install package in below manner:

./python -m pip install PACKAGENAME

thanks
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Yes, to get you started, a solution and explanation from @looo makes sense. That is to remove the pip pandas version altogether and use (install) FreeCAD and pandas from Conda channels.

As for the bigger problem involved. I guess this shows on just how problematic FreeCAD module dependencies can be. We can not always rely on pip. Libraries available by default (AppImage, macOS and Windows binaries) is what FreeCAD module developer can more or less rely on. Everything else can represent a problem. And likely we will never pack all the dependencies FreeCAD module developers might use in the binaries. Therefore different possible solutions for specific use case problems will i guess need to be explored. As for the AppImage. On how to make it work. I can do some tests but likely not before next week. And there is another problem. If the solution won't be straightforward. Potential end users will have issues when trying to use your module. And therefore packing pandas in AppImage is one solution. But what about other platforms?
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: Porting to python3

Post by ebrahim raeyat »

in AppImage i install dependency for pandas and the path is:

'/home/ebi/Applications/squashfs-root/usr/lib/python3.6/site-packages/pandas/__init__.py'

but still error occured. I will examin the path in old manjaro and my new ubuntu.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Yes exactly. AppImage and pandas installed with pip (in your use case and environment won't work). We can try to find a solution in the future.

For now therefore removing the pandas installed with pip altogether and after installing and using FreeCAD and pandas from Conda, should work.
Post Reply