I already referred these posts 1, 2, 3, 4, 5
but am still unable to fix this issue. Might be because the other issues are too technical.
I did the below
a) I launched the jupyter notebook (save the file in Desktop)
b) Imported regular packages like Pandas, Numpy, Scipy etc.
c) Later I tried importing Utils
and Generators
package but it threw error.
pip install Utils #success
pip install Generators #success
pip list-v #returned the below location
utils 1.0.1 c:\users\test\appdata\local\continuum\anaconda3\lib\site-packages pip
generators 2020.4.27 c:\users\test\appdata\local\continuum\anaconda3\lib\site-packages pip
When I tried importing `Utils` and `Generators` package, I get the same error as well
import psycopg2
import pandas as pd
import numpy as np
import Utils
import Generators
ModuleNotFoundError: No module named 'Utils'
ModuleNotFoundError: No module named 'Generators'
Does importing Utils
package require any other file?
Why is that people often talk about project directory for importing utils successfully? I am just trying to import it like Pandas
which doesn;t care about project directory. I just launched a jupyter notebook and trying to install Utils
package
How can I import these packages successsfully? can't these packages be imported like regular packages such as pandas
? Because I installed all those packages brand new and they all are imported successfully
I also tried the suggestion in this post by typing import python_utils
but doesn't help
Any tutorial or steps on how can this be resolved would really be helpful for me to follow.
import
statements are case sensitive while the pip
is case insensitive.
According to PEP-0426
which describes a mechanism for publishing and exchanging metadata related to Python distributions/packages,
All comparisons of distribution names MUST be case insensitive, and MUST consider hyphens and underscores to be equivalent.
So technically pip install Utils
, pip install UTILS
or pip install utils
will all install the same distribution/package named utils
.
To fix the problem you have to change your code from
import Utils
import Generators
to
import utils
import generators