Not sure if this is the right way to reopen this issue.
Not sure if this is the right way to reopen this issue.
I followed the Installing the AWS SAM CLI on Linux steps with Homebrew for Linux (Ubuntu 20), but after a successfull installation, I got a command not found error when tried: sam --version
So I did brew uninstall aws-sam-cli, and then tried:
git clone https://github.com/awslabs/aws-sam-cli.git
cd aws-sam-cli
sudo python3 ./setup.py build install
I have this Python:
$ python3 --version
Python 3.8.5
Everything seemed well until I got this:
Installed /usr/local/lib/python3.8/dist-packages/aws_sam_cli-1.15.0-py3.8.egg
Processing dependencies for aws-sam-cli==1.15.0
error: six 1.14.0 is installed but six~=1.15 is required by {'aws-sam-translator'}
(first two lines for context)
Then I tried this:
$ sam --version
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/sam", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 586, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
Could you please support me with this issue? I'm trying to set up my environment properly, in order to run locally a lambda function written in TypeScript over Node.js
Thanks in advance!
Originally posted by @pequetreques in https://github.com/aws/aws-sam-cli/issues/922#issuecomment-769597027
Hi @pequetreques,
Can you please try running brew install aws-sam-cli twice? I have seen this issue before. Sometimes with Linuxbrew we need to run the command twice to make it available in path.
Sample:
ubuntu@ip-172-31-37-116:~$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
...
...
...
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/home/ubuntu/.linuxbrew/opt/[email protected]/lib/pkgconfig"
ubuntu@ip-172-31-37-116:~$ sam
Command 'sam' not found, but there are 17 similar ones.
ubuntu@ip-172-31-37-116:~$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
==> Downloading https://github.com/aws/aws-sam-cli/releases/download/v1.15.0//aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
Already downloaded: /home/ubuntu/.cache/Homebrew/downloads/e81c9dc684b954ba1b6e8bd14a46da3b2ea3619bd5cf0e2514025ad392c678aa--aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
==> Pouring aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
🍺 /home/ubuntu/.linuxbrew/Cellar/aws-sam-cli/1.15.0: 3,951 files, 91.4MB
ubuntu@ip-172-31-37-116:~$ sam
Usage: sam [OPTIONS] COMMAND [ARGS]...
AWS Serverless Application Model (SAM) CLI
...
@c2tarun First of all, thanks for your time, I appreciate it! : ) I did it:
edgar.fuentes@MX-IT03050:~$ brew install aws-sam-cli
Updating Homebrew...
==> Installing aws-sam-cli from aws/tap
==> Downloading https://linuxbrew.bintray.com/bottles/python%403.8-3.8.7.x86_64_linux.bottle.tar.gz
Already downloaded: /home/edgar.fuentes/.cache/Homebrew/downloads/da0892d7e87b76e4abe55d19d9b8f9ce915969979965cf9659557828484a2ab4--python@3.8-3.8.7.x86_64_linux.bottle.tar.gz
==> Downloading https://github.com/aws/aws-sam-cli/releases/download/v1.15.0//aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
Already downloaded: /home/edgar.fuentes/.cache/Homebrew/downloads/e81c9dc684b954ba1b6e8bd14a46da3b2ea3619bd5cf0e2514025ad392c678aa--aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
==> Installing dependencies for aws/tap/aws-sam-cli: [email protected]
==> Installing aws/tap/aws-sam-cli dependency: [email protected]
==> Pouring [email protected]_64_linux.bottle.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/pytho
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/pytho
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.8.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/home/linuxbrew/.linuxbrew/Cellar/pytho
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin
You can install Python packages with
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
[email protected] is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH, run:
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/bin:$PATH"' >> ~/.profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig"
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.8.7: 4,147 files, 76.8MB
==> Installing aws/tap/aws-sam-cli
==> Pouring aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.15.0: 3,951 files, 91.4MB
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
==> Reinstalling 1 broken dependent from source:
aws/tap/aws-sam-cli
==> Caveats
==> [email protected]
Python has been installed as
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin
You can install Python packages with
/home/linuxbrew/.linuxbrew/opt/[email protected]/bin/pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.8/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
[email protected] is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH, run:
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/bin:$PATH"' >> ~/.profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig"
edgar.fuentes@MX-IT03050:~$ sam
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/sam", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 586, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
edgar.fuentes@MX-IT03050:~$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
==> Downloading https://github.com/aws/aws-sam-cli/releases/download/v1.15.0//aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
Already downloaded: /home/edgar.fuentes/.cache/Homebrew/downloads/e81c9dc684b954ba1b6e8bd14a46da3b2ea3619bd5cf0e2514025ad392c678aa--aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
==> Pouring aws-sam-cli-1.15.0.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.15.0: 3,951 files, 91.4MB
edgar.fuentes@MX-IT03050:~$ sam
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/sam", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 586, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.14.0 (/usr/lib/python3/dist-packages), Requirement.parse('six~=1.15'), {'aws-sam-translator'})
Alas with no luck again. : (
Hey @pequetreques it looks like you have another package installed which strictly requires six 1.14.0 or less. Can you use pipdeptree to print the dependency tree and check which package requires six 1.14.0?
@pequetreques
It seems that it is still attempting to run the sam you installed with sudo python3 ./setup.py build install.
It is this one that was installed in your Python env and is conflicting with the six version you have installed there.
I think you should remove it first.
Then uninstall/cleanup the sam you installed with brew.
Then try installing sam through brew again. (You may have to run the command twice at this point)
Let us know how it goes.
There is a pyinstaller solution to install AWS SAM CLI on linux: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html
Please try that out, it should be completely isolated binary install.