OpenAgents icon indicating copy to clipboard operation
OpenAgents copied to clipboard

Installing custom Python libraries into xlang-code-interpreter

Open RaoulDrake opened this issue 9 months ago • 2 comments

Hi there, I would love to use the xlang-code-interpreter but need to install additional non-public custom Python libraries into it, so that my custom agent can use them. I have tried to achieve this by myself, but have not succeeded so far (and with my rather limited knowledge of Docker, I am not sure if it is possible at all with just the image).

I know you have mentioned in previous issues that it wasn't your plan to release it back then. Any chance this has changed and you could release or share the repo? Or do you have any suggestions on how I could achieve my goal of installing additional non-public custom Python libraries into it? Any help would be much appreciated. Many thanks in advance, and kind regards.

P.S.: I have also posted this question in a related issue (https://github.com/xlang-ai/OpenAgents/issues/72#issuecomment-2080924736), but since that one is closed, I am posting it here as a new issue as well. If anyone happens to read it twice, sorry for that.

RaoulDrake avatar Apr 27 '24 16:04 RaoulDrake

Hi, it is valid to pull the image first, and build a new image wrapper with a new DockerFile that installs the Python libs you need, with no need to access the original docker's source code. Actually, our image is built upon the kaggle python docker. Hope it might help!

BlankCheng avatar Apr 30 '24 06:04 BlankCheng

Hi @BlankCheng, thanks for the quick feedback! I had tried this, using (roughly) the following Dockerfile (I had to disable the proxies temporarily because pip was not able to download dependencies otherwise):

FROM xlanglab/xlang-code-interpreter-python
WORKDIR /app
COPY third_party ./third_party
ENV http_proxy_tmp=$http_proxy
ENV https_proxy_tmp=$https_proxy
ENV http_proxy=""
ENV https_proxy=""
RUN set -eux; \
    cd third_party;\
    cd my_custom_lib_1;\
    pip install -e .;\
    cd ..;\
    cd my_custom_lib_2;\
    pip install -e .;\
    cd ..;\
    cd ..;
ENV http_proxy=$http_proxy_tmp
ENV https_proxy=$https_proxy_tmp

When I build this, my libraries show up as installed when I run pip list in the container. However, when the agent tries to use the libraries, I get a module not found error. Any idea why this might happen or what I am doing wrong? Many thanks in advance and kind regards.

RaoulDrake avatar Apr 30 '24 12:04 RaoulDrake