[Issue report] Problem with starting up from command line (Linux)

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
mcgiwer
Posts: 20
Joined: Sat Jul 03, 2021 11:51 am

[Issue report] Problem with starting up from command line (Linux)

Post by mcgiwer »

Enviroment informations:
  • System: Debian 10 (64-bit Linux)
  • FreeCAD version: 0.19
  • Installed Python: 2.7 (to run some extensions), 3.9
Issue description:

While attempting to start FreeCAD, first I was recieving an error in with FreeCAD was complaining of beeing unable to load the XCB, but I had solved it by typing in the console:

Code: Select all

sudo xhost +si:localuser:$USER
export DISPLAY=:0
with has partially solved the problem. However, FreeCAD was still complaining about an old version of some libs in the included into bundle Python 3.8.

After updating my system's Python version to 3.9, FreeCAD (instead of using newer version of Python with is insttalled on system), forces itself to use the included to the bundle version, ignoring the installed one.

Additionally, I had observed that the variables of "PYTHONHOME" and "PYTHONPATH" are not correctly set (with causes the issues).

I would like to propose (as a fix for above), that FreeCAD in the first place check with version of Python is installed on the system and if it's newer then use the system one... else use the included one.

notice: I had created a bug report for it: issue #4696
Last edited by mcgiwer on Tue Jul 20, 2021 5:38 pm, edited 1 time in total.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Issue report] Problem with starting up from command line (Linux)

Post by openBrain »

What you want to do just gonna crash. FreeCAD shall use the Python version that it was compiled with. Nothing else being it former or newer.
mcgiwer
Posts: 20
Joined: Sat Jul 03, 2021 11:51 am

Re: [Issue report] Problem with starting up from command line (Linux)

Post by mcgiwer »

The problem is (as I wrote before) that the included python has old versions of some libs, with prevent FreeCAD to be used with full it's potential and the most of extensions cause that FreeCAD complain about the old libs. Maybe the dev team should think to find a workaround for this problem instead of that it's beeing told that it's a bad idea to implement that new versions of Python won't crash the program ?
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Issue report] Problem with starting up from command line (Linux)

Post by openBrain »

FreeCAD team can maybe do something if you:
* Tell how you installed FreeCAD : AppImage, PPA, distro repo,...
* Give full info as described in the link of the red banner of 'Help on using FC' subforum
* Copy here the exact errors you got

Without this, we are clueless where your problem comes from.
mcgiwer
Posts: 20
Joined: Sat Jul 03, 2021 11:51 am

Re: [Issue report] Problem with starting up from command line (Linux)

Post by mcgiwer »

openBrain wrote: Mon Jul 19, 2021 6:20 am * Tell how you installed FreeCAD : AppImage, PPA, distro repo,..
I was using the downloaded from the official website AppImage

* Give full info as described in the link of the red banner of 'Help on using FC' subforum
I'm not sure what do you mean thru that
* Copy here the exact errors you got
The exact message of the Perl version related error has been placed in the issue #4696
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Issue report] Problem with starting up from command line (Linux)

Post by openBrain »

mcgiwer wrote: Mon Jul 19, 2021 10:58 am I was using the downloaded from the official website AppImage
OK. So this is another good reason to not use system Python (beyond the fact that it will probably crash). Purpose of AppImage is to provide a full packaged application with dependencies.

I'm not sure what do you mean thru that
Simple, will expand a bit :
* Potential bugs shall be posted in 'Help on using FreeCAD' subforum (in your specific case eventually in 'Install/compile' one) but not in 'Developers corner' which as stated on the board index is only for coding (i.e. ones that are actually producing code).
* On top of the 'Help on using FreeCAD' subforum, there is a red banner with a link that explains needed info to declare a potential bug : this link is IMPORTANT: Please click here and read this first, before asking for help
* Another interesting reading is the tracker reporting guidelines, where you (among other) will learn that your issue shall be vetted by the community on the forum before opening a ticket
The exact message of the Perl version related error has been placed in the issue #4696
FreeCAD doesn't use Perl. :D Anyway, provide more information (is the AppImage running well when launched from the DE ?) and especially tell us how is your FS encoded (as this is actually what Python is complaining about).
mcgiwer
Posts: 20
Joined: Sat Jul 03, 2021 11:51 am

Re: [Issue report] Problem with starting up from command line (Linux)

Post by mcgiwer »

