Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_via_pip.pl might downgrade already installed packages #794

Closed
tkilias opened this issue May 4, 2023 · 4 comments · Fixed by #798
Closed

install_via_pip.pl might downgrade already installed packages #794

tkilias opened this issue May 4, 2023 · 4 comments · Fixed by #798
Assignees
Labels
bug Unwanted / harmful behavior

Comments

@tkilias
Copy link
Collaborator

tkilias commented May 4, 2023

Background

  • if you call pip multiple times with different packages and packages of subsequent calls require a different version of packages of previous calls, they get changed.
  • the following article suggests using constraint files to solve this https://stackoverflow.com/questions/43121005/can-i-prevent-pip-from-downgrading-packages-implicitly
    pip freeze | grep == | sed 's/==/>=/' >constraints.txt
    pip install -c constraints.txt whatever-you-want-to-install
    
  • Downgrading has two issues for us:
    1. We want to pin the exact version we deliver
    2. For some packages, this can render them unusable, e.g. numpy might not work properly afterward
    • we got, for example, the following error message: ImportError: numpy.core.multiarray failed to import
    • the likely reason for this issue, because we link against numpy

Acceptance Criteria

  • Add constraint file mechanism to install_via_pip.pl
  • Find a test case for this and add it
@tkilias
Copy link
Collaborator Author

tkilias commented May 15, 2023

To test the solution for this bug, we need to rework the test framework for the package management scripts #797. To accomplish this, it is probably the best to extract the scripts from this repository. #242

For this reason, this issue is blocked.

@tkilias tkilias added the blocked:yes Currently blocked by another ticket label May 15, 2023
@tkilias tkilias removed their assignment Jun 1, 2023
@redcatbear redcatbear removed the blocked:yes Currently blocked by another ticket label Jun 21, 2023
@tomuben tomuben self-assigned this Jun 5, 2024
@tomuben
Copy link
Collaborator

tomuben commented Jun 6, 2024

The proposed solution (using the constraint files) has two problems:

  1. If using | grep == | sed 's/==/>=/' as suggested, new version of transitive dependencies will be installed, even if it would break compatibility of an already installed package which needs an the old (pinned) version
  2. If we would remove | grep == | sed 's/==/>=/' => we would require always the exact same version of all transitive dependencies to be installed. This could be possibly a problem for customers, for who it would not be obvious why they can't install a specific version

@tomuben
Copy link
Collaborator

tomuben commented Jun 6, 2024

Our new proposal is to pin only the packages which are defined in a previous build step, but ignore all other Python packages.
For that we would parse all pip package files in the image info folder on the docker image, and generate one (huge) requirements file, where all the version are pinned with ==. Transitive dependencies will be ignored.

@tomuben
Copy link
Collaborator

tomuben commented Jun 6, 2024

Here the required scenarios for testing.
Note:
azure-batch==1.0.0 depends on azure-common 1.1.4
azure-batch1.0.0 depends on azure-common1.1.4

Same Package different Version

Step 1: azure-common 1.1.4
Step 2: azure-common 1.1.28

=> Error

Dependency with correct version already installed

Step 1: azure-common 1.1.4
Step 2: azure-batch==1.0.0

Success

Dependency with incorrect version already installed

Step 1: azure-common 1.1.28
Step 2: azure-batch==1.0.0

Error

##Two packages with same dependency but different version and second step needs newer version of dependency
Step 1: azure-batch1.0.0 -> azure-common1.1.4
Step 2: azure-storage-queue==1.1.0 -> azure-common>=1.1.28

Error

Two packages with same dependency but different version and second step needs older version of dependency

Step 1: azure-storage-queue==1.1.0 -> azure-common>=1.1.28
Step 2: azure-batch1.0.0 -> azure-common1.1.4

Error

tomuben added a commit to exasol/script-languages that referenced this issue Jun 11, 2024
tomuben added a commit to exasol/script-languages that referenced this issue Jun 18, 2024
tomuben added a commit that referenced this issue Jun 19, 2024
@tomuben tomuben closed this as completed Jun 19, 2024
tomuben added a commit that referenced this issue Jul 22, 2024
Changelist:
- #794: Fixed install_via_pip.pl might downgrade already installed packages  (#798)
- #930: Updated Packages (#931)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted / harmful behavior
Projects
None yet
3 participants