This is a continuation of our discussion at Remove pygame requirement by cbrnr · Pull Request #2296 · psychopy/psychopy · GitHub.
In short, I find it very annoying that pip install psychopy
installs 68(!) dependencies when all I need is the very basic core functionality for a nice little paradigm. Therefore, I suggested to have only the core/hard dependencies in the install_requires
section of setup.py
. Note that this is the recommended practice as per the official Python packaging documentation, which states that this section should be used “to specify what a project minimally needs to run correctly”. The recommended way to install all dependencies is to provide a requirements.txt
.
In my opinion, these are the core dependencies that are absolutely necessary to run a minimal PsychoPy: numpy
, scipy
, matplotlib
, pandas
, pyglet
, and moviepy
. These packages are relatively unproblematic and straightforward to install via pip
on all major platforms.
All other packages should go in requirements.txt
. This makes it pretty easy for people to either install a minimal or fully-featured PsychoPy via pip
.
People who do not have a lot of technical background and just want to use PsychPy should install the stand-alone packages, which include everything (even Python). I think these two options cater to two different groups of people: while pip
is probably better for people familiar with Python and its packaging ecosystem, the stand-alone distribution is suitable for people who just want to use PsychoPy.
Let me address two comments @jon made:
This is a nice example. Pillow is technically a soft dependency. I could write a script that never uses it (although the app certainly does and so does ImageStim). How many seconds does it take to install pillow using pip? Conversely, how many seconds does it take a user to debug the message “ImportError: No module named Image” and work out that this was because they need to back to the terminal and do
pip install pillow
(notpip install Image
norpip install PIL
which are the name used during import).
It’s not about the time it takes to install a package, but with every additional package you require, the chance of something going wrong increases. If I don’t ever need Pillow, why should I have to install it? I’d really prefer an opt-in approach. Regarding your debug message, this is not what is happening. The actual message is ImportError: No module named PIL
, because there is no Image
module anymore (they’ve removed it way back in version 1.0). And it’s pretty easy to find out that PIL
is actually installed with pip install pillow
(but I agree that this is an odd case but we can document this).
I think a lot of these potential issues could be solved by providing accurate install docs (and PsychoPy already has very good docs FWIW).
As another for-instance, PyQt is not a hard dependency. Some people don’t need ever to open a dialog box. Those people are rare and I would not support suggesting that PyQt is soft even though some people might never need it. When they find that a(nother) demo has failed to run, and spent time working out how to install it (
pip install pyqt5
notpip install pyqt
norpip install PyQt5
…) they get annoyed that things don’t “just work”.
I disagree. People who want everything to “just work” should install the stand-alone version. People who use pip
prefer a minimal setup. They will be able to correctly parse the import errors and install any missing packages.
In short, I’m willing to accept dropping something like pygame, but definitely not the more drastic drops that I think you’re asking for. I think most people prefer “batteries included”.
First, pygame
is really something else, because it is a deprecated unmaintained package, which no project should require as a hard dependency. Second, I’m not asking for drops - I’m merely suggesting to provide a minimal install via pip
(which I’ve listed above) and have a requirements.txt
for the full install. Plus, there is always the option to use stand-alone versions.