Zappa icon indicating copy to clipboard operation
Zappa copied to clipboard

pip-tools is not pinned in requirements.in, and pip-tools==6.2.0 breaks zappa update

Open wsbastian opened this issue 4 years ago • 2 comments

Context

  • setup.py references requirements.in: https://github.com/zappa/Zappa/blob/master/setup.py#L10
  • requirements.in does not pin pip-tools https://github.com/zappa/Zappa/blob/master/requirements.in#L22
  • pip-tools released 6.2.0 3 days ago, which added setuptools to setup.cfg https://github.com/jazzband/pip-tools/releases/tag/6.2.0
  • pip install zappa installs pip-tools 6.2.0
  • Zappa explicitly adds setuptools to its dependencies in create_handler_venv https://github.com/zappa/Zappa/blob/master/zappa/core.py#L495
  • Doing a zappa update {env} results in the error:
Double requirement given: setuptools (already in setuptools==47.1.0, name='setuptools')
...
...
web/venv/lib/python3.7/site-packages/zappa/core.py", line 440, in create_handler_venv
    raise EnvironmentError("Pypi lookup failed")
OSError: Pypi lookup failed

Expected Behavior

zappa update should work

Actual Behavior

zappa update does not work

Possible Fix

Options include:

  • pin deps in requirements.in,
  • reference requirements.txt in setup.py
  • remove manual injection of setuptools

Steps to Reproduce

Your Environment

  • Zappa version used: 0.52.0
  • Operating System and Python version:
  • The output of pip freeze:
  • Link to your project (optional):
  • Your zappa_settings.json:

wsbastian avatar Jun 25 '21 15:06 wsbastian

@wsbastian your version for setuptools should be similar to Zappa library

dineshssdn-867 avatar Aug 31 '21 15:08 dineshssdn-867

I am still experiencing this problem. Not clear on what the fix is, anyone able to offer a clearer solution? I tried pinning pip-tools to 6.1.0 as some other places suggested and it didn't work.

opalrose510 avatar Mar 13 '22 08:03 opalrose510

pip-tools is no longer a requirement of zappa, closing.

monkut avatar Aug 16 '22 05:08 monkut

@monkut I'm on the newest version of zappa (zappa~=0.55.0) and still have this error

C:\venvs\mhApp39\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Downloading and installing dependencies..
 - cryptography==36.0.2: Using locally cached manylinux wheel
 - pycryptodomex==3.15.0: Using locally cached manylinux wheel
 - psycopg2-binary==2.9.3: Using locally cached manylinux wheel
 - markupsafe==2.1.1: Using locally cached manylinux wheel
 - cffi==1.15.1: Using locally cached manylinux wheel
 - greenlet==1.1.3: Using locally cached manylinux wheel
