It happens to me that 90% of the python scripts that I download have outdated libraries and they don't work for me, and I have to search for the new version of the library and install it with.
pip install modulo
And yet version incompatibility bugs often pop up and I'm forced to edit the code (sometimes lucky and sometimes not).
I wonder if there is any program that resolves dependencies in python. That is, read the script, resolve the dependencies by calling 'pip' and also modify the code so that, for example, it updates the differences between python 2 and python 3.
To say that I have tried to use a program called Py2to3 but this is also outdated and does not work (and although it will work, it would not do everything I say either).
What a mess of language, on the one hand it's great because with 3 lines you do what you would do with three pages with C++, and it also has a lot of very useful libraries that you hardly find for C++. But on the other hand they make so many changes to the language and to the libraries that you don't know if a program you write today will work for you in a month.
Well, if such a tool existed, it would be a point in favor for this language. Does anyone know if it exists?
pip
it resolves dependencies to some extent. When you install a package withpip
it, it will also install those on which it depends, except if they were already installed, which is when incompatibility problems can arise if the version you already had installed does not match the one needed by the package you are installing now.To avoid this type of problem (or minimize its impact), it is typical to use virtual environments, which are folders in which all the necessary packages for a certain application are installed, so that they do not interfere with others installed globally or with other virtual environments. from other applications.
virtualenv
is a utility to create these virtual environments, which had to be installed separately. Since Python 3, it comes bundled with Python itself so that insteadvirtualenv
you can usepython -m venv
it to achieve the same goal.More recently, the tool
pipenv
that combines dependency controlpip
with virtual environments is gaining popularity and promises to solve all dependency problems. They say that in the near future it could become part of Python and be the recommended package installation mechanism.Meanwhile you can read a good explanation here