locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.06k stars 3k forks source link

Cannot install locust into conda env with python 3.8.0 #1131

Closed ecc256 closed 5 years ago

ecc256 commented 5 years ago

Describe the bug

Cannot install locust into conda env with python 3.8.0

Steps to reproduce

conda create --name locust8 -y
conda activate locust8
conda install pip
pip install locust

Error log:

(locust8) C:\>conda list
# packages in environment at C:\Users\user\.conda\envs\locust8:
#
# Name                    Version                   Build  Channel
ca-certificates           2019.10.16                    0
certifi                   2019.9.11                py38_0
openssl                   1.1.1d               he774522_3
pip                       19.3.1                   py38_0
python                    3.8.0                hff0d562_1
setuptools                41.6.0                   py38_0
sqlite                    3.30.1               he774522_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_0
wheel                     0.33.6                   py38_0
wincertstore              0.2                      py38_0

(locust8) C:\>pip install locust
Collecting locust
  Using cached https://files.pythonhosted.org/packages/46/2e/18d4e363e76ec8f407ed018594f474d5669b3bca3977c4c664940fff95d5/locust-0.0.tar.gz
Collecting locustio
  Using cached https://files.pythonhosted.org/packages/56/a6/b63507b1366b2adcad807e154df3d18a4fb00eb0670c5cbcc086f8f235c9/locustio-0.12.2-py2.py3-none-any.whl
Collecting geventhttpclient-wheels==1.3.1.dev2
  Downloading https://files.pythonhosted.org/packages/bc/7f/42f8b4ac6c7ddf606fa69769cef2229a159d4af45a294053198f52586095/geventhttpclient-wheels-1.3.1.dev2.tar.gz (54kB)
     |████████████████████████████████| 61kB ...
Collecting gevent>=1.2.2
  Using cached https://files.pythonhosted.org/packages/ed/27/6c49b70808f569b66ec7fac2e78f076e9b204db9cf5768740cff3d5a07ae/gevent-1.4.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\user\.conda\envs\locust8\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\2\\pip-install-1y2lm8yx\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\2\\pip-install-1y2lm8yx\\gevent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\2\pip-install-1y2lm8yx\gevent\pip-egg-info'
         cwd: C:\Users\user\AppData\Local\Temp\2\pip-install-1y2lm8yx\gevent\
    Complete output (112 lines):
    Traceback (most recent call last):
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
        yield saved
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "C:\Users\user\AppData\Local\Temp\2\easy_install-cnm3v8gt\cffi-1.13.2\setup.py", line 127, in <module>
        HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
      File "C:\Users\user\AppData\Local\Temp\2\easy_install-cnm3v8gt\cffi-1.13.2\setup.py", line 105, in uses_msvc
        include_dirs=include_dirs)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 127, in _compile
        src = self._gen_temp_sourcefile(body, headers, lang)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 109, in _gen_temp_sourcefile
        with open(filename, "w") as file:
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 418, in _open
        self._violation("open", path, mode, *args, **kw)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 407, in _violation
        raise SandboxViolation(operation, args, kw)
    setuptools.sandbox.SandboxViolation: SandboxViolation: open('_configtest.c', 'w') {}

    The package setup script has attempted to modify files on your system
    that are not within the EasyInstall build area, and has been aborted.

    This package cannot be safely installed by EasyInstall, and may not
    support alternate installation locations even if you run its setup
    script by hand.  Please inform the package's author and the EasyInstall
    maintainers to find out if a fix or workaround is available.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\2\pip-install-1y2lm8yx\gevent\setup.py", line 427, in <module>
        run_setup(EXT_MODULES, run_make=_BUILDING)
      File "C:\Users\user\AppData\Local\Temp\2\pip-install-1y2lm8yx\gevent\setup.py", line 328, in run_setup
        setup(
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\dist.py", line 717, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
        dist = best[req.key] = env.best_match(
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
        return installer(requirement)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\dist.py", line 787, in fetch_build_egg
        return cmd.easy_install(req)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
        raise
      File "C:\Users\user\.conda\envs\locust8\lib\contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "C:\Users\user\.conda\envs\locust8\lib\contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
        yield saved
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "C:\Users\user\AppData\Local\Temp\2\easy_install-cnm3v8gt\cffi-1.13.2\setup.py", line 127, in <module>
        HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
      File "C:\Users\user\AppData\Local\Temp\2\easy_install-cnm3v8gt\cffi-1.13.2\setup.py", line 105, in uses_msvc
        include_dirs=include_dirs)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 127, in _compile
        src = self._gen_temp_sourcefile(body, headers, lang)
      File "C:\Users\user\.conda\envs\locust8\lib\distutils\command\config.py", line 109, in _gen_temp_sourcefile
        with open(filename, "w") as file:
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 418, in _open
        self._violation("open", path, mode, *args, **kw)
      File "C:\Users\user\.conda\envs\locust8\lib\site-packages\setuptools\sandbox.py", line 407, in _violation
        raise SandboxViolation(operation, args, kw)
    setuptools.sandbox.SandboxViolation: SandboxViolation: open('_configtest.c', 'w') {}

    The package setup script has attempted to modify files on your system
    that are not within the EasyInstall build area, and has been aborted.

    This package cannot be safely installed by EasyInstall, and may not
    support alternate installation locations even if you run its setup
    script by hand.  Please inform the package's author and the EasyInstall
    maintainers to find out if a fix or workaround is available.

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
cyberw commented 5 years ago

Do you get the same error if you just do pip install gevent? If so it is an issue with gevent and can probably not be solved in locust...

ecc256 commented 5 years ago

Lars, Yep, same error... gevent is included in locust setup, right?

cyberw commented 5 years ago

Yup, it is a core component of locust.

cyberw commented 5 years ago

If gevent doesnt work in conda then there isn't much we can do. Maybe you can file a bug on gevent? https://github.com/gevent/gevent

heyman commented 5 years ago

Gevent & Locust does work in Anaconda. I just tested it within a Ubuntu 18.04 docker container (Anaconda 2019.10, Python 3.7). I think this might be a Windows related issue.

ecc256 commented 5 years ago

gevent works in Anaconda 2019.10, Python 3.8 @ Ubuntu 18.04 without container too. Need gcc installed to build it.

ecc256 commented 5 years ago

Found the root issue, solution is here:

Basically, the install sequence should be:

pip install git+git://github.com/gevent/gevent@master
pip install git+git://github.com/gwik/geventhttpclient@master
pip install locust

Edited The following will do too:

pip install git+git://github.com/gevent/gevent@master
pip install locust
cyberw commented 5 years ago

@ecc256 Thanks!