Reputation: 1300
I am trying to execute this example using Python 3.7 with Pycharm and azure-eventhub 1.2.0
package.
When I try to run it, I get this error:
ModuleNotFoundError: No module named 'azure.eventhub'; 'azure' is not a package
This is the problematic line:
from azure.eventhub import EventHubClient, Receiver, Offset
What could be happening?
This is my project interpreter
Using pip freeze:
Upvotes: 0
Views: 5104
Reputation: 24148
As I known, there is a case which will cause your issue.
The Python Interpreter searches the available packages, objects and methods in the paths of sys.path
in order, you can print the value of the sys.path
variable to see the order after import sys
.
So if there is a Python script named azure.py
prior to the real azure
package, you will get the issue ModuleNotFoundError: No module named 'azure.eventhub'; 'azure' is not a package
.
Here is my steps to reproduce this issue.
azure.py
in the current path which only have one line code print('pseudo azure package')
.
from azure.eventhub import EventHubClient, Receiver, Offset
, then to get the issue as below.
It also will happen in Pycharm, even using virtualenv
, please check whether exists a file called azure.py
or azure.pyc
in your current path or the paths in the order of sys.path
list.
Upvotes: 5