Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] <freecadcmd> CLI Not Working #2

Open
1 task done
ThaL3g3nd27 opened this issue Mar 15, 2024 · 3 comments
Open
1 task done

[BUG] <freecadcmd> CLI Not Working #2

ThaL3g3nd27 opened this issue Mar 15, 2024 · 3 comments
Assignees
Labels
work-in-progress Stale exempt

Comments

@ThaL3g3nd27
Copy link

ThaL3g3nd27 commented Mar 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

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

  1. Add the docker-compose.yaml

image

  1. Build the Docker Image

    docker-compose build

  2. Run the image using docker-compose

    docker-compose up -d

  3. Open Browser to localhost:3000

image

  App works great

  1. Open the boxtest.py within the FreeCad Gui

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

image

  1. Run the Code in the FreeCad Gui

image

  1. 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

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

image

  1. Docker Exec into the running container

docker exec -it freecad bash

image

  1. cd into the py_scripts directory

image

  1. 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.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##
Copy link

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

@thelamer
Copy link
Member

thelamer commented Apr 5, 2024

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work-in-progress Stale exempt
Projects
Status: Issues
Development

No branches or pull requests

3 participants