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

ImportError: cannot import name 'OrderedDict' from 'typing' #2223

Closed
jinghaifeng1 opened this issue Oct 14, 2022 · 3 comments
Closed

ImportError: cannot import name 'OrderedDict' from 'typing' #2223

jinghaifeng1 opened this issue Oct 14, 2022 · 3 comments
Labels

Comments

@jinghaifeng1
Copy link

Describe the bug

pytnon : 3.7.0
locust: 2.12.1 2.10.1

When I started locust with this configuration, I get an error

Traceback (most recent call last):
File "d:\jhf\software\python\python370\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "d:\jhf\software\python\python370\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\jhf\software\python\python370\Scripts\locust.exe_main
.py", line 5, in
File "d:\jhf\software\python\python370\lib\site-packages\locust_init
.py", line 18, in
from .contrib.fasthttp import FastHttpUser
File "d:\jhf\software\python\python370\lib\site-packages\locust\contrib\fasthttp.py", line 24, in
from locust.env import Environment
File "d:\jhf\software\python\python370\lib\site-packages\locust\env.py", line 15, in
from .stats import RequestStats, StatsCSV
File "d:\jhf\software\python\python370\lib\site-packages\locust\stats.py", line 15, in
from typing import (
ImportError: cannot import name 'OrderedDict' from 'typing' (d:\jhf\software\python\python370\lib\typing.py)

Suggestion for repairing

in python370\lib\site-packages\locust\stats.py

del import OrderedDict as OrderedDictType,

replace 326 line "OrderedDictType" to "OrderedDict"

Environment

  • OS: windwos 10
  • Python version: 3.7.0
  • Locust version: (please dont file issues for anything but the most recent release or prerelease builds) 2.12.1 2.10.1
  • Locust command line that you ran: locust.exe --master -f collect.py --web-host="XXXXXXXXX"
@cyberw
Copy link
Collaborator

cyberw commented Oct 14, 2022

I think Python 3.7.0 is broken, please update to at least 3.7.2 (but preferably latest 3.7 release or newer)

@jinghaifeng1
Copy link
Author

I think Python 3.7.0 is broken, please update to at least 3.7.2 (but preferably latest 3.7 release or newer)

OK

@Mauricio566
Copy link

What @cyberw says is true, try version 3.7.9, it worked for me. and thank you very much @cyberw

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

No branches or pull requests

3 participants