I'm looking into making a script callable from the terminal using entry_points/console_scripts in the setup.py. So far when I used the editable install all works well. Installing like this:
% pip3 install -e /<path>
I can call the script by typing the name "checky" directly into the terminal with no issues.
However, when I'm now trying to install it "for real" with the following:
% pip3 install /<path>
The installation works with no issues but when I now try to call the script using "checky" it looks like it's trying to run it with python 2.7. I get the following errors:
*Traceback (most recent call last):
File "/usr/local/bin/checky", line 11, in <module>
load_entry_point('checky==1.0.1a1', 'console_scripts', 'checky')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named checky*
Here is my setup.py:
setup(
name='checky',
version=find_version("files", "__init__.py"),
python_requires='>=3.10',
author='****',
author_email='****',
description="***",
packages=find_packages(),
entry_points={
'console_scripts': [
'checky = checky:main',
]
},
)
I'm running macOS 12.1
Anyone know what I'm doing wrong? Or could anyone at least point me in the right direction on where to look for a solutions? I'm lost..
Regards, Anton
EDIT 1
After upgrading to macOS 12.3 I no longer get the issue with default python 2.7. If anyone has a solution to this that doesn't require upgrading to macOS 12.3 (getting rid of 2.7), please feel free to share.
Anyway, now we got some path issues.
After running the pip3 install command and calling "checky" I get this error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/checky", line 5, in <module>
from checky import main
ModuleNotFoundError: No module named 'checky'
Anything wrong in my setup.py?
#!/usr/bin/env python3in your setup.py