Enviroment informations (copied from the issue #4696):

* FreeCAD version: 0.19.2
* System: Debian 10 (64-bit Linux)
* Installed Python: 2.7 (to run some extensions with work only with Python2), 3.9

Post reply:
* On top of the 'Help on using FreeCAD' subforum, there is a red banner with a link that explains needed info to declare a potential bug : this link is IMPORTANT: Please click here and read this first, before asking for help
I had fulfilled the all 5 points of it, Instead of the 6th I had copied and pasted the message because doing a screenshoot of it would show the same thing (plus the full path, with I needed to truncate for the security reasons)
* Another interesting reading is the tracker reporting guidelines, where you (among other) will learn that your issue shall be vetted by the community on the forum before opening a ticket
I had fulfilled it too. The reported bug is easy to reproduce (need only to update Python to a new version), all needed informations were given in the linked to bug report (with was created because I predicted that instead of helping to find a workaround, I will get a message in the type "it won't work", or similiar)
thon
FreeCAD doesn't use Perl. :D Anyway, provide more information (is the AppImage running well when launched from the DE ?) and especially tell us how is your FS encoded (as this is actually what Python is complaining about).
Sorry, I meant Python. I don't know why I did wrote Perl. Additionlly, please don't use shortcuts (like DE, FS, etc. because not every one may understand them.

Answering on your question, I was attempting to run the AppImage after I had updated my installed Python to the version 3.9 and had set manually the PYTHONHOME path to the one with is installed in the system.

I had posted it in the Developer sub-forum because it's a FreeCAD code related problems of followig types:

* the "PYTHONHOME", "PYTHONPATH" and python "sys." variables are beeing incorrectly set
* all of the FreeCAD related pathes (for example: bin, Ext, lib, etc.) should be dynamic to the FreeCAD root folder (the one from with it's beeing started) instead of using real path (this would solve some eventual issues)

* the python related pathes (PYTHONHOME, etc.) should be set afer discovery if the avaliable python versions
* the "sys.path" vatiable forces to search for the python3.8 only, with prevent any eventual upgrade and some extensions from working
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Issue report] Problem with starting up from command line (Linux)

Post by adrianinsaval »

The appimage is not meant to be run with the system python, you're asking for trouble (and I don't think it's a bug if it doesn't work out of the box). If you really want to use the system version of python reliably (it's not clear to me why) then compile freecad from source or use the version from your distro.
mcgiwer wrote: Mon Jul 19, 2021 12:37 pm I had fulfilled the all 5 points of it, Instead of the 6th I had copied and pasted the message because doing a screenshoot of it would show the same thing (plus the full path, with I needed to truncate for the security reasons)
Except you haven't:
4. Please provide your FreeCAD version info - (scroll further down this page if you wish to see a video on how to do this created by Mario52)
Open the Help --> About FreeCAD menu then click on the "Copy to clipboard" button, and paste its content in the text input area. This will provide us valuable information on your exact version and revision number, your operating system as well as FreeCAD's internal libraries. (Mac users: the About FreeCAD menu is under the FreeCAD menu.)
Please do not attach a screen capture instead of posting the Help > About FreeCAD information from the clipboard.
In this case it might not be meaningful but more often than not the rest of the information that this process gives is very important (OCC version, Qt version, etc). That's why there's a big red banner asking you to do it this way.
I had fulfilled it too. The reported bug is easy to reproduce (need only to update Python to a new version), all needed informations were given in the linked to bug report (with was created because I predicted that instead of helping to find a workaround, I will get a message in the type "it won't work", or similiar)
If you know people would tell you "it won't work" then you are aware it's not a bug, and once again:
3. Discuss the problem on the Help forum first! This should be done before creating a ticket in the bugtracker, for several reasons: It may not be a bug after all and you will get advice how to proceed; developer time is precious and a discussion here in the forum will produce far better tickets; the helpers in the forum become aware of the bug; you may be offered a workaround until the bug is fixed.
5. Always include your FreeCAD version information. You can easily copy/paste all the needed information by using the "Copy to clipboard" button in FreeCAD, in menu Help -> About FreeCAD. You can then paste that information in your bug report.
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Issue report] Problem with starting up from command line (Linux)

Post by adrianinsaval »

If you really want to use the appimage with your system's python I don't think setting PYTHONHOME=/usr/lib/python3.9 is the way to go, I think with that python won't be able to see the other binaries that are needed by freecad, the appimage sets PYTHONHOME=${HERE}/usr
Also notice that you still have:

Code: Select all

 sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/python3.8/lib-dynload',
  ]
mcgiwer
Posts: 20
Joined: Sat Jul 03, 2021 11:51 am

Re: [Issue report] Problem with starting up from command line (Linux)

Post by mcgiwer »

adrianinsaval wrote: Mon Jul 19, 2021 2:42 pm The appimage is not meant to be run with the system python, you're asking for trouble (and I don't think it's a bug if it doesn't work out of the box). If you really want to use the system version of python reliably (it's not clear to me why) then compile freecad from source or use the version from your distro.
Let me remind you what I had wroten before:

When I was attempting to run some extensions when FreeCAD was using the included version of Python then FreeCAD was complained that in the included Python some libraries have older versions then the ones with are required. This was the reason of updating by me Python and attempting to link FreeCAD to use it
Except you haven't:
4. Please provide your FreeCAD version info - (scroll further down this page if you wish to see a video on how to do this created by Mario52)

Open the Help --> About FreeCAD menu then click on the "Copy to clipboard" button, and paste its content in the text input area. This will provide us valuable information on your exact version and revision number, your operating system as well as FreeCAD's internal libraries. (Mac users: the About FreeCAD menu is under the FreeCAD menu.)
Please do not attach a screen capture instead of posting the Help > About FreeCAD information from the clipboard.
In this case it might not be meaningful but more often than not the rest of the information that this process gives is very important (OCC version, Qt version, etc). That's why there's a big red banner asking you to do it this way.
It seem you had missed my post in with I have posted my system and FreeCAD version (however I haven't posted the Qt version, with is 5.15.2-dfsg-9)

The "get version" instruction (with the "About FreeCAD" menu) won't work if FreeCAD does not start the GUI
If you know people would tell you "it won't work" then you are aware it's not a bug, and once again:
it was a happy guess with was correct, even if it's look like a bug for me.

I'm not sure if you follow this topic and the bug report, but I had by the way found myself a workaround for the XCB issue (with was also preventing FreeCAD from starting) and had shared it ;-)
Post Reply