0

I installed third party module and its egg file was created in following path

D:\Utkarsh\Lib\site-packages

I am not getting error while importing module in IDLE in following way

import snakebite

When i am importing the same in HDFS.py file having following lines

import snakebite
from snakebite.client import Client
client = Client('localhost', 9000)

it causes following stack error:

============ RESTART: D:/Utkarsh/Python Projects/HDFS.py ============
Traceback (most recent call last):
  File "D:/Utkarsh/Python Projects/HDFS.py", line 1, in <module>
    import snakebite
ModuleNotFoundError: No module named 'snakebite'

sys.path had following values:

D:/Utkarsh/Python Projects 
D:\Utkarsh\Installation\Lib\idlelib 
D:\Utkarsh\Installation\python36.zip 
D:\Utkarsh\Installation\DLLs 
D:\Utkarsh\Installation\lib 
D:\Utkarsh\Installation 
D:\Utkarsh\Installation\lib\site-packages

Being newbie,can anybody help me in knowing exact cause of it.

Utkarsh Saraf
  • 475
  • 8
  • 31
  • try printing `sys.path` - `D:\Utkarsh\Lib\site-packages` is not in that list for interpreter you're using. Since this directory is not in `sys.path`, Python won't find it. – Łukasz Rogalski Mar 15 '17 at 16:17
  • @ŁukaszRogalski..i have updated above details.I think it is covered in sys.path.Error was in running from external python file in IDLE.I opened that file in IDLE and in that file clicked on "Run Module" – Utkarsh Saraf Mar 15 '17 at 16:25
  • you can clearly see that `D:\Utkarsh\Lib\site-packages` is not there. Only `D:\Utkarsh\Installation\lib\site-packages` is there. – Łukasz Rogalski Mar 15 '17 at 16:30
  • I have installed Python inside `D:\Utkarsh\Installation\` .Only the path on which file is kept is different from this folder. – Utkarsh Saraf Mar 15 '17 at 16:33
  • 1
    @ŁukaszRogalski Unless there is a separate python installation in `d:/Utkarsh`, there should not be `d:/Utkarsh/lib/site-packages`. Utkarsh, to be sure of what binary you *are* running, each time, add `import sys; print(sys.executable)` before the import. – Terry Jan Reedy Mar 16 '17 at 00:25

0 Answers0