linuxserver / docker-freecad

Web accessible FreeCAD inside a Debian Container
GNU General Public License v3.0
17 stars 5 forks source link

[BUG] <freecadcmd> CLI Not Working #2

Open ThaL3g3nd27 opened 8 months ago

ThaL3g3nd27 commented 8 months ago

Is there an existing issue for this?

Current Behavior

Python scripts do not work in the docker container cli.

Traceback (most recent call last): File "", line 8, in FileNotFoundError: [Errno 2] No such file or directory: '/lsiopy/bin/activate_this.py'

Expected Behavior

freecadcmd file.py

python function should run without the gui.

Steps To Reproduce

https://github.com/ThaL3g3nd27/issue-FreeCad-freecadcmd.git

LinuxServer/FreeCad – freecadcmd not working in cli

steps previous debugged ending with issue

All Code is available

1) Add Dockerfile:

image

2) Add the docker-compose.yaml

image

3) Build the Docker Image

`docker-compose build`

4) Run the image using docker-compose

`docker-compose up -d`

5) Open Browser to localhost:3000

image

  App works great

6) Open the boxtest.py within the FreeCad Gui

File>Open>/app/py_scripts>boxtest.py (Defined in docker compose)

image

7) Run the Code in the FreeCad Gui

image

8) Box object is made

image

  And auto exported/downloaded as a box.step file in /py_scripts

image

  Python works Great!

  (If Needed) shutdown container - docker compose down

ISSUE THE CLI doesn't WORK

9) Delete the box.step file so we know if the python script was ran again.

image

10) Docker Exec into the running container

docker exec -it freecad bash

image

11) cd into the py_scripts directory

image

12) Open the freecadcmd cli to make sure it works

image

  This is due to Python environment variables…

Correct Example Usage:

https://youtu.be/RQW723n3DkU?si=dIt7jef6VmLHqkaF&t=596 image

Purpose of the issue:

The Purpose of doing it from the command line is to automate the creation of the object defined by parameters/database so a backend can parametrically make parts. The gui will only be used for testing.

Link to linuxServer/FreeCad:

https://github.com/linuxserver/docker-freecad.git image

Environment

- OS: Ubuntu on WSL
- How docker service was installed: docker compose build

# Use the LinuxServer.io FreeCAD Docker image
FROM lscr.io/linuxserver/freecad:latest

# Set the working directory
WORKDIR /app/

CPU architecture

x86-64

Docker creation

version: '3'

services:
  freecad:
    build:
      context: .
    container_name: freecad
    security_opt:
      - seccomp:unconfined #optional
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - ./config:/app/config
      - ./py_scripts:/app/py_scripts
    ports:
      - "3000:3000"
      - "3001:3001"
    restart: unless-stopped

Container logs

root@a5613fcfb2a4:/app/py_scripts# freecadcmd boxtest.py
Traceback (most recent call last):
  File "<string>", line 8, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/lsiopy/bin/activate_this.py'
FreeCAD 0.20.2, Libs: 0.20.2R
(c) Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2022
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##
github-actions[bot] commented 8 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thelamer commented 7 months ago

So this got run through on Discord and is a disconnect with our internal wheel logic at LSIO for python the solution was to:

sudo apt-get update && sudo apt-get install -y python3-virtualenv
unset VIRTUAL_ENV

https://discord.com/channels/354974912613449730/1217968478393470986

I am split on the issue because this is supposed to be a GUI container where you use the GUI, and scripts work in the GUI.

LinuxServer-CI commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.