Failed to get the Python codec of the filesystem encoding

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Failed to get the Python codec of the filesystem encoding

Post by adrianinsaval »

Gene has already tried to help here and I'm sure he would say if he knew how else to solve this.
I think I understand the basics but I never compiled on windows so I can't help much (seems so overly complicated compared to linux, specially when using something scripted as the AUR).
From searching the internet someone suggested removing the PYTHONPATH and PYTHONHOME environment variables but OP mentioned he didn't have references to python in his env variables. Perhaps something needs to be configured in VS. Or maybe he needs to add the libpack to the PATH? I have no idea.
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Failed to get the Python codec of the filesystem encoding

Post by onekk »

adrianinsaval wrote: Mon Feb 28, 2022 2:28 pm Gene has already tried to help here and I'm sure he would say if he knew how else to solve this.
I think I understand the basics but I never compiled on windows so I can't help much (seems so overly complicated compared to linux, specially when using something scripted as the AUR).
From searching the internet someone suggested removing the PYTHONPATH and PYTHONHOME environment variables but OP mentioned he didn't have references to python in his env variables. Perhaps something needs to be configured in VS. Or maybe he needs to add the libpack to the PATH? I have no idea.
I have tried to make the OP note that there is in the wiki page some instructions about some CMake paths, let's see if he is reading again this post.

Something is difficult to help people, expecially if they don't answer to the questions.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Failed to get the Python codec of the filesystem encoding

Post by GeneFC »

adrianinsaval wrote: Mon Feb 28, 2022 2:28 pm Gene has already tried to help here and I'm sure he would say if he knew how else to solve this.
I think I understand the basics but I never compiled on windows so I can't help much (seems so overly complicated compared to linux, specially when using something scripted as the AUR).
Actually, compiling on Windows is quite straightforward if the instructions are followed exactly without skipping steps or making unauthorized alterations. I can do the complete setup in a couple of minutes. Cmake takes a few minutes and then Visual Studio takes enough time to provide a nice lunch break.

It is the debug process in Visual Studio that is causing the issue here. I don't use debug builds, so I have no idea what might work to resolve the issue.

Gene
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Failed to get the Python codec of the filesystem encoding

Post by adrianinsaval »

GeneFC wrote: Mon Feb 28, 2022 5:09 pm Actually, compiling on Windows is quite straightforward if the instructions are followed exactly without skipping steps or making unauthorized alterations. I can do the complete setup in a couple of minutes. Cmake takes a few minutes and then Visual Studio takes enough time to provide a nice lunch break.
I don't doubt this, but nothing so far has motivated me to try it as I'm quite comfortable with my build environment on linux and I'm not very interested in dealing with window's BS for no benefit
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Failed to get the Python codec of the filesystem encoding

Post by GeneFC »

OK, I decided to try to make a debug build and test for the problems noted above.

The result was no errors. Freecad_d.exe attached just fine, and there were no messages about Python in any way, shape, or form. I was using the same version of VS noted above.

I did notice a couple of goofs in FreeCAD. I got a notice "Wizard shaft module cannot be loaded". I have never used or tried to use wizard shaft module.

I also got a message about a problem with importing numpy C-extensions.

I have never seen these message in release builds, so I suspect the Cmake files for debug are a bit borked.

As a final test I cleanly recompiled the same master as a release version. Neither of the strange error messages came up.

In both cases FreeCAD worked just fine when I tested on some of my files.

I still suspect there is some incorrect dependency that is getting called for those seeing Python version issues.

Gene
thegoodtgg
Posts: 1
Joined: Thu Aug 18, 2022 10:26 am

Re: Failed to get the Python codec of the filesystem encoding

Post by thegoodtgg »

I ran into the problem just now. I use main branch, on visual studio 2019, windows 10.
It seems to failed to initialize the python environment. You can fix the problem add the environment variable "FC_PYTHONHOME=your python debug library location".
Post Reply