Traceback (most recent call last):
File "/path/to/my/envs/q/bin/q", line 5, in <module>
from bin.q import run_standalone
ModuleNotFoundError: No module named 'bin'
/path/to/my/envs/q/bin/q is a script that is generated by the PYTHON -m pip install . -vv for the console script defined in setup.py. It looks like this...
#!/Users/santiago/mambaforge/envs/q/bin/PYTHON
# -*- coding: utf-8 -*-
import re
import sys
from bin.q import run_standalone
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_standalone())
Essentially the issue is that there is no package bin in the environment.
Solution
Adjust the setup.py as follows:
setup(
...
package_dir={"": "bin"}, # delete this line since its not needed
packages=setuptools.find_packages(),
# originally: packages=setuptools.find_packages(where="bin")
...
Additional considerations
One might want to reconsider renaming the bin folder to q (since it is quite weird to have a package named bin). Then import statements in test_suite.py and the console script in setup.py would have to be adjusted. I don't know what else could break thou.
TLDR
When installing
q
as a python package from the source, callingq
fails because thebin
package is not found (essentially because installation fails).Reproduce the error
Let's say I want to install
q
as a python package usingpip
and the providedsetup.py
. Namely,The last command gives an error:
/path/to/my/envs/q/bin/q
is a script that is generated by thePYTHON -m pip install . -vv
for the console script defined insetup.py
. It looks like this...Essentially the issue is that there is no package
bin
in the environment.Solution
Adjust the
setup.py
as follows:Additional considerations
One might want to reconsider renaming the
bin
folder toq
(since it is quite weird to have a package namedbin
). Then import statements intest_suite.py
and the console script insetup.py
would have to be adjusted. I don't know what else could break thou.