I have a code in my setup.py file:
from setuptools import setup, find_packages
setup(
name='PBI_telegrambot',
version='0.0.1',
author='junscience',
description='Embedding app for classification',
packages=find_packages(include =['telegram_bot.py', 'login.py', 'screenshot.py']),
scripts=['telegram_bot.py'],
entry_points={
'console_scripts':[
'PBI_telegrambot=telegram_bot:main'
]
}
)
The tree of my project looks like:
├── build
│ ├── bdist.linux-x86_64
│ └── scripts-3.8
│ └── telegram_bot.py
├── dist
│ └── PBI_telegrambot-0.0.1-py3.8.egg
├── env.txt
├── login.py
├── PBI_telegrambot.egg-info
│ ├── dependency_links.txt
│ ├── entry_points.txt
│ ├── PKG-INFO
│ ├── requires.txt
│ ├── SOURCES.txt
│ └── top_level.txt
├── pycache
│ ├── login.cpython-311.pyc
│ └── screenshot.cpython-311.pyc
├── requirements.txt
├── screenshot.py
├── setup.py
└── telegram_bot.py
Firstly, I install requirements, by: pip install -r requirements.txt
I try to install code in Ubuntu:
sudo python3 setup.py install
and run it:
PBI_telegrambot
but receive an error:
/usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (2.2.2) or chardet (5.2.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "/usr/local/bin/PBI_telegrambot", line 11, in <module>
load_entry_point('PBI-telegrambot==0.0.1', 'console_scripts', 'PBI_telegrambot')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2451, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/bin/telegram_bot.py", line 4, in <module>
import('pkg_resources').run_script('PBI-telegrambot==0.0.1', 'telegram_bot.py')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/telegram_bot.py' not found in metadata at '/home/user/.local/lib/python3.8/site-packages/PBI_telegrambot-0.0.1.dist-info'
Would be grateful for your help!
I try to make a project with pip:
pip install ., but have the same problem
pip installfrom insidesetup.pyis just crazy.PBI_telegrambot, it has been written in last option: entry points of function "setup.setup.pydoesn't start anything. You definedPBI_telegrambotas an entry point; for itsetuptoolscreates a script that tries to importtelegram_botand call itsmain()— and failed because yourtelegram_botis not an importable module. You cannot import from a script. A script is there to run directly, not to be used in entry points.