I am a beginner in Machine Learning.
I am getting this error in my machine learning recommendation model "No Module name matrix_factorization_utilities" foundScreen Shot of error.
I am using Python 3 and Pycharm. Library numpy, pyMF pandas.
Looks like you don't have scipy
Windows:
python -m pip install scipy
Linux:
pip install scipy
It looks like you installed the module (as it is in your directory), so the next step is to make sure you the module is in your PYTHONPATH environment variable:
Python module not found
Here is another website that may also help regarding the PYTHONPATH variable:
How to fix "ImportError: No module named ..." error in Python?
Also APorter1031 raises an excellent point - that may be the issue.
Related
So I want to run a repo i cloned from github project that is used to segregate the medical reports data and categorise it using machine learning and an error occurred.
Here is the relevant code:
import modeladapter as ModelAdapter
VSCode screenshot:
This means that the module does not exist on your PC in the area where Python modules are installed. You should try to install the module using pip and it should resolve I think. I don't know what the module is though, I tried googling it and couldn't find anything, so maybe somewhere on the GitHub repo page it says what the required modules are and where to get them?
I tried use ironpython to run python script from c#. Without packages it work well. But when I use packages in python script like:
import pmdarima
# do something
I get error.
I tried add path location:
ICollection<string> searchPaths = engine.GetSearchPaths();
searchPaths.Add("/usr/local/lib/python3.8/dist-packages");
searchPaths.Add("/home/franta/.local/lib/python3.8/site-packages");
engine.SetSearchPaths(searchPaths);
But I still get error - No module named 'fnmatch'. (Also tried install module fnmatch, but there is no module fnmatch???).
So my question is how to install packages to iron python? Or is something better then iron python?
Trying to import "libgen_api" module but get "Module not found" error.
Pip install libgen-api shows "requirement already satisfied" and the module exists in the python folder as well.
The documentation of the module says that it has to be called with libgen_api.
Other modules work fine. I am using VScode but the problem persists in the python terminal as well. I apologize if this question is redundant but so far I have not been able to find a solution anywhere.
The problem was that VScode sys.path showed python38-32 but the module was installed in python39. To fix the issue go to View -> Command pallete -> select interpreter and make sure to use the version under which pip installed the module.
This answered my question.
How can I change python version in Visual Studio Code?
I'm tyring to import wolfamalpha into my code but it gives a error saying:
ModuleNotFoundError: No module named 'wolframalpha'
I tried installing it with pip install wolframalpha, but it still doesn't work.
Here is my code:
import wolframalpha
client = wolframalpha.Client('*************')
When you run your python file, are you sure that you are using the correct python interpreter that you performed the pip install wolframalpha to? It sounds like you may have multiple versions of python on your machine and there is a mismatch. If you are using VSCode, it is easy to see which interpreter is running on the bottom of the screen, which may help you debug the issue.
I'm running a code on deep learning, which uses the opencv module, by running python main.py (contains import cv2 statement), but always get the error 'ImportError: dynamic module does not define module export function (PyInit_cv2)'.
I've tried to reinstall my anaconda and create new virtual environments, but all got the same result. This problem really confuses me a lot and I've googled for many related problems, none of them works. I think the problem is something related to the environment and has nothing to do with the code, because I got the same result by simply run import cv2 in python prompt. The more confusing thing is that, even after I remove the opencv module, I also get the same problem, but not a ModuleNotFoundError. Does anyone can give me some advice? Thanks a lot!
I think I found one possible reason of this error.
Recently I was configuring the caffe environment on one server, I downloaded the source code of opencv-2.4.13 and compiled manually, added /usr/local/opencv-2.4.13/build/lib to $PYTHONPATH, and caffe worked well. After that, when I entered one of my virtual environment using conda activate py35, which uses python3.5, tried import cv2 in the python prompt, got the error above.
I'm not sure but I think the cause of the error is opencv-2.4.13 compiles a python2 interface so it can't be imported by python3. Python imports packages by searching the directories listed in sys.path, where $PYTHONPATH is in the second place after the current working directory (This is a great article introduces the mechanism of python finding packages). So when we enter the py35 environment, python will first look for $PYTHONPATH and find the opencv installed on the root directory instead of finding the opencv in the virtual environment using conda install opencv-python.
So there are two solutions of this problem:
Use python2 instead.
Remove /usr/local/opencv-2.4.13/build/lib from $PYTHONPATH.
which all work for me.
Similar post, might help:
ImportError: dynamic module does not define init function (initfizzbuzz)
Could you provide info on how you installed the CV module?
I had the same problem, which was caused by the cv2.so file in /usr/local/lib/python2.7/site-packages/cv2.so. After I deleted the file and use command sudo pip3 install opencv-python, it worked for python3.