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

Issue to install locust-plugins inside locust container when using the locust docker image version 2.8.6 #2069

Closed
teixeira-fernando opened this issue Apr 8, 2022 · 8 comments

Comments

@teixeira-fernando
Copy link

Describe the bug

When I started to use the latest 2.8.6 locust docker image, I had some issues when trying to install locust-plugins library inside the container, with my own Dockerfile. When I used the version 2.8.5, everything worked fine.

The error that is returned says that there is a permission issue in the installation process:

[2022-04-08T09:26:11.225Z] ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/opt/venv/lib/python3.9/site-packages/locust/__init__.py'

Expected behavior

We should be able to install other python libraries, including locust-plugins, inside the locust container using the pip command.

Actual behavior

[2022-04-08T09:25:36.237Z] + docker-compose up --scale worker=4 --force-recreate --exit-code-from=master
[2022-04-08T09:25:36.237Z] /usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.3) or chardet (2.2.1) doesn't match a supported version!
[2022-04-08T09:25:36.237Z]   RequestsDependencyWarning)
[2022-04-08T09:25:36.496Z] using --exit-code-from implies --abort-on-container-exit
[2022-04-08T09:25:36.496Z] Building worker
[2022-04-08T09:25:36.496Z] Step 1/4 : FROM locustio/locust
[2022-04-08T09:25:36.496Z]  ---> 532edcc29d52
[2022-04-08T09:25:36.496Z] Step 2/4 : RUN pip3 install python-dotenv
[2022-04-08T09:25:36.496Z]  ---> Using cache
[2022-04-08T09:25:36.496Z]  ---> a97320f218ff
[2022-04-08T09:25:36.496Z] Step 3/4 : RUN pip3 install locust-plugins
[2022-04-08T09:25:36.496Z]  ---> Running in 62882230dddc
[2022-04-08T09:25:39.056Z] Collecting locust-plugins
[2022-04-08T09:25:39.056Z]   Downloading locust_plugins-2.6.4-py3-none-any.whl (1.4 MB)
[2022-04-08T09:25:39.056Z]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 20.8 MB/s eta 0:00:00
....
[2022-04-08T09:26:03.903Z]   Running setup.py install for python-autoviv: started
[2022-04-08T09:26:04.965Z]   Running setup.py install for python-autoviv: finished with status 'done'
[2022-04-08T09:26:04.965Z]   Running setup.py install for paho-mqtt: started
[2022-04-08T09:26:05.905Z]   Running setup.py install for paho-mqtt: finished with status 'done'
[2022-04-08T09:26:11.225Z]   Attempting uninstall: locust
[2022-04-08T09:26:11.225Z]     Found existing installation: locust 2.8.5
[2022-04-08T09:26:11.225Z]     Uninstalling locust-2.8.5:
[2022-04-08T09:26:11.225Z]       Successfully uninstalled locust-2.8.5
[2022-04-08T09:26:11.225Z]   WARNING: No metadata found in /opt/venv/lib/python3.9/site-packages
[2022-04-08T09:26:11.225Z]   Rolling back uninstall of locust
[2022-04-08T09:26:11.225Z]   Moving to /opt/venv/bin/locust
[2022-04-08T09:26:11.225Z]    from /tmp/pip-uninstall-28kaiecd/locust
[2022-04-08T09:26:11.225Z]   Moving to /opt/venv/lib/python3.9/site-packages/locust-2.8.5.dist-info/
[2022-04-08T09:26:11.225Z]    from /opt/venv/lib/python3.9/site-packages/~ocust-2.8.5.dist-info
[2022-04-08T09:26:11.225Z]   Moving to /opt/venv/lib/python3.9/site-packages/locust/
[2022-04-08T09:26:11.225Z]    from /opt/venv/lib/python3.9/site-packages/~ocust
[2022-04-08T09:26:11.225Z] ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/opt/venv/lib/python3.9/site-packages/locust/__init__.py'
[2022-04-08T09:26:11.225Z] Check the permissions.
[2022-04-08T09:26:11.225Z] 
[2022-04-08T09:26:11.225Z] Service 'worker' failed to build: The command '/bin/sh -c pip3 install locust-plugins' returned a non-zero code: 1

Steps to reproduce

This is my Docker file that I used to reproduce the error:

FROM locustio/locust
RUN pip3 install python-dotenv
RUN pip3 install locust-plugins

If you try to build it, it will take the latest version 2.8.6, and the error described above will happen.

Environment

  • OS: Windows 10 Enterprise (OS build 19042.1466)
  • Python version: Not applicable
  • Locust version: 2.8.6
@teixeira-fernando
Copy link
Author

Hi @cyberw. Looks like it is similar issue to what I reported in this another bug some time ago: #2015

@heyman
Copy link
Member

heyman commented Apr 8, 2022

Hi @teixeira-fernando! I'm not able to reproduce the error with the exact same Dockerfile that you posted above. I made sure to pull the latest locustio/locust image, and I also tried pinning the version to 2.8.6 using FROM locustio/locust:2.8.6.

@heyman
Copy link
Member

heyman commented Apr 8, 2022

Could you try running the docker build command with the --no-cache flag?

@teixeira-fernando
Copy link
Author

Hi @heyman. Thanks for the quick reply. I did a few other experiments, and it seems that the issue only happens in a Jenkins agent that I use to build this image. When I built the image locally, it worked fine with version 2.8.6 or any other older version (I used the docker build command that you suggested).

It is just really strange because the issue happens inside the docker container, so environment differences should not be a factor.

Anyway, I think we can close this issue. I will continue my investigations and see what is happening with this Jenkins agent.

@heyman
Copy link
Member

heyman commented Apr 8, 2022

The log output seems to indicate that the Docker cache was used at some point, which is the only reason I can think of from the top of my head, that might cause this. Maybe you can configure Jenkins to use --no-cache when it builds, or maybe you can log in to the machine and force a rebuild of the image manually?

Anyway, I think we can close this issue. I will continue my investigations and see what is happening with this Jenkins agent.

Ok!

@heyman heyman closed this as completed Apr 8, 2022
@teixeira-fernando
Copy link
Author

Maybe you can configure Jenkins to use --no-cache when it builds, or maybe you can log in to the machine and force a rebuild of the image manually?

I tried to build with --no-cache option, but I got the same output. I will see if forcing a rebuild, as you mentioned, could solve it.

@cyberw cyberw added the invalid label Apr 8, 2022
@minkj1992
Copy link

minkj1992 commented Sep 13, 2023

FROM locustio/locust:latest

RUN pip3 install 'locust-plugins[mqtt]' websocket

@iteratelance
Copy link

iteratelance commented Feb 8, 2024

While running locust inside of docker I had to install websocket-client instead of websocket

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

No branches or pull requests

5 participants