You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Ubuntu; python 3.10.6; working in the virtual environment.
(venv) andrew@andrew-Surface-Book-2:~/Code/sandbox/firstPythonPackage$ pip install ./packaging_tutorial
Processing ./packaging_tutorial
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: example_project_andrewk
Building wheel for example_project_andrewk (pyproject.toml) ... done
Created wheel for example_project_andrewk: filename=example_project_andrewk-0.1.1-py3-none-any.whl size=2604 sha256=70c66a949ba92af0a778f88be640f1722a48b639d6b0bf4844aee2ddf10a92e2
Stored in directory: /tmp/pip-ephem-wheel-cache-a1fx_77o/wheels/7d/7a/b7/27a3ef84323c9fd354c900433fc50b3690755fa39e912ed852
Successfully built example_project_andrewk
Installing collected packages: example_project_andrewk
Attempting uninstall: example_project_andrewk
Found existing installation: example_project_andrewk 0.1.0
Uninstalling example_project_andrewk-0.1.0:
Successfully uninstalled example_project_andrewk-0.1.0
Successfully installed example_project_andrewk-0.1.1
(venv) andrew@andrew-Surface-Book-2:~/Code/sandbox/firstPythonPackage$ pip list
Package Version
----------------------- -------
build 0.10.0
example_project_andrewk 0.1.1
packaging 23.1
pip 22.0.2
pyproject_hooks 1.0.0
setuptools 59.6.0
tomli 2.0.1
Running the following commands in the python3 virtual environment would show the example_project_andrewk library available.
import pkg_resources
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
However the import statement from the python3 console from example_package_andrewk import example resulted in ModuleNotFound Issue.
Swapping to setuptools instead of hatchling seems to work correclty.
The text was updated successfully, but these errors were encountered:
crewz07
changed the title
Packaging Tutorial Hatchling Build resulted in ModuleNotFound after installing libary; Setup works correctly
Packaging Tutorial Hatchling Build resulted in ModuleNotFound after installing libary; Setuptools works correctly
Apr 16, 2023
The name of the project needs to match the module name for hatchling to automatically find it. If you want them different, you can tell hatchling where your package(s) are via an extra config setting.
Using Ubuntu; python 3.10.6; working in the virtual environment.
Running the following commands in the python3 virtual environment would show the example_project_andrewk library available.
However the import statement from the python3 console
from example_package_andrewk import example
resulted in ModuleNotFound Issue.Swapping to setuptools instead of hatchling seems to work correclty.
The text was updated successfully, but these errors were encountered: