ModuleNotFoundError: No module named 'kucoin.client' - python

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.

Related

XLS2XXLSX: No module named 'currency-symbols'

I'm trying to use the xls2xlsx module to convert several .xls files to .xlsx format, but I get the following error message:
ModuleNotFoundError: No module named 'currency-symbols'
The code:
import os
from xls2xlsx import XLS2XLSX
path = r'./ammcfiles'
p = os.listdir(path)
for f in p:
if f.endswith('.xlsx'):
x2x = XLS2XLSX(f)
x2x.to_xlsx(f)
I tried pip installing the module, but it didn't solve the problem.
My Python version is 3.10.4.
Note: More of the stacktrace would have been helpful to see the full issue.
Had a similar issue with a script that was developed and previously run with Python 3.6.
Running the script in Python 3.10 returned the following error:
Traceback (most recent call last):
File "<virtual env>/lib/python3.10/site-packages/xls2xlsx/htmlxls2xlsx.py", line 37, in
import currency_symbols.constants as currency_symbols_constant
ModuleNotFoundError: No module named 'currency_symbols.constants'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/script/./script.py", line 20, in
from xls2xlsx import XLS2XLSX
File "<virtual env>/lib/python3.10/site-packages/xls2xlsx/init.py", line 3, in
from .htmlxls2xlsx import HTMLXLS2XLSX
File "<virtual env>/lib/python3.10/site-packages/xls2xlsx/htmlxls2xlsx.py", line 40, in
currency_symbols_constants = importlib.import_module('currency-symbols.constants')
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'currency-symbols'
Investigation
Ensure the packages are installed
python -m pip install xls2xlsx currency-symbols
Lines 36-40 of <virtual env>/lib/python3.10/site-packages/xls2xlsx/htmlxls2xlsx.py
try:
import currency_symbols.constants as currency_symbols_constants
except Exception:
import importlib
currency_symbols_constants = importlib.import_module('currency-symbols.constants')
This code seems to be responsible for loading the currency-symbols module regardless of the Python version and by extension the module version.
Therefore, the original error was received because both import attempts failed.
<virtual env>/lib/python3.10/site-packages/currency_symbols/ contains the file
_constants.py and not constants.py.
Note the folder is currency_symbols and not currency-symbols, underscore (_) vs dash (-). Therefore, htmlxls2xlsx.py is using the new currency-symbols module name currency_symbols but not the new name of the constants sub module _constants
Fix
Edit htmlxls2xlsx.py to use _constants.py
try:
import currency_symbols._constants as currency_symbols_constants
This fixes the import and usage issues.
As Yuli L mentioned, inside the htmlxls2xlsx.py which is in xls2xlsx module directory I found next:
import currency_symbols.constants as currency_symbols_constants
And change by (take care with typos):
import currency_symbols._constants as currency_symbols_constants

Error: No module named 'pymem.process'; 'pymem' is not a package

I am trying to learn how to use pymem in Python.
I have tried to make two different programs according to two tutorials I have seen but I always get the same error when I try to run the code.
I have this:
from pymem import Pymem
pm = pymem("ac_client.exe")
health = pm.read_int(0x007B43F4)
print ("Health: ", health)
But when I try to run the code I get the following error:
Traceback (most recent call last):
File "c:\Users\N\Desktop\PYTHON\pymem\pymem2.py", line 1, in <module>
from pymem import Pymem
File "c:\Users\N\Desktop\PYTHON\pymem\pymem.py", line 4, in <module>
from pymem.process import *
ModuleNotFoundError: No module named 'pymem.process'; 'pymem' is not a package
I have pymem installed in it's latest version from Visual Studio Code. And in the videos I've seen (one is from a few months ago) they have the same code as me.
You have a file named pymem.py that's mentioned in the exception message (specifically c:\Users\N\Desktop\PYTHON\pymem\pymem.py). This locally written pymem module is shadowing the pymem package you've installed elsewhere (python\python310\lib\site-packages according to one of your comments, though that path is not complete).
You need to rename your pymem.py file to something else if you want to be able to use the package.
I think you don't have it installed, try going into cmd, Terminal or whatever and type pip install pymem.
pip should install the package for you and you should be good.

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

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.

"No module named 'osmium._osmium'" error when trying to use PyOsmium

I am trying to use PyOsmium but it will not import. python3 setup.py install appears to complete just fine but when I import osmium I get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/dylan/Downloads/osmium/osmium/__init__.py", line 1, in <module>
from ._osmium import *
ImportError: No module named 'osmium._osmium'
I have no idea what's causing this and it's my first time manually installing a C++ wrapper. I have the top-level PyOsmium and libosmium directories in the same directory. Is it trying to import the C++ files?
Any help would be much appreciated.
I had the same problem. The solution, as provided by one of the maintainers, is very easy:
Are you in the pyosmium root directory while trying the import? Change the directory to somewhere else and try again. In the root directory the local osmium source directory takes precedence over your freshly installed version.
Change to a different directory from the one you compiled in and it should work; it did for me.

ImportError: No module named lines

from lines import lines
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import lines
ImportError: No module named lines
This is taken from this example for Pycha. How I can install this Module?
The module lines.py is part of the Pycha examples. You can find a copy of that module in that directory.
To follow the example correctly, you should call the examples/barchart.py example while still maintaining the rest of the examples directory. Then it will work.
If you want to create an own script based on the example, you’ll have to replace that module with your own code/data.
The module should be in a file name lines.py that is somewhere in your module search-path.

Categories