Reputation: 1669
I'm trying to pip install a separate git repo into my python project. Pip install seems to work when I run pip install git+https://github.com/XxdpavelxX/myapp
. However when I then run my code I get the following error.
Here's my app: https://github.com/XxdpavelxX/myapp
ModuleNotFoundError: No module named 'myapp'
ERROR: could not load /Users/myUser/stuff/callerFile.py
Here's the callerFile.py
(in a separate git repo):
from myapp import test
print test.random_print()
I suspect that this is pip install
related. When I run pip install git+https://github.com/XxdpavelxX/myapp
it seems to pass, however inside of my python venv/lib/python3.7/site-packages
I only see myapp-1.0py3.7.eggs-info
instead of the actual package. Anyone knowing what I'm doing wrong? Do I need to add my library to pypi for this to work?
Edit: Added the actual url to github repo I'm testing.
Upvotes: 1
Views: 3828
Reputation: 94726
Your package has neither py_modules
nor packages
hence it doesn't install anything importable when installed.
My advice is to rename your __init__.py
to myapp.py
and add this to setup.py
:
setup(
…
py_modules=['myapp'],
…
)
Upvotes: 1
Reputation: 6044
Create a folder called myapp and move the __init__.py and test.py files to that folder.
Add the following line to your setup.py (I added after url),
packages=['myapp'],
Now installation will be successful and you can import your package.
Upvotes: 2
Reputation: 189
You don't need to post your code to pypi.
I suggest you to use tag #egg
to set package name.
So the pip status would be like
pip install git+https://github.com/myGitUser/myLibrary#egg=myLibrary
Upvotes: 1