Packaging project as gzipped tarball.
ERROR: To modify pip, please run the following command:
C:\venvs\mhApp39\Scripts\python.exe -m pip install --quiet --target C:\project\handler_venv\Lib\site-packages pip==22.2.2 botocore==1.27.66 hjson==3.1.0 tqdm==4.64.1 s3transfer==0.6.0 jmespath==1.0.1 charset-normalizer==2.1.1 six==1.16.0 certifi==2022.6.15 python-slugify==6.1.2 troposphere==4.1.0 cfn-flip==1.3.0 click==8.1.3 wsgi-request-logger==0.4.6 durationpy==0.5 Werkzeug==2.0.3 zappa==0.55.0 boto3==1.24.66 text-unidecode==1.3 colorama==0.4.5 idna==3.3 toml==0.10.2 PyYAML==6.0 kappa==0.6.0 python-dateutil==2.8.2 wheel==0.37.1 urllib3==1.26.12 placebo==0.9.0 argcomplete==2.0.0 requests==2.28.1 setuptools
Oh no! An error occurred! :(

==============

Traceback (most recent call last):
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 3033, in handle
    sys.exit(cli.handle())
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 517, in handle
    self.dispatch_command(self.command, stage)
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 559, in dispatch_command
    self.deploy(self.vargs["zip"], self.vargs["docker_image_uri"])
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 763, in deploy
    self.create_package()
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 2427, in create_package
    venv=self.zappa.create_handler_venv(use_zappa_release=use_zappa_release),
  File "C:\venvs\mhApp39\lib\site-packages\zappa\core.py", line 502, in create_handler_venv
    raise EnvironmentError("Pypi lookup failed")
OSError: Pypi lookup failed

JacobDel avatar Sep 04 '22 14:09 JacobDel

@monkut I'm on the newest version of zappa (zappa~=0.55.0) and still have this error

C:\venvs\mhApp39\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Downloading and installing dependencies..
 - cryptography==36.0.2: Using locally cached manylinux wheel
 - pycryptodomex==3.15.0: Using locally cached manylinux wheel
 - psycopg2-binary==2.9.3: Using locally cached manylinux wheel
 - markupsafe==2.1.1: Using locally cached manylinux wheel
 - cffi==1.15.1: Using locally cached manylinux wheel
 - greenlet==1.1.3: Using locally cached manylinux wheel
Packaging project as gzipped tarball.
ERROR: To modify pip, please run the following command:
C:\venvs\mhApp39\Scripts\python.exe -m pip install --quiet --target C:\project\handler_venv\Lib\site-packages pip==22.2.2 botocore==1.27.66 hjson==3.1.0 tqdm==4.64.1 s3transfer==0.6.0 jmespath==1.0.1 charset-normalizer==2.1.1 six==1.16.0 certifi==2022.6.15 python-slugify==6.1.2 troposphere==4.1.0 cfn-flip==1.3.0 click==8.1.3 wsgi-request-logger==0.4.6 durationpy==0.5 Werkzeug==2.0.3 zappa==0.55.0 boto3==1.24.66 text-unidecode==1.3 colorama==0.4.5 idna==3.3 toml==0.10.2 PyYAML==6.0 kappa==0.6.0 python-dateutil==2.8.2 wheel==0.37.1 urllib3==1.26.12 placebo==0.9.0 argcomplete==2.0.0 requests==2.28.1 setuptools
Oh no! An error occurred! :(

==============

Traceback (most recent call last):
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 3033, in handle
    sys.exit(cli.handle())
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 517, in handle
    self.dispatch_command(self.command, stage)
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 559, in dispatch_command
    self.deploy(self.vargs["zip"], self.vargs["docker_image_uri"])
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 763, in deploy
    self.create_package()
  File "C:\venvs\mhApp39\lib\site-packages\zappa\cli.py", line 2427, in create_package
    venv=self.zappa.create_handler_venv(use_zappa_release=use_zappa_release),
  File "C:\venvs\mhApp39\lib\site-packages\zappa\core.py", line 502, in create_handler_venv
    raise EnvironmentError("Pypi lookup failed")
OSError: Pypi lookup failed

I am stuck with this as well. Did you ever figure out a solution

Joshuamjv2 avatar Sep 25 '22 20:09 Joshuamjv2

@Joshuamjv2 No, I reduced the project size so that I could avoid that type of build. It only occurs when you add slim_handler

JacobDel avatar Sep 25 '22 21:09 JacobDel

@JacobDel yes it's true, I solved mine like this , slim handler do this error too

baraalmasri avatar Dec 21 '22 03:12 baraalmasri

I'm on Zappa 0.56.1, and still experiencing this issue. There's no way for me to reduce my project size to less than 50MB because of my virtual environment. Any suggestions to fix this without getting rid of slim handler?

mwhug avatar Mar 01 '23 18:03 mwhug

I'm on Zappa 0.56.1, and still experiencing this issue. There's no way for me to reduce my project size to less than 50MB because of my virtual environment. Any suggestions to fix this without getting rid of slim handler?

Yes, you can deploy with docker, which is also faster than loading from S3 (what slim handler does)

JacobDel avatar Mar 01 '23 18:03 JacobDel

see https://github.com/zappa/Zappa#docker-workflows

JacobDel avatar Mar 01 '23 18:03 JacobDel