You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My recipe (package_type = "python-require") requires specific python package to be installed. Usually we do pip install ... to install it in our CI but I'd like to make it a dependency of the recipe. Note that python package is not available as conan package.
I looked at conan.tools.system but it doesn't contain pip tool. On another side, there is a way to call pip from python code like in example here:
Thanks for your question.
The main problem with python packages (pip) is that there is no guarantee that they can be installed, or that they won't destroy or conflict the current Python environment:
Conan can be running with the Conan self-contained executable. That means there is not even a Python environment neither pip exists to install things
If conan is running in a Python environment, installing pip dependencies can conflict with Conan own dependencies. colorama, for example is already a Conan dependency, trying or forcing to install a different version than the Conan one can break Conan
Even if the pip packages do not conflict with the Conan dependencies, they can still very easily conflict with other Conan packages, or previous versions from the same package requiring other potentially different versions of that package, then breaking each other
So in general, the recommendation is not to use pip install to install Python dependencies. The alternative would be to install them together with Conan when Conan is installed, using a single requirements.txt.
There is some related work in #11601 to create virtualenvs on the fly, but that only applies for executable tools, not for Python libraries that you aim to use from the recipes (or python-requires recipes), because they cannot be imported from a different context than the current one. So still using a single requirements.txt to install all your python pip packages into the same env is the recommended approach.
What is your question?
My recipe (
package_type = "python-require"
) requires specific python package to be installed. Usually we dopip install ...
to install it in our CI but I'd like to make it a dependency of the recipe. Note that python package is not available as conan package.I looked at conan.tools.system but it doesn't contain
pip
tool. On another side, there is a way to callpip
from python code like in example here:What is recommended way to ensure that a python package required by conan recipe is installed?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: