I'm trying to set up a proper Python package for distribution and I'm running into problems with the console_scripts property of my setup.py file. I have the following in my setup:
<...>
entry_points={"console_scripts": ["solve_cipher=cipher_solver.solve_cipher:main"]}
<...>
I have packaged and sent to the test PyPI and then installed my packaged in a new virtual environment. Now, the command solve_cipher is available but running it gives me:
$ solve_cipher
Traceback (most recent call last):
File "/Users/markus/.virtualenvs/cipher_solver_debug_pypi/bin/solve_cipher", line 6, in <module>
from cipher_solver.solve_cipher import main
ModuleNotFoundError: No module named 'cipher_solver'
However, if I just start Python and run the same import line, it works just fine:
$ python
>>> from cipher_solver.solve_cipher import main
>>>
Why does this happen? My project layout is as follows:
cipher_solver
<...>
cipher_solver
consts.py
simple.py
solve_cipher.py
utils.py
<...>
setup.py
which python?head -1 /Users/markus/.virtualenvs/cipher_solver_debug_pypi/bin/solve_cipher?which python? When youimport cipher_solverfrom the command line what is the current directory? The one wheresetup.pyresides?setup.pyis. Any other ideas?