Open agustavo87 opened 2 years ago
Tried to run directly some parts of FreeCAD with launching options from AppImage as sugested in the GH issue :
./FreeCAD.AppImage
./FreeCAD.AppImage freecadcmd
./FreeCAD.AppImage python --version
./FreeCAD.AppImage python
The results where the next
freecad.AppImage freecadcmd "print(2+2)”
:
4
returned)Initialization of FreeCAD failed: While initializing FreeCAD the following exception occurred: 'Could not create directories. Failed with: Permission denied' Python is searching for its runtime files in the following directories: /tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python39.zip:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9/lib-dynload Python version information: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:07:55) [GCC 10.3.0] The environment variable PYTHONHOME is set to '/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr'. Setting this environment variable might cause Python to fail. Please contact your administrator to unset it on your system
freecad.AppImage python -c "print(2+2)"
:
4
4
freecad.AppImage freecadcmd -c "print(2+2)"
:
4
Initialization of FreeCAD failed: While initializing FreeCAD the following exception occurred: 'Could not create directories. Failed with: Permission denied' Python is searching for its runtime files in the following directories: /tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python39.zip:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9/lib-dynload Python version information: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:07:55) [GCC 10.3.0] The environment variable PYTHONHOME is set to '/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr'. Setting this environment variable might cause Python to fail. Please contact your administrator to unset it on your system.
Apparently, when launching python
, even inside the AppImage
and above the docker
> php
> php built-in server
> laravel artisan serve
stack everything seems to be working as expected, but when calling freecadcmd
something happens. But this is an interaction with the described stack, becouse from docker
> shell
seems to be working as expected.
this is expected behavior IMO since the GUI is not available there, freecadcmd should be used instead, in the forum discussion another problem arises from this so either this issue should be updated or better closed IMO.
this is expected behavior IMO since the GUI is not available there
So why does this work from shell? Also works when the HTTP is handled by a server (i.e., PHP built-in server) that is run as root.
freecadcmd should be used instead
Also tried with freecadcmd
from inside AppImage (forum discussion)
freecad.AppImage freecadcmd -c "print(2+2)"
4
Initialization of FreeCAD failed: While initializing FreeCAD the following exception occurred:
'Could not create directories. Failed with:
Permission denied' Python is searching for its runtime files in the following directories:
/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python39.zip:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9:/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr/lib/python3.9/lib-dynload
Python version information: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:07:55) [GCC 10.3.0]
The environment variable PYTHONHOME is set to '/tmp/appimage_extracted_8cac30c456e0f6469e8601386557085d/usr'. Setting this environment variable might cause Python to fail. Please contact your administrator to unset it on your system.
Yeah but that looks like a different problem and it should be treated as such.
Does that merit opening a ticket on FreeCAD-bundle? (where appimage related bugs are filed)
Not IMO, the GUI issue seems to be a problem with the environment and same thing with the permission issue above, in the forum thread that was solved too but FreeCAD still fails. It's not clear if this is really related to being appimage, since it only fails on that environment I would think not. OP hasn't replied with a log file yet so not much can be done.
@agustavo87 ping
@amrit3701 is this reproducible with your docker project ?
@agustavo87
If you want to run FreeCAD code on server, then I would suggest to use FreeCAD CLI docker images.
Here is the docs: https://wiki.freecad.org/FreeCAD_Docker_CLI_mode
In FreeCAD docker images, FreeCAD is compiled without GUI element and you will never display error unless that feature require GUI elements.
OP hasn't replied with a log file yet so not much can be done.
have you tried a recent development version? can you still reproduce? https://github.com/FreeCAD/FreeCAD-Bundle/releases/tag/weekly-builds
Can you also reproduce using freecad packaged some other way? (snap, flatpak or system pakcage)
Is this still relevant?
@agustavo87 please respond
Is there an existing issue for this?
Forums discussion
https://forum.freecadweb.org/viewtopic.php?p=620415
Version
0.20 (Release)
Full version info
Subproject(s) affected?
No response
Issue description
Run from Laravel Sail docker container on a Laravel 8.0 Application from Windows Subsystem for Linux (WSL).
Modify
docker/8.1/Dockerfile
at the end to add freecad dependenciesThen stop, rebuild, and restart image
modify
.env
file at the endNow test if the AppImage is working
If is working as expected the web route can be added to check the freecad runned from a HTTP request. On
routes/web.php
add at the end:If at the browser one go to
localhost/freecad
it showAnything else?
I have tried to isolate the issue and have found the next.
Right now, is solved (at least temporarily) running things vía a script with "no-reload" option as sail user, but this need to be run manually, and can't use supervisor. But this don't clarify what could be happening to make freecad run correctly as headless in some situations, and try to run GUI mode in the others
Workaround
To this is necessary to disable supervisor running artisan server. On
docker/8.1/supervisor.conf
Then the image can be rebuild
Now the web app is not automatically seved by supervisor
http://localhost
should give error. So the server can be started manually and some tweaks can be made, for example using the--no-reload
option.Now, for some reason,
http://localhost/freecad
shows as expectedresult:4
. Other tweaks that make things works is running fromsail root-shell
or disabling only# user=sail
onsupervisor.conf
.Code of Conduct