Thank you, all of you. You really helped me to figure out what the question is. Now let me make this clear, and hopefully this case could help others.
The codes I want to run actually are contained in a dictionary called 'src'. and the programmer wrote their code, for example main.py, with following line: ''' import src.utils as utils ''' I made a mistake that I ran the code in the ~/main/src dictionary, so python returned an error "no src module". I was then stupid to find src package.
Actually, one easy way to run the codes is copying all the .py files to the upper level dictionary, in my case ~/main/, and run main.py in ~/main/, because ~/main/src/ contains utils.py, then the code will run smoothly, and no module missing at all.
Answer from Edw. Y on Stack Overflow
» pip install src
Using a src directory for a Python package
python 3.x - I am in need to import src library. I have used pip install src. but an error use to appear - Stack Overflow
pip install src doesn't work
python - Does the src/ folder in PyPI packaging have a special meaning or is it only a convention? - Stack Overflow
Try pip install src==0.0.6
It worked for me
I am in need to import src library.
No, you don't. There is a package named src in pypi which has been made by a benevolent soul designed to not work, because that is not what you want to do.
When you're instructed to use pip install src, what it means is that you're supposed to install the directory src under a local repository as a local package. If that command doesn't work, it's because you're running it in the wrong directory, you skipped downloading the source code of the program you're trying to install, or you failed to read some instruction from the mantainer.
Packages crafted this way have well defined setup.py, setup.cfg, pyproject.toml and all modules stuck inside a src folder, which makes it easy to install the whole program as a python package (or module) by simply writing pip install src in the root folder of the program's source code.
If there isn't a src folder correctly configured as a python package or module, pip will default to searching for a package named src on the pypi default repository (pypi.org). Thankfully, one person decided to make a dummy package on that namespace to avoid someone uploading a virus to your environment, making your code not work so you can refrain from doing something you're not supposed to.
So to fix that undesired behaviour you should make sure that the package you're supposed to install is present in your environment. For cloud environments, the current folder where you run pip install src should be the one where you downloaded the source files for the thing you're trying to install.