Previous ArticleBuilding a Python Package: Pre-Release (5)
Building a Python Package

Building a Python Package: First Release (6)

JARRETT RETZ February 27th, 2021 python programming building a python package


    I wanted to publish a first release for the package but ran into problems after installing and importing the package.

    After running through a few more test alpha releases I was able to make a couple of adjustments and eventually install and use the package as intended.

    Additionally, I forgot to import all the new table definitions into the main Bea class.

    Setup Files

    In the last post I removed the file and only had the setup.cfg in the project. When I tested the package, I may have still been using the local version, and therefore the package was still working.

    Before the first release, I wanted to test the client from a new virtual environment. When I downloaded and tried to import the Bea client I got a "Module Not Found" error.

    Reviewing the packaging python projects guide I noticed that the example project had both the and setup.cfg file.

    Therefore, I added both files to the project (after trying a couple of different configurations). That solved the import error, but then I started receiving an import error for

    Relative Import Error

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/jarrettretz/venv/lib/python3.9/site-packages/beasy/", line 2, in <module>
        from .tables.tables import (
    ModuleNotFoundError: No module named 'beasy.tables'

    The folder configuration in the package had nested inside of the tables folder.

    It worked locally but failed when I installed it from PyPI. I couldn't solve the issue by keeping inside its own folder. I pulled it out of the folder and put it at the same level as

    I think I could have solved the issue by adding an file to the tables folder, but I didn't want to put in the effort because it wasn't important to the project that was in its own folder.

    After changing the import statement in I rebuilt the package, published it to PyPI, installed the newest version, and was able to use the package as intended.

    You can visit the first release of beasy on PyPI at

    You can see the source code for beasy on Github at

    Have a thought about the article?

    Send JRTS a message!

    We'll use this email to respond to your message.