When calling the kmodes package like this:
# I have also tried
# from kmodes.kmodes import KModes
from kmodes.kprototypes import KPrototypes
ModuleNotFoundError: No module named 'kmodes'
As suggested by #648trindade, all I had to do was install the package. That's not included in Anaconda by default.
I had same issue. It turned out that I named my test file as kmodes.py, and current directory is in sys.path. so python use my test file as the library.
If you have set the system path to some folder having kmodes.py file, just rename your script as something else, everything is fine.
Or you just remove the sys.path line from the code and restart the compiler
Related
I have trouble with tinkoff API 2.0.
Venv does not see tinkoff-investments, but it was installed successfully.
What did I try:
downgrade from 3.10 to 3.8 python version
update from 3.10 to 3.10.7
deleted and installed module tinkoff-investments
CODE:
image
from tinkoff.invest import Client
TOKEN = 'my_token'
with Client(TOKEN) as client:
print(client.users.get_accounts())
This error:
ModuleNotFoundError: No module named 'tinkoff.invest'; 'tinkoff' is not a package
may also occur if you have named the main program file you created as tinkoff.py and try to run it as python tinkoff.py or another file has the name tinkoff.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.
In your case, according to the screenshot, you run the file tinkoff.py, which has this line about import:
from tinkoff.invest import Client
Python sees import and first thing (as described above in documentation at link) Python does is look invest at this file — tinkoff.py, not in module tinkoff you installed in venv or in Python310\Libs\... It looks like Python trying to import the same file into itself and finds only the TOKEN variable and not invest object.
So simply rename your startup file tinkoff.py to something else, for example to tinkoffApp.py, to avoid the similarity of the name with the imported module.
I have a python file and the developer of that code has left the organization. When I run the code I get the following error.
import dataAnalysis as DV ModuleNotFoundError: No module named
'dataAnalysis'
I provide below the brief snippet of the python file "main.py" below.
import dataAnalysis as DV
def performCheck():
... other code
... other code
i = DV.addGraph( pathplus)
Here my question is , how to know the actual module or package name of "dataAnalysis" from the above import statement so that I can make "pip install ". However, I tried to install DataAnalysis module, still it does not work.
Is there any way to get the module or package name to install from the import statement in python ?
Go to console or terminal and run command pip install dataAnalysis. If permission denied, then make sure you have enough privilege to install a package.
Update:
In my opinion pip package DataAnalysis is a library that can be used for pre-processing a csv file. As per your given code, it looks like adding a graph so may be it could be a local package. Check dataAnalysis folder in your project with __init__.py file inside.
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:
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.
I created a Python script named azure.py in the current path which only have one line code print('pseudo azure package').
Then, I opened my Python interpreter in the current path and type 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.
Yesterday, I accidentally deleted the Path variable but I think I restored them. I added Python path to it and I've got my python running through command prompt and also pip is working. However, I'm unable to import new modules to Python shell.
It comes up with the following error
enter code here
File "<pyshell#1>", line 1, in <module>
import wxPython
ModuleNotFoundError: No module named 'wxPython'
Any suggestions as to what I'm missing? Maybe I didn't add the Path correctly?
here is what I have added
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Common Files\Oracle\Java\javapath;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32\Scripts;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32;
C:\Users\user1\AppData\Local\Programs\Python
Also add C:\Users\<your user>\AppData\Local\Programs\Python\Python36-32\Libs; to your path
I need to import the multiprocessing module in Python 2.5.
I've followed the instructions here exactly: http://code.google.com/p/python-multiprocessing/wiki/Install
make and make test run without errors. I've also edited $PYTHONPATH to include the directory where the package is installed.
But 'import multiprocessing' still says: "ImportError: no module named multiprocessing".
What am I doing wrong? Is there some step missing from these instructions? I haven't installed a Python module before.
Navigate to the directory containing the package then type:
python setup.py install
This info was contained in the INSTALL.txt file.
http://code.google.com/p/python-multiprocessing/source/browse/trunk/INSTALL.txt
perhaps you can try:
import sys
sys.path.append('/path/to/processingdotpylibs/')
import processing