AndBondStyle / niimprint

Python library for Niimbot label printers. Supports D11/B21/B1 via bluetooth or USB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'niimprint'

rubeycubey opened this issue · comments

Hi - thanks for the code, but I get a module not found error as follows...

me@laptop:~/Downloads/github/niimprint$ python3 niimprint --help
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/me/Downloads/github/niimprint/niimprint/__main__.py", line 7, in <module>
    from niimprint import BluetoothTransport, PrinterClient, SerialTransport
ModuleNotFoundError: No module named 'niimprint'

Am I invoking it incorrectly? I'm on Debian. I ran poetry to install the dependencies.

Please disregard. I have since learned I needed to pip install it in a virtual environment:
https://www.squash.io/how-to-pip-install-from-a-git-repo-branch/

@rubeycubey you need to configure PYTHONPATH to include project root directory. Poetry does this for you, but if you're using pip and/or python commands to run the script, you need to set it manually.

There are the options for future reference:

  1. Install the project using poetry, then activate environment, then run the script:
poetry install
poetry shell
python niimprint ...
  1. Install the project using poetry and run the script also using poetry:
poetry install
poetry run python niimprint ...
  1. Install the project using pip, then add project root to python module path, then run the script:
pip install ...
export PYTHONPATH=$(pwd)
python niimprint ...