I try to reorganize parts of my code into packages to be delivered by pip. But I do not understand the following: There is a directory my_package containing _init.py (empty), my_module.py (with some code), setup.py:
from setuptools import setup, find_packages
setup(
name='mypackage',
version='0.1',
description='My Package',
author='Its me',
author_email='my.email@address.moon',
packages=find_packages(),
install_requires=[
'cx_Oracle>=7.2.2'
]
)
I created a dist- file dist\mypackage-0.1.tar.gz by
...my_package>python.exe setup.py sdist
I created a virtual environment, activated it, used
...inside_venv>Scripts\pip.exe install <complete_path_to_dist\mypackage-0.1.tar.gz>
created a test-file test.py
import cx_Oracle
print(cx_Oracle.version)
import mypackage
everything worked (I got the message "newer PIP- Version available...")
cx_Oracle is installed w/o any problems (the version is newer than all others), but it is impossible to import my packages ModuleNotFoundError: No module named 'mypackage'
I tried the following:
- Originally the packages was called my_package and I spent many time to try combinations with _ and -, so that I decided to name the package without "_"
- I updated pip in the venv
- I installed the package outside of venv
Whatever I tried, the answer was: ModuleNotFoundError: No module named 'mypackage'
(BTW: The code inside my_module.py works without problems, if I use it directly)
Any Ideas?