pypa / packaging-problems

An issue tracker for the problems in packaging
151 stars 35 forks source link

The Packaging Python Projects doesn't work #640

Closed mohsenSy closed 1 year ago

mohsenSy commented 1 year ago

OS version

Ubunt 20.04

Python version

3.8.10

Pip version

22.3.1

Guide link

https://packaging.python.org/en/latest/tutorials/packaging-projects/

Problem description

I followed all the instructions on the web page to create a new package but couldn't import the code after installing the package.

Error message

>>> from example_package_mouhsen import example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'example_package_mouhsen'
merwok commented 1 year ago

Please give more info about your files and the commands you run.

Did you create a example_package_mouhsen package? Did you refer to it in setup.py? Did you install it into a clean location?

mohsenSy commented 1 year ago

I just followed the instructions using a docker image for python 3.11 and it worked this time, I'm not sure what was wrong with my previous setup on my laptop directly, sorry I'll close this and add comments later if I find the previous bug in my code.

My current code is here now https://gitlab.com/hash-platform/core

merwok commented 1 year ago

That code is not for example_package_mouhsen, so we can’t find what the problem was. (BTW your packages are missing __init__.py)

If you have more issues, please give: project layout, setup (and/or pyproject) file, commands run, error message. Thanks!