wieluk / psychopy_linux_installer

Installing PsychoPy on Linux can be challenging, so I've created an installer to make the process easier and more streamlined.
GNU General Public License v3.0
2 stars 1 forks source link

--runner-only (or --wxpython_version='') mode? #16

Open yarikoptic opened 3 weeks ago

yarikoptic commented 3 weeks ago

Just an idea!

Quite often it is desired to use only the "experiments runner", e.g. have a smaller container just to run specific experiment. No GUIs (thus no wx) etc. For now I just built a full installation container using the script, the neurodocker invocation and produced Dockerfile and Singularity file could be found at https://github.com/ReproNim/reprostim/tree/master/containers/reprostim-timesync . I built "docker" (OCI) container using podman and it is mighty almost 4GB:

❯ podman images | head
REPOSITORY                                         TAG                 IMAGE ID      CREATED        SIZE
localhost/repronim/reprostim-timesync-test         20240823-3          55e4b5bcd40c  2 days ago     3.74 GB

where inside using ncdu I see

--- / -----------
    1.7 GiB [###############] /usr
    1.5 GiB [#############  ] /opt

--- /opt/psychopy/psychopy_2024.1.4_py_3.10.14/lib/python3.10/site-packages ----------------------------------
  361.7 MiB [###############] /wx
  224.8 MiB [#########      ] /PyQt6
  104.1 MiB [####           ] /scipy
   89.4 MiB [###            ] /opencv_python.libs

export of it into singularity (didn't build natively to benefit from caching of layers while trying out etc) is smaller but still large

❯ du -sh repronim_reprostim-timesync-test_20240823-3.sif
1.5G    repronim_reprostim-timesync-test_20240823-3.sif

I guess I could still try to drastically minimize it for my specific usecase using something like reprozip, but I wondered if might be worth an option and somehow installation (didn't check if easy to do at psychopy level) without GUI elements and thus without WX?

wieluk commented 3 weeks ago

I think you have to do pip install psychopy --no-deps to not install wxpython. But this means that you also have to install all other dependencies manually right?

yarikoptic commented 3 weeks ago

yeah, AFAIK unfortunately there is no flexible solution ATM... we might need to look into "modularizing" dependencies in psychopy if that would be deemed feasible, but that might need to come with compromise of the default pip install psychopy to be a "bare minimum" and then smth like psychopy[full] providing a full installation.

wieluk commented 2 weeks ago

I could add a --no-deps flag to psychopy and you can choose packages manually via the implemented --additional-packages=PACKAGES

--psychopy-no-deps flag would skip wxpython install and install psychopy with --no-deps.

yarikoptic commented 2 weeks ago

Nah, that's too fragile since list of dependencies is long there. Overall for this issue to be addressed , I need first to raise discussion with psychopy folks

wieluk commented 2 weeks ago
#!/bin/bash

PACKAGE_NAME="psychopy"
PACKAGE_INFO=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/json")

DEPENDENCIES=$(echo "$PACKAGE_INFO" | jq -r '.info.requires_dist[]?')

if [ -z "$DEPENDENCIES" ]; then
  echo "No dependencies found for package: $PACKAGE_NAME"
else
  echo "Dependencies for package $PACKAGE_NAME:"
  echo "$DEPENDENCIES"
fi

This list all dependencies you can remove wxpython and use them. But it is probably better to ask psychopy folks.