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
In certain cases when installing packages using pip_install with a PYTHONPATH environment variable set it can fail to install the package. An example of that is when using a charm with the operator framework, which already has a venv. If that venv already has a library installed in it (e.g pyyaml), invoking pip_install using a virtual environment will fail to install it. Pip will consider the library to be installed already since it can find it in the PYTHONPATH (even though it's actually not installed in the venv provided). An example of this situation with all the details can be found in [0]
In this case it would probably be best to ignore any PYTHONPATH so pip will install the requested libraries in the target virtual environment if they are not installed there already. Another option would be to accept an env parameter and pass it to the subprocess call.
It would also help to use check_output instead of check_call, at least at debug level so the logs can show what is actually happening in unexpected situations like this.
In certain cases when installing packages using
pip_install
with aPYTHONPATH
environment variable set it can fail to install the package. An example of that is when using a charm with the operator framework, which already has avenv
. If that venv already has a library installed in it (e.g pyyaml), invokingpip_install
using a virtual environment will fail to install it. Pip will consider the library to be installed already since it can find it in thePYTHONPATH
(even though it's actually not installed in the venv provided). An example of this situation with all the details can be found in [0]In this case it would probably be best to ignore any
PYTHONPATH
so pip will install the requested libraries in the target virtual environment if they are not installed there already. Another option would be to accept anenv
parameter and pass it to the subprocess call.It would also help to use
check_output
instead ofcheck_call
, at least at debug level so the logs can show what is actually happening in unexpected situations like this.[0] https://bugs.launchpad.net/charm-juju-lint/+bug/1928337
[1] https://github.com/juju/charm-helpers/blob/master/charmhelpers/fetch/python/packages.py#L112
The text was updated successfully, but these errors were encountered: