Could someone ELI7 why python is struggling so hard with dependencies and dependency management when in the Java world this is a solved problem and just works with maven, which is working so damn well it last got updated in November 2019, and the biggest fight going is whether you should use gradle as client instead of maven to access the same dependency ecosystem? I had to set up Python projects for some machine lea…
We should have stuck with Perl. I never came across the same problems with CPAN.
You don't really need a virtualenv
131–140 of 148 posts
Re: You don't really need a virtualenv
#132> things get tricky when it comes to nested venvs Never had such a requirement. Environments, like the interpreter itself, seem a singleton concept. I have used a Makefile that sources different Bash environment variables kept in files in etc/ within the venv to switch between, say, a Flask and a Gunicorn startup.
I honestly can't even come up with a valid reason for something like nested venvs. At that point it seems more like someone's doing something wrong than 'things get tricky'.
Re: You don't really need a virtualenv
#133Could someone ELI7 why python is struggling so hard with dependencies and dependency management when in the Java world this is a solved problem and just works with maven, which is working so damn well it last got updated in November 2019, and the biggest fight going is whether you should use gradle as client instead of maven to access the same dependency ecosystem? I had to set up Python projects for some machine lea…
It's super easy, barely an inconvenience
Gradle is a hot mess and JavaScript is the just a complete shit show
Re: You don't really need a virtualenv
#134Earlier quoted context omitted.
Python should just do what JavaScript does and install all dependencies to a project-local folder.
I'm surprised this is getting downvoted. This is the only sane way to manage dependencies. They must be relative to the thing you care about. There are tradeoffs for sure, like the ridiculous sizes of those directories on development machines. But a giant SSD is cheaper than my time resolving dependency issues on user machines.
No language should replicate anything JavaScript does when it comes to package management
Re: You don't really need a virtualenv
#135Earlier quoted context omitted.
First, so many tutorials give you terrible information. People don't know about "-m", the "py" command, are told to use sudo and not --user. The current situation is actually not that bad. With my students, the topic is quickly explained and mastered. But it's not a common occurrence. However, it is true that it's still not as easy as it could be. Some reasons. - Python is older than java. - Python is shipped as part…
The “py” command?
Re: You don't really need a virtualenv
#136Re: You don't really need a virtualenv
#137Earlier quoted context omitted.
Last time I used python I just did pip install -r requirements.txt -t libs and added the folder to PYTHONPATH. I never bothered with virtualenv.
PYTHONPATH is also global! so all projects will still be referring to the same set of libs. how does that change anything at all?
Re: You don't really need a virtualenv
#138Could someone ELI7 why python is struggling so hard with dependencies and dependency management when in the Java world this is a solved problem and just works with maven, which is working so damn well it last got updated in November 2019, and the biggest fight going is whether you should use gradle as client instead of maven to access the same dependency ecosystem? I had to set up Python projects for some machine lea…
I ultimately fixed this with going to the conda files list, and choosing exactly what I needed. Not straightforward at all.
Re: You don't really need a virtualenv
#139I struggled with Python dependency hell often until I started using Conda. I wish it were faster, but it rarely surprises me.
Re: You don't really need a virtualenv
#140Earlier quoted context omitted.
It's not optional. It's required for things to work properly. A basic example of something that would break if the environment is not activated is binaries, like mypy. You have a script that calls "mypy"? Gotta be in the virtual environment to invoke it, otherwise the executable might not be found, or worse, it might run another executable.
It's absolutely not required, I assure you. If you run the Python binary inside the venv you have the same environment as if you'd activated the venv, but only for that execution and not affecting your shell. Try making a venv, running python, and looking at sys.path.
One of the thing that the virtual environment does is modify the PATH to lookup executables from the virtual environment first.
This is to ensure that when a script calls binaries like mypy/python, it's going to find the same binary from the environment it's currently running in.
Typically if the environment is not activated, python is going to lookup to /usr/bin/python and might be something else.
This is most noticeable when there are different versions of python on the systems and when having scripts that invoke themselves.