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

Dependencies in requirements.txt have module conflicts. #940

Open
unsatisfying opened this issue Jul 27, 2023 · 0 comments
Open

Dependencies in requirements.txt have module conflicts. #940

unsatisfying opened this issue Jul 27, 2023 · 0 comments

Comments

@unsatisfying
Copy link

Background

Dependencies in requirements.txt have module conflicts.

Description

There are two dependencies mentioned in the requirements.txt file: faiss-cpu and faiss-gpu. Based on my knowledge, these two packages have module conflicts.
This is mainly because when packages are installed using pip, they are by default installed in the site-packages directory without any isolation between different packages. This means that when both faiss-cpu and faiss-gpu are installed, both of them having the same module name ‘faiss’, they would both be installed in the faiss folder. Therefore, modules present in both packages would conflict and get overridden (with the later installed module overriding the earlier one, depending on the installation order and dependency declaration order). This behavior is the default for pip and there are no warnings.

If the contents of the overridden files are the same, there won’t be any problems. But if the contents of these files differ, conflicts may arise. There could potentially be functional errors present. For instance, certain functions require the invocation of the faiss-cpu's module, but faiss-gpu overrides the faiss-cpu's module. As a result, the Python interpreter mistakenly identifies the faiss-gpu's module as the faiss-cpu's module, leading to some functional errors.

Steps to Reproduce

pip install -r requirements.txt

Desired Change

Indeed, it is not an ideal behavior for modules to be overwritten, even if they are not actively used or if the overwritten module is the one being called. It introduces uncertainty and can cause issues in the long run, especially if there are changes or updates to the overwritten modules in future development. It is generally recommended to avoid such conflicts and ensure that only the necessary and compatible dependencies are declared in the requirements to maintain a stable and predictable environment for the project.

We believe that although this project can only modify direct dependencies and indirect dependencies are a black box, it is possible to add additional explanations rather than directly declaring both conflicting packages in the requirements.txt file.

Adding extra explanations or documentation about the potential conflicts and the need to choose only one of the conflicting packages can help developers understand the issue and make informed decisions. Including a clear instruction or warning in the project’s documentation can guide users to choose the appropriate package based on their specific requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant