Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated Package Installations on Every Run #14

Open
lewislovelock opened this issue Jun 6, 2024 · 0 comments
Open

Repeated Package Installations on Every Run #14

lewislovelock opened this issue Jun 6, 2024 · 0 comments

Comments

@lewislovelock
Copy link

Description:

Every time I run the example script, the Tiger tools attempt to install packages via pip. This process is not only time-consuming but also not user-friendly, especially for those who frequently run the script.

Upsonic active                                                                                                                                                  on_prem.py:130
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting AppOpener==1.7
  Using cached appopener-1.7-py3-none-any.whl.metadata (4.0 kB)
...
...
Requirement already satisfied: pycparser in /opt/homebrew/Caskroom/miniforge/base/envs/demoplay/lib/python3.11/site-packages (from cffi>=1.12.0->curl-cffi>=0.6.2->duckduckgo-search==5.3.0) (2.22)
[DEBUG]: == Working Agent: Senior Research Analyst
[INFO]: == Starting Task: Who is Onur Atakan ULUSOY

Expected Behavior:

Packages should only be installed once, and subsequent runs of the script should not attempt to reinstall these packages.

Actual Behavior:

The script attempts to install packages every time it is run.

Possible Solution:

Consider checking if the required packages are already installed before attempting to install them. This can be done using pkg_resources in Python to check if a package is installed.

Here's a sample code snippet:

import pkg_resources

REQUIRED_PACKAGES = ['AppOpener==1.7', 'duckduckgo-search==5.3.0']

for package in REQUIRED_PACKAGES:
    try:
        dist = pkg_resources.get_distribution(package)
        print('{} ({}) is installed'.format(dist.key, dist.version))
    except pkg_resources.DistributionNotFound:
        print('{} is NOT installed'.format(package))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant