ModuleNotFoundError in Using 3rd party module in external .py file - python

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.

Related

how to import module in emr notebook

I want to import module in another direcotory.
But when i import it, this error occurs.
how can i import file in another directory in emr notebook?
I tried below code.
import utils.mysql_util
Traceback (most recent call last):
ModuleNotFoundError: No module named 'utils'
the file that i execute location is batch_pipeline/logdata.
module that i want to import is in batch_pipeline/utils.

ModuleNotFoundError: No module named 'kucoin.client'

I am getting the error: "ModuleNotFoundError: No module named 'kucoin.client'; 'kucoin' is not a package" when running the code underneath. I did pip install like in the documentation here: hhttps://python-kucoin.readthedocs.io/en/latest/ . What is going wrong?
import api_KuCoin
Xkey = api_KuCoin.Pkey
Ykey = api_KuCoin.Skey
Zkey = api_KuCoin.Dkey
client = Client(api_key=Xkey, api_secret=Ykey, api_passphrase=Zkey)```
Traceback (most recent call last):
File "d:\Crypto\kucooin.py", line 1, in <module>
from kucoin.client import Client
ModuleNotFoundError: No module named 'kucoin.client'
This error: ModuleNotFoundError: No module named 'kucoin.client'; 'kucoin' is not a package may also occur if you have named the main program file you created as kucoin.py and try to run it as python kucoin.py or another file has the name kucoin.py in the same folder from which you run your program. Python will consider your program file as a module and try to find something in it that is naturally not in it. About where Python is looking for modules, see sys.path.
In this case, rename your program file so that its name does not equal with the name of the imported module.

Unable to import RocksDB module

I am fairly new to working with RocksDB. I have set up the environment for RocksDB following the link here, but when I run a sample Python script having import rocksdb it says:
Traceback (most recent call last):
File "`<string>`", line 1, in <module>
ModuleNotFoundError: No module named 'rocksdb'
Can anybody suggest a solution to this issue?

How to add python library to Spyder

I am trying to add an external python library from a third party software into Spyder so I can work with it. I have already tried the following:
Adding library path containing .py files to Tools>PYTHONPATH manager
Synchronizing the path
Updating module names list through Tools>Update Module names list
However, when I try to import modules from this library I get two types of errors:
import easy
Traceback (most recent call last):
File "<ipython-input-2-685519d35f15>", line 1, in <module>
import easy
File "C:\Program Files (x86)\Plaxis\PLAXIS 2D\plxscripting\easy.py", line 24, in <module>
from .server import Server, InputProcessor
ValueError: Attempted relative import in non-package
The second type of error as follows:
from plxscripting.easy import *
Traceback (most recent call last):
File "<ipython-input-1-a40c101d3bb0>", line 1, in <module>
from plxscripting.easy import *
ImportError: No module named plxscripting.easy
I don't understand why Spyder is not recognizing these libraries. The path has been added and shows up on the manager. What constitutes a python module? Is it not just the .py file with module name prefix? Is not the path sufficient to work with the library through the IDE?

Python Cron Job Fails Because Modules Are not Found

I'm running a Python script on my server using a cron job:
/usr/bin/python/home/JohnDoe/scripts/Sample.py
I get an error saying
Traceback (most recent call last):
File "/home/JohnDoe/scripts/Sample.py", line 2, in <module>
import gspread
ImportError: No module named gspread\
Is there an easy way to run my third-party modules?

Categories