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

ModuleNotFoundError in Python 3.6 OSX 10.12 #627

Closed
chhantyal opened this issue Jul 21, 2017 · 5 comments
Closed

ModuleNotFoundError in Python 3.6 OSX 10.12 #627

chhantyal opened this issue Jul 21, 2017 · 5 comments

Comments

@chhantyal
Copy link

chhantyal commented Jul 21, 2017

I use Python 3.6 installed via Homebrew.
There seems to be import issue, I am exactly not sure why as I see tests for Python 3.6 seems to be passing.

$ locust locustfile.py
Traceback (most recent call last):
  File "/usr/local/bin/locust", line 7, in <module>
    from locust.main import main
  File "/usr/local/lib/python3.6/site-packages/locust/__init__.py", line 1, in <module>
    from core import HttpLocust, Locust, TaskSet, task
ModuleNotFoundError: No module named 'core'

Version: locustio ==0.7.5

$ which locust
/usr/local/bin/locust
@cgoldberg
Copy link
Member

@chhantyal

I use Python 3.6

The issue you are having is because version 0.7.5 is only compatible with Python 2.7. To get Python 3 support you must install Locust 0.8. As of today (7/21/2017) it has not been officially released... so you have 2 options:

  1. install the 0.8a2 pre-release from PyPI: pip install locustio==0.8a2
  2. install the latest master branch from the git repository: pip install git+https://github.com/locustio/locust.git

I see tests for Python 3.6 seems to be passing

Python 3.6 tests do pass in current master branch, but you'll notice the v0.7.5 branch does not test against against Python 3.x: https://travis-ci.org/locustio/locust/builds/135922735

hth

@chhantyal
Copy link
Author

chhantyal commented Jul 22, 2017

Thanks for detail information. Much appreciated. I totally missed to check versions released.

On the side note, last release seems to be from a year ago. May be time to release 3.6 support?
Other users seem to have same confusion, eg #630

@MarcSteven
Copy link

The issue is still existing
I used the python 3.8.2

@gkandale
Copy link

gkandale commented May 9, 2020

I'm getting the issue too...
(venv) gkandale@GKAND msx_platform_src % python3 --version
Python 3.8.2
(venv) gkandale@GKAND msx_platform_src % locust --version
locust 0.14.6

(venv) gkandale@GKANDALE-M-9325 msx_platform_src % locust -f msx_login.py
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: Traceback (most recent call last):
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: File "/Library/Frameworks/Python.framework/Versions/3.8/bin/locust", line 10, in <module>
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: sys.exit(main())
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,190] GKANDALE-M-9325/ERROR/stderr: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/locust/main.py", line 420, in main
[2020-05-08 22:11:08,191] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: docstring, locusts = load_locustfile(locustfile)
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/locust/main.py", line 389, in load_locustfile
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: imported = __import_locustfile__(locustfile, path)
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/locust/main.py", line 365, in __import_locustfile__
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: return  source.load_module()
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
[2020-05-08 22:11:08,192] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 962, in load_module
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 787, in load_module
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap>", line 702, in _load
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap_external>", line 783, in exec_module
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: File "/Users/gkandale/LocustProjects/MSXProjects/msx_platform/venv/msx_platform_src/msx_login.py", line 2, in <module>
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: from data import user_credentials
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: 
[2020-05-08 22:11:08,193] GKANDALE-M-9325/ERROR/stderr: ModuleNotFoundError
[2020-05-08 22:11:08,194] GKANDALE-M-9325/ERROR/stderr: :
[2020-05-08 22:11:08,194] GKANDALE-M-9325/ERROR/stderr: No module named 'data'
[2020-05-08 22:11:08,194] GKANDALE-M-9325/ERROR/stderr: 

@heyman
Copy link
Member

heyman commented May 12, 2020

@gkandale

The stacktrace seems to indicate that the error originates from your test scripts, and not from Locust.

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

No branches or pull requests

5 participants