Vangie
Vangie

Reputation: 47

I cannot run locust on pycharm it says in the error

I would like to ask for help about this error. FYI, I have two version of python, they are python 2.7 and 3.9 But I used 3.9 to run locust. Already set up the path in the environment variables and the python interpreter in pycharm.

I am new to load testing and I have searched for solutions but none of it worked. So if you have ideas on how to solve this. I would really appreciate your help. Thank you.

Here is the Error:

    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: Traceback (most recent call last):
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\runpy.py", line 
    174, in _run_module_as_main
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: "__main__", fname, loader, pkg_name)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\runpy.py", line 
    72, in _run_code
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: exec code in run_globals
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File 
    "C:\Python27\Scripts\locust.exe\__main__.py", line 9, in <module>
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 428, in main
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: docstring, locusts = 
    load_locustfile(locustfile)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 397, in load_locustfile
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: imported = 
     __import_locustfile__(locustfile, path)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 371, in __import_locustfile__
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: imported = 
    imp.load_source(os.path.splitext(locustfile)[0], path)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File 
    "C:\Users\PycharmProjects\LoadTest\seq1creation.py", line 8, in <module>
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: from locust import HttpUser, 
    SequentialTaskSet, constant, task
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: ImportError
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: :
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: cannot import name HttpUser
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:

Upvotes: 0

Views: 1236

Answers (1)

Cyberwiz
Cyberwiz

Reputation: 11396

Check your locust version (locust -V).

Looks like you are running an old (0.x) version, most likely the last one with python 2 support.

Probably the root cause is that you somehow installed locust for your 2.7 environment.

Upvotes: 2

Related Questions