No module named 'utils' - python

I am new to the world of python. I am trying to learn first order logic from https://github.com/aimacode/aima-python/blob/master/logic.ipynb
I just follow the same steps as mentioned but I get the following error.
ModuleNotFoundError: No module named 'utils'
I use Jupyter notebook for the testing purpose. I can see there are questions related to this error. But still I could not solve it.
Thanks for any input.

You need to clone the whole Github repo, not only download (or copy from) the Notebook.
See utils.py is a separate file.
https://github.com/aimacode/aima-python/blob/master/utils.py
Also refer to Installation Guide

Related

ModuleNotFoundError: No module named 'h5pyViewer'

I have a question regarding h5pyViewer to view h5 files. I tried pip install h5pyViewer but that didn't work. I checked on Google and it states that h5pyViewer does not work for older versions of Python, but that there are a few solutions on GitHub. I downloaded this with pip install git+https://github.com/Eothred/h5pyViewer.git which finally gave me a successful installation.
Yet, when I want to import the package with import h5pyViewer it gave me the following error: ModuleNotFoundError: No module named 'h5pyViewer'. However when I tried to install it again it says:
Requirement already satisfied: h5pyviewer in c:\users\celin\anaconda3\lib\site-packages (-v0.0.1.15)Note: you may need to restart the kernel to use updated packages.
Any ideas how to get out of this loop or in what other way I could access an .h5 file?
There could be so many things wrong so it's hard to say what the problem is.
The actual package import has a lowercase "v": h5pyviewer (as seen in your error message).
Your IDE/python runner may not be using your Conda environment (you can select the environment in VSCode, and if you are running a script in the terminal make sure your Conda env is enabled in that terminal)
The GitHub package might be exported from somewhere else. Try something like from Eothred import h5pyviewer.
Maybe h5pyviewer is not even supposed to be imported this way!
Overall, I don't suggest using this package, it seems like it's broken on Python 3 and not well maintained. The code in GitHub looks sketchy, and very few people use it. A good indicator is usually the number of people that star or use the package, which seems extremely low. Additionally, it doesn't even have a real readme file! It doesn't say how to use it at all. Suggest you try something else like pandas. But if you really want to go with this, you can try the above debugging steps.

ModuleNotFoundError: No module named 'google'

I am new to PyCharm (coming from RStudio world). I am just trying to setup a PyCharm project. My first line of code is google library import (Later I intend to write codes for pulling data from BigQuery).
But I am getting an error saying ModuleNotFoundError: No module named 'google' in PyCharm. I tried suggested solutions for a very similar stackoverflow question.
I also tried invalidating cache and restart by doing File >
I can see that the google is installed in the Python interpreter. I am not able to figure out what's the issue. To me looks like it is related to the way we setup environment in PyCharm.
Edit: I checked Project interpreter and Run Configuration interpreter. Both match and still get the same thing.
The library you want to use is not named google, is called google-cloud-bigquery, just install that one.
Look here:
https://cloud.google.com/python/docs/reference/bigquery/latest#windows
I guess you know, but you can install it with pip (like in the above link) or in Pycharm settings (clicking in the + in your third screenshot).

ModuleNotFoundError: No module named 'modeladapter'

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?

Python 3.x import class module not found error

Trying to import a class into my Python code from another .py file I've written and included in the same sub-directory, however I'm receiving the error:
ModuleNotFoundError: No module named 'main.S_DES_Functions'; 'main' is not a package
Please find below images of the layout of my Python project.
I'm hoping this is just a really silly mistake I'm making, so if anyone can please advise what I'm doing wrong that'd be great :)
Thanks for the suggestions, I tried them however was still receiving the same error. But I managed to find a work around, similar to what is listed in this other Stack Overflow question - Unresolved reference issue in PyCharm
I basically made a new directory for my classes and set it as the directory as a "Source" for the project, which then allowed me to import it and use the classes without any issues.

Python ImportError (Cannot import name Variables)

I have done some research on this question and nothing seems to fix it, I suspect I may be accidentally circularly importing somewhere, but this one has stumped me.
This package is a Python IRC Service framework. The issue occurs when dynamically loading a module (via imp.load_source()), and the new module tries to import something from the src folder (Variables.py). It fails with "Cannot import name Variables", yet, it imports another module from the same directory without complaint.
Here is the specific error:
**ERROR: ModLoad(): Unable to load module
/home/sam/workspace/Affinity/bin/../modules/ircd_affinity.py:
cannot import name Variables
**
This is the full file for modules/ircd_affinity.py: ircd_affinity.py, and src/Variables.py: Variables.py
If it helps. browse the entire repository... this (https://github.com/miniCruzer/Affinity/blob/master/src/Affinity.py) module (starting at line 123) loads modules.
I would appreciate if all responses were kept relevant to the specific issue at hand. Yes, it may be tempting to suggest other things I'm doing wrong or otherwise throughout the entire package - I am welcome to suggestions: please e-mail them to me.
Show the full traceback. Look through it for evidence of (attempted) circular import.
Run Python with the -v option ... what does that tell you?
Look at the contents of sys.path and sys.modules just before the error happens.
"**ERROR: ModLoad(): Unable to ..." doesn't look line a Python-raised error. Is that in your code? If so, dig deeper; why is it raised?

Categories

Resources