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] /lsiopy folder & 'VIRTUAL_ENV': '/lsiopy': Why included in image? #189

Closed
1 task done
ManiMatter opened this issue Jan 4, 2025 · 7 comments
Closed
1 task done

Comments

@ManiMatter
Copy link

ManiMatter commented Jan 4, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The vscode image comes with a folder called "/lsiopy" and a enviornment variable 'VIRTUAL_ENV': '/lsiopy'..

My take is that these are two remnants of the Jenkins file. Since the vscode image does not actually have a python binary installed, I am not sure these two serve any purpose and I wonder why they are included in the image.

python3 -m venv /lsiopy && \

The reason I am bringing this up is because the VIRTUAL_ENV variable has caused an issue for me, since the application "poetry" is also using the same variable, and I hadn't been aware that codeserver already had set a value for it.

Expected Behavior

If there is no use of the /lsiopy folder and the associated environment variable post jenkins installation they should not be included in the image.

Steps To Reproduce

  1. Spin up a fresh codeserver container
  2. Check the presence of folder "/lsiopy"
    test -d /lsiopy && echo "Directory exists" || echo "Directory does not exist"
  • Will say "Directory exists" and expected would be "Directory does not exist"
  1. Check the presence of env variable
    echo $VIRTUAL_ENV
  • Will return "/lsiopy" and expected would be nothing

CPU architecture

x86-64

Docker creation

vscode:
    <<: *common-keys-core
    image: lscr.io/linuxserver/code-server:latest
    container_name: vscode
    ports:
      - 8443:8443
    environment:
      <<: *default-tz-puid-pgid
      SUDO_PASSWORD: $VSCODE_SUDO_PW
    volumes:
      - $DOCKERDIR/own_coding/vscode/:/vscode
      - $DOCKERDIR:/docker
      - /var/run/docker.sock:/var/run/docker.sock
      - /:/host:ro # for cloudbackup development
    security_opt:
      - no-new-privileges:false
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vscode-rtr.entrypoints=https"
      - "traefik.http.routers.vscode-rtr.rule=Host(`vscode.$DOMAINNAME_CLOUD_SERVER`)"
      - "traefik.http.routers.vscode-rtr.tls=true"
      - "traefik.http.routers.vscode-rtr.middlewares=chain-oauth@file"
      - "traefik.http.routers.vscode-rtr.service=vscode-svc"
      - "traefik.http.services.vscode-svc.loadbalancer.server.port=8443"
Copy link

github-actions bot commented Jan 4, 2025

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

@aptalca
Copy link
Member

aptalca commented Jan 4, 2025

Jenkinsfile line is unrelated
We create that venv folder and set the env var in the baseimage because pip no longer uses system folder to install things into.

All of our images that utilize python activate that venv.

You can either override that env var, or choose to use that path for the venv. For the latter, you would have to activate the venv at that path (the mod may have to do that as well).

@ManiMatter
Copy link
Author

ManiMatter commented Jan 4, 2025

Thank you for the follow up.

Just so that I get it right: when I run codeserver, python is not installed (and therefore python virtual env cant be active) but the VIRTUAL_ENV-variable is set.

If my understanding is correct, my next question: does that make sense? Isn‘t the VIRTUAL_ENV there to flag that the venv is active (and at what path)?

Of course, I can unset the variable myself, but (and I‘m not an expert here) if VIRTUAL_ENV should indicate whether the venv is active (ENV set = venv active) but in the image it‘s set and the venv is not active, should this ENV not be removed from the image (since suggesting a misleading status)?

@aptalca
Copy link
Member

aptalca commented Jan 4, 2025

Any container that installs/uses python has the venv activated. On other containers it doesn't matter if that env var is set or not because there is no python to begin with.

Even our package install mod is set to activate the venv if python and/or pip packages are installed.

The issue you're having is that the poetry mod does not activate the venv. It's a third party submitted mod. You can open an issue or a PR in its repo.

@ManiMatter
Copy link
Author

ManiMatter commented Jan 4, 2025

I am not taking about a mod. I run the codeserver image and on the terminal install python as well as poetry.

I did raise it with them; their response, however, is that the env VIRTUAL_ENV is the signal to tell that the venv is active.

the only thing that activating a virtual environment does is to set that variable and tweak the path. A virtual environment is active exactly when VIRTUAL_ENV says so: the meaning of that variable is "this is the active virtual environment".

My take from your response is that your usage is different. You use VIRTUAL_ENV to say „here is where the virtual env ought to go“ but the presence of VIRTUAL_ENV says nothing about whether said venv is active or not.

I am not an expert but I‘d say we have here two different notions what VIRTUAL_ENV represents (codeserver: just a dir, poetry: dir and active status). Is there an agreed definition what that ENV expresses?

If with status, then I think codeserver should not include the VIRTUAL_ENV if venv not active.
If without status, then poetry should try activating the venv
If no agreed notion exists, I‘ll unset the ENV myself (or activate the venv it)

@aptalca
Copy link
Member

aptalca commented Jan 4, 2025

We have mods for that reason. They install the necessary packages and prepare the environment as necessary.

We don't recommend or support manually installing packages inside the container as they also get wiped during container recreation.

@ManiMatter
Copy link
Author

Thank you for clarifying

@LinuxServer-CI LinuxServer-CI moved this from Issues to Done in Issue & PR Tracker Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants