Open varenius opened 2 years ago
I am not sure I can anticipate the names of the package that various systems might need. I think python3 actually gave a pretty clear error message in your case.
My first suggestion would be to insert set -e
as the second line in the script, then it would stop after the first error. I am not sure python3 returned an error in your case. Can you tell? If not, the . venv/bin/activiate
line did and that would have stopped the script. Other suggestions are welcome.
BTW, my (newer? older?) Debian system (stretch) didn't seem to need python3-venv, but the script still failed without or without it installed. It can't find some of the requirements. I am somewhat surprised by that as I though that was one of the benefits of the virtual environment. I should probably being something more sophisticated with requirements.txt, but I don't know what.
I am sorry I was unclear about the problem. The problem, as I see it, is not that venv is needed. The problem is that the install script will do stuff, even if its requirements are not satisfied. I was just surprised by this. Because venv was not installed, this tool went ahead and installed python things in a different location than expected. I would normally assume a program to either prompt " are you sure you want to do X" or say "This program cannot run since it requires Y".
If it's up to the user to manually check that various python modules are installed before running this script, one could argue that using venv and requirements is somewhat not useful. It could be simpler, and perhaps more straightforward, to just have an install script that says "make sure you have the following python module versions installed in your python path" and then leave it to the user to install modules and any venvs, if desired. That would avoid the behaviour of the install script doing things outside the git directory without warning ;).
I also am sorry I was not clearer. Using set -e
will prevent it careening out of control like that if it can't install venv
, or any other error happens. I could in addition add a more explanatory error message if setting up venv
fails. It would have to be a generic message because I have no idea what any particular system would need to have installed. I could also add a warning about this in the README file. I am sure all that would be beneficial.
Can you let me know what version of Debian/Ubuntu you are using? It would also be helpful to know your version of python3. I thought you get a very helpful message for the failure of the venv
to install.
My understanding is that the pip/venv
approach is suppose to make you independent of what modues/versions are installed on your system. I am not an expert at this, but what I have works for my OSX computers and I had a user on a different system that was able to install fmout with the same approach.
I am somewhat disappointed to find that the pip/venv
approach does work on stock Debian stretch (with or without the python3-venv package installed) because it can't find the right versions of some modules. I was hoping that pip/venv
would provide a turn-key approach for getting the right modules/versions, but apparently I don't understand how this is suppose to work. Do you have any pip/venv
experts in your shop who could advise?
We could include instructions for how to install whatever modules versions pip can find, but that might leave the user with versions that aren't compatible. (Gee, wouldn't something like pip/venv
be a good solution for that?) It kind of belies the idea of verifying that the code works for a particular set of module/versions and then users can expect it to work on their systems.
I think I tested this on Linux Mint 20, Python 3.8.10. Indeed the failure message was very helpful.
Maybe all of this could be simply circumvented by adding some sort of "Check above for any error messages, then continue yes/no?" question to the install script? Just to give the option of not proceeding in case some errors are found.
As I'm now going on parental leave I cannot dig more into pip/venv expertise. But in general I think it's the right thing to do.
Following the instructions, but on a machine without python3-venv installed, I get this output:
It seems that the script should check if python3-venv (or virtualenv) is installed or not. Maybe worth checking?