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

Invalid Syntax in Entry Point Scripts #5161

Closed
m-navarro93 opened this issue Jan 31, 2024 · 1 comment
Closed

Invalid Syntax in Entry Point Scripts #5161

m-navarro93 opened this issue Jan 31, 2024 · 1 comment
Labels
locked [bot] locked due to inactivity source::anaconda created by members of Anaconda, Inc. stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere

Comments

@m-navarro93
Copy link

m-navarro93 commented Jan 31, 2024

What Happened?

The generated script for the specified entry point is generated with invalid syntax. This causes the command to error out and not work. The syntax violations are extra quotes in the from app import run and sys.exit(run()) lines. The following is the script generated when using the conda build process with the meta.yaml file.

Fixing the invalid syntax results in the entry point script working correctly. At the very least, this means that everything is setup correctly when the conda package is built and installed. I have been using the following commands when building and installing the conda package locally:

  • Build: conda build conda.recipe --output-folder output
  • Install: conda install --use-local package-name
#!/Users/mnavarro/anaconda3/envs/test-env/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys

from "app import run"

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(run"())

meta.yaml

{% set pyproj = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
{% set project = pyproj.get('project') %}

package:
  name: aug
  version: 0.4.2

source:
  path: ../

build:
  noarch: python
  number: 0
  script: python -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
  entry_points:
    - aug = app:run

requirements:
  host:
    - python=3.9
    - pip
    - setuptools
  run:
    - python==3.9
    - fastapi==0.95.0
    - uvicorn==0.21.1
    - backoff==2.2.1
    - openai==1.9.0
    - tiktoken==0.3.3
    - pydantic==1.10.8
    - langchain==0.1.4
    - langchain-community==0.0.16
    - langchain-core==0.1.16
    - langsmith==0.0.83
    - launchdarkly-server-sdk==8.1.4
    - ddtrace==1.11.2
    - mypy==1.1.1
    - cachetools==5.3.0
    - types-cachetools==5.3.0

channels:
  - conda-forge
  - defaults

about: ...

What Should Have Happened?

The generated script should be generated with valid syntax. Below is an example of the same script generated using a pyproject.toml build process.

#!/Users/mnavarro/anaconda3/envs/test-env/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
from app import run
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(run())

Conda Details

conda info
active environment : test-env
    active env location : /Users/mnavarro/anaconda3/envs/test-env
            shell level : 2
       user config file : /Users/mnavarro/.condarc
 populated config files : /Users/mnavarro/.condarc
          conda version : 23.11.0
    conda-build version : 3.28.4
         python version : 3.11.5.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m2
                          __conda=23.11.0=0
                          __osx=14.3=0
                          __unix=0=0
       base environment : /Users/mnavarro/anaconda3  (writable)
      conda av data dir : /Users/mnavarro/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/anaconda-cloud/osx-arm64
                          https://conda.anaconda.org/anaconda-cloud/noarch
          package cache : /Users/mnavarro/anaconda3/pkgs
                          /Users/mnavarro/.conda/pkgs
       envs directories : /Users/mnavarro/anaconda3/envs
                          /Users/mnavarro/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.11.0 requests/2.31.0 CPython/3.11.5 Darwin/23.3.0 OSX/14.3 solver/libmamba conda-libmamba-solver/23.11.0 libmambapy/1.5.3 aau/0.4.2 c/LWkq5XB6fmUnHkqOBHOZjQ s/AOwlWuOlNLeel9Z6UuoCbw e/QbtH_TInxHJegDUD0ghjOg
                UID:GID : 502:20
             netrc file : None
           offline mode : False
conda config
==> /Users/mnavarro/.condarc <==
channels:
  - conda-forge
  - defaults
  - anaconda-cloud
conda list
# packages in environment at /Users/mnavarro/anaconda3/envs/test-env:
#
# Name                    Version                   Build  Channel
archspec                  0.2.2              pyhd8ed1ab_0    conda-forge
attrs                     23.2.0             pyh71513ae_0    conda-forge
beautifulsoup4            4.12.3             pyha770c72_0    conda-forge
boltons                   23.1.1             pyhd8ed1ab_0    conda-forge
brotli-python             1.1.0            py39hb198ff7_1    conda-forge
bzip2                     1.0.8                h93a5062_5    conda-forge
c-ares                    1.26.0               h93a5062_0    conda-forge
ca-certificates           2023.11.17           hf0a4a13_0    conda-forge
cctools                   973.0.1             hd1ac623_15    conda-forge
cctools_osx-arm64         973.0.1             h2a25c60_15    conda-forge
certifi                   2023.11.17         pyhd8ed1ab_0    conda-forge
cffi                      1.16.0           py39he153c15_0    conda-forge
chardet                   5.2.0            py39h2804cbe_1    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.11.0          py39h2804cbe_1    conda-forge
conda-build               3.28.4           py39h2804cbe_0    conda-forge
conda-index               0.3.0              pyhd8ed1ab_1    conda-forge
conda-libmamba-solver     24.1.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
filelock                  3.13.1             pyhd8ed1ab_0    conda-forge
fmt                       10.2.1               h2ffa867_0    conda-forge
icu                       73.2                 hc8870d7_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
importlib_resources       6.1.1              pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_0    conda-forge
jsonpointer               2.4              py39h2804cbe_3    conda-forge
jsonschema                4.21.1             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.12.1          pyhd8ed1ab_0    conda-forge
krb5                      1.21.2               h92f50d5_0    conda-forge
ld64                      609                 h89fa09d_15    conda-forge
ld64_osx-arm64            609                 hc4dc95b_15    conda-forge
libarchive                3.7.2                hcacb583_1    conda-forge
libcurl                   8.5.0                h2d989ff_0    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h93a5062_2    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libiconv                  1.17                 h0d3ecfb_2    conda-forge
liblief                   0.12.3               hb7217d7_0    conda-forge
libllvm15                 15.0.7               h2621b3d_4    conda-forge
libmamba                  1.5.6                h90c426b_0    conda-forge
libmambapy                1.5.6            py39ha004b9d_0    conda-forge
libnghttp2                1.58.0               ha4dd798_1    conda-forge
libsolv                   0.7.27               h9e231a4_0    conda-forge
libsqlite                 3.44.2               h091b4b1_0    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libxml2                   2.12.4               h0d0cfa8_1    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
lzo                       2.10              h642e427_1000    conda-forge
markupsafe                2.1.4            py39h17cfd9d_0    conda-forge
menuinst                  2.0.2            py39h2804cbe_0    conda-forge
more-itertools            10.2.0             pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h463b476_2    conda-forge
openssl                   3.2.1                h0d3ecfb_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
patch                     2.7.6             h27ca646_1002    conda-forge
pip                       23.3.2             pyhd8ed1ab_0    conda-forge
pkginfo                   1.9.6              pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.4.0              pyhd8ed1ab_0    conda-forge
psutil                    5.9.8            py39h17cfd9d_0    conda-forge
py-lief                   0.12.3           py39h23fbdae_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6            py39h0f82c59_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.9.18          hd7ebdb9_1_cpython    conda-forge
python-libarchive-c       5.0              py39h2804cbe_2    conda-forge
python_abi                3.9                      4_cp39    conda-forge
pytz                      2023.4             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1            py39h0f82c59_1    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
referencing               0.33.0             pyhd8ed1ab_0    conda-forge
reproc                    14.2.4.post0         h93a5062_1    conda-forge
reproc-cpp                14.2.4.post0         h965bd2d_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ripgrep                   14.1.0               h5ef7bb8_0    conda-forge
rpds-py                   0.17.1           py39h8fec3ad_0    conda-forge
ruamel.yaml               0.18.5           py39h17cfd9d_0    conda-forge
ruamel.yaml.clib          0.2.7            py39h0f82c59_2    conda-forge
setuptools                69.0.3             pyhd8ed1ab_0    conda-forge
sigtool                   0.1.3                h44b9a77_0    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
tapi                      1100.0.11            he4954df_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tqdm                      4.66.1             pyhd8ed1ab_0    conda-forge
tzdata                    2023d                h0c530f3_0    conda-forge
urllib3                   2.2.0              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
yaml-cpp                  0.8.0                h13dd4ca_0    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zstandard                 0.22.0           py39h4818f0e_0    conda-forge
zstd                      1.5.5                h4f39d0f_0    conda-forge
@m-navarro93 m-navarro93 added the type::bug describes erroneous operation, use severity::* to classify the type label Jan 31, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Jan 31, 2024
@kenodegard kenodegard added source::anaconda created by members of Anaconda, Inc. type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere and removed type::bug describes erroneous operation, use severity::* to classify the type labels Feb 9, 2024
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label May 10, 2024
@github-actions github-actions bot added the stale::closed [bot] closed after being marked as stale label May 31, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to 🏁 Done in 🧭 Planning May 31, 2024
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Nov 27, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity source::anaconda created by members of Anaconda, Inc. stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity type::support neither a bug nor feature, is really just a user having questions or difficulty somewhere
Projects
Archived in project
Development

No branches or pull requests

2 participants