Open lrbn86 opened 1 year ago
Hi there,
It seems like this issue has been reported before and this was the fix for the previous customer: https://github.com/aws/aws-sam-cli/issues/2899#issuecomment-848944826
I've tried to reproduce on my Windows machine with 1.98.0 version, but I was able to run build without any problems. Can you provide more details of your setup so that we can re-produce on our side?
Thanks
Hi,
I have Python 3.12.0 and I do not have Docker installed. I installed SAM CLI via the msi download. I have turned off the App execution aliases for Python and set the PATH for Python . I installed pywin32 via pip:
pip list
Package Version
------- -------
pip 23.2.1
pywin32 306
I did the following on Command Prompt on admin:
C:\Users\Brandon\AppData\Local\Programs\Python\Python312\Scripts>py pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Users\\Brandon\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages')
Copied pythoncom312.dll to C:\WINDOWS\system32\pythoncom312.dll
Copied pywintypes312.dll to C:\WINDOWS\system32\pywintypes312.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.12\Help[None]=None
-> Software\Python\PythonCore\3.12\Help\Pythonwin Reference[None]='C:\\Users\\Brandon\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\PyWin32.chm'
Registered help file
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.
On Git Bash, I made a new project via sam init
with the same config on my desktop and still received the same error with sam build
:
sam-app> sam.cmd build
Error: Install pypiwin32 package to enable npipe:// support
Traceback:
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 783,
in invoke
return __callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\cli\cli_config_file.py", line 297, in wrapper
return func(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 783,
in invoke
return __callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 184, in wrapped
raise exception # pylint: disable=raising-bad-type
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 149, in wrapped
return_value = func(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\version_checker.py", line 42, in wrapped
actual_result = func(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\cli\main.py", line
95, in wrapper
return func(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\command.py", line 171, in cli
do_cli(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\command.py", line 260, in do_cli
ctx.run()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\build_context.py", line 256, in run
builder = ApplicationBuilder(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 162, in __init__
self._docker_client = docker_client if docker_client else docker.from_env(version=DOCKER_MIN_API_VERSION)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\client.py", line 96, in from_env
return cls(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 164, in __init__
raise DockerException(
An unexpected error was encountered while executing "sam build".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20build%20-%20DockerException
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20build%20-%20DockerException
This is my project structure after running sam build
in Command Prompt:
C:\Users\Brandon\Desktop\sam-app>tree /f /a
| .gitignore
| README.md
| template.yaml
|
+---.aws-sam
| \---build
+---events
| event.json
|
\---hello-world
| .npmignore
| app.mjs
| package.json
|
\---tests
\---unit
test-handler.mjs
I'm also facing similar problem. Any updates on this ?
Hi - downgrade to SAMCLI v.1.114.0 (others may work but I've not tested). I had the same error after I'd uplifted from Python 3.9 to 3.12 and wasted a lot of time on pypiwin32 versioning to align correctly. On closer reading of the stack trace it appeared the error was wholly contained within the SAMCLI install which reminded me that at the same time I'd also upgraded SAMCLI to the latest version (1.124.0). When I reverted to 1.114.0 sam build worked fine again.
Hola, actualicé a SAMCLI v.1.114.0 (es posible que funcionen otras versiones, pero no las he probado). Tuve el mismo error después de actualizar de Python 3.9 a 3.12 y perdí mucho tiempo en el control de versiones de pypiwin32 para alinearlo correctamente. Al leer más de cerca el seguimiento de la pila, parecía que el error estaba completamente contenido dentro de la instalación de SAMCLI, lo que me recordó que al mismo tiempo también había actualizado SAMCLI a la última versión (1.124.0). Cuando volví a 1.114.0, la compilación de sam funcionó bien nuevamente.
Hi , how can install a custom version ? only with pip ?
If you want to install custom version, you can use winget
.
winget uninstall --id Amazon.SAM-CLI
winget show --id Amazon.SAM-CLI --version
# Maybe you can show installable version list.
winget install --id Amazon.SAM-CLI --version 1.114.0
Sorry if I make any mistakes, I don’t use English that often.
I faced this issue too on SAM-CLI (version 1.126.0) with both build and deploy commands. Removing and reinstalling older release as per @Nalagami worked for me too.
I installed one version prior too latest release -> 1.125.0.
A small comment on winget commands from @Nalagami
winget show -id Amazon.SAM-CLI --versions
--versions
is the right option too list available versions.
Thanks guys, it finally works. I have a problem with privileges on Windows, but after uninstalling aws cli and reinstalling it works fine, with version 1.114.0 for me.
I just installed 1.126.0 and ran into the same issue as well.
Uninstalling and installing 1.125.0 does resolve the issue.
winget uninstall --id Amazon.SAM-CLI
winget install --id Amazon.SAM-CLI --version 1.125.0
Description:
I am following the AWS SAM hello world app tutorial and I am stuck on step 2 of using the 'sam build'.
Steps to reproduce:
Observed result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.98.0Add --debug flag to command you are running