Elastic Beanstlak CLI Installation Error - python

I downloaded the EBCLI with sudo pip install awsebcli --upgrade --user
When running eb --version I get the following error.
Traceback (most recent call last):
File "/home/andrew/.local/bin/eb", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/usr/local/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: awsebcli==3.12.4
Any ideas?
Edit:
Here is my pip --version:
pip 9.0.3 from /usr/local/lib/python2.7/dist-packages (python 2.7)

The problem is that you installed awsebcli as the root user, but performed eb --version as a non-root user. So, as far as the non-root user is concerned, awsebcli never got installed.
To run eb as a non-root user:
pip install awsebcli (without the sudo)
To verify this worked, find awsebcli in the output of pip list
If 1. causes you a problem, I recommend installing the awsebcli after setting up a virtualenv. Basically, virtualenv compartmentalizes your Python packages so you do not mess with the system's version of Python and the root user.

Related

How to install and run virtualenv on MacOS correctly

Hi I'm a beginner of python, I don't remember when and how I installed python3.8 on my Macbook air, only knew the installed path:
% which python
/usr/bin/python
% which python3
/usr/local/bin/python3
The pip command cannot not be found but pip3 is ok. Today I want to install virtaulenv:
% sudo -H pip3 install virtualenv
WARNING: Ignoring invalid distribution - (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages)
Successfully installed virtualenv-20.6.0
I can use "pip3 show virtualenv" to know the info:
% pip3 show virtualenv
Name: virtualenv
Version: 20.6.0
Summary: Virtual Python Environment builder
Home-page: https://virtualenv.pypa.io/
Author: Bernat Gabor
Author-email: gaborjbernat#gmail.com
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
Requires: six, platformdirs, backports.entry-points-selectable, distlib, filelock
Required-by:
But when I use "virtualenv" I got command not found message then I "pip3 uninstall" it. I searched for this and got a tip to use "easy_install" to install virtualenv. After installed I can execute the command, but got some error message:
% virtualenv
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib-resources>=1.0' distribution was not found and is required by virtualenv
It seems doesn't work and I try the "sudo pip3 uninstall virtualenv" to uninstall it successfully, but it seems not really be removed:
% which virtualenv
/usr/local/bin/virtualenv
I have no idea about this, could you help me? I just want to run virtualenv normally and create flask project ...
PS. I can "sudo pip3 install flask" and "pip3 show flask" but still cannot run flask cammand (command not found), what should I do?
Thanks a lot!
try being explicit in the version of python you are using and install using -m pip instead
python3 -m pip install virtualenv
python3 -m virtualenv venv # create a new venv in ./venv
source ./venv/bin/activate # activate your new venv
often times the pip/pip3 just isnt pointing at the same python version you think you are using... by using this technique you are sure to be using the correct python and pip

Manually installing python dependencies doesn't work. Why?

Whenever I install my python project using 'python setup.py install', and invoke my project on a CentOS vagrant box, it works great. The dependencies get resolved perfectly.
However, if I create an rpm using fpm for my project, install the rpm using 'rpm -i rpm-file.rpm', manually install the dependencies using 'pip install -r requirements-file-path.txt' and then invoke my project on another CentOS vagrant box, I get the following error:
File "/usr/bin/<name-of-my-project>", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: fabric==1.10.2
Uninstalling the dependencies using 'pip uninstall' and reinstalling them doesn't fix the problem. What am I missing?
Just found the answer on the Fabric FAQ page: http://www.fabfile.org/faq.html/. Executing:
sudo pip install -U setuptools
Then re-installing the dependencies and project solved my problem. But welcome to other answers.

Python DistributionNotFound Error after installing EB CLI 3.0

Have tried many things, but keep getting this error after multiple attempts to update python, pip, etc. I am on OS X running 10.9.5.
CMD% eb
Traceback (most recent call last):
File "/usr/local/bin/eb", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: python-dateutil>=2.1,<3.0.0
I was experiencing a similar error when trying to run eb, though not for dateutil...
Traceback (most recent call last):
File "/usr/local/bin/eb", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: requests>=2.6.1,<2.7
For me the solution was to update setuptools:
sudo pip install --upgrade setuptools
Hope that helps somebody.
Use the following command:
pip install awsebcli
It will automatically upgrade all dependecies of awsebcli.
use the following command
sudo pip install python-dateutil
to upgrade it
Pip is probably linked to a different version of python then standard.
You should try installing pip using
python get-pip.py
(You can download get-pip.py from the pip website)
Otherwise, You can see which Python everything is linked too.
which python
head -1 $(which eb)
head -1 $(which pip)
You can change to shebang line in the eb script to match pip and it should all work.
You can also install using a virtualenv (pythons recommended way of installing)
virtualenv ~/ebenv
source ~/ebenv/bin/activate
pip install awsebcli
deactivate
sudo ln -s ~/ebenv/bin/eb /usr/local/bin/
in my case on mac osx 10.10, I had to reinstall.
sudo pip install python-dateutil
Just in case some runs into this type of error. check the last paragraph in the trace for the kind of error that it is being raised. In my case, this was:
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.4.1
(/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python),
Requirement.parse('six>=1.5'), set(['python-dateutil']))
I had the exact same issue, for me, the eb script was using the wrong python. To solve it I just modified the eb script:
> which eb
/usr/local/bin/eb
> sudo vim /usr/local/bin/eb
## Change the first line from '#!/usr/bin/python' to '#!/usr/local/bin/python'
After restarting the terminal, everything work as expected.
From the raised error in your log, it needs python-dateutil>=2.1.
So you need to make sure that version is installed and install it if not. I had similar issue, and the solution (in my case) is:
$ pip install --ignore-installed python-dateutil==2.2

python - easy_install stops working after distribute upgrade

When trying to install a package easy_install asked me to upgrade distribute:
The required version of distribute (>=0.6.35) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
This seemed to work fine:
$ easy_install -U distribute
Searching for distribute
Reading http://pypi.python.org/simple/distribute/
Best match: distribute 0.7.3
Processing distribute-0.7.3-py2.7.egg
Removing distribute 0.6.28 from easy-install.pth file
Adding distribute 0.7.3 to easy-install.pth file
Using /xxx/software/lib/python2.7/site-packages/distribute-0.7.3-py2.7.egg
Processing dependencies for distribute
Finished processing dependencies for distribute
But now when I start easy_install I get this:
$ easy_install
Traceback (most recent call last):
File "/xx/software/bin/easy_install", line 9, in <module>
load_entry_point('distribute', 'console_scripts', 'easy_install')()
File "/xx/software/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/xx/software/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg/pkg_resources.py", line 2393, in load_entry_point
raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'easy_install') not found
What happened? How do I fix this
Try updating your setup tools manually.
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py --user
Following an answer on a different question about pip vs. easy_install, you can uninstall a package that was installed with easy_install using pip:
sudo pip uninstall distribute
This removed the offending version of distribute, and easy_install works again.
I had same problem, then i found that there is easy_install-2.7 and I can install packages properly.

Easy_install and Pip doesn't work

Easy_install and Pip doesn't work anymore on python 2.7, when I try to do:
sudo easy_install pip
I get:
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
parse_requirements(__requires__), Environment()
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.15
And when I try:
sudo pip install [package]
I get:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 2713, in <module>
parse_requirements(__requires__), Environment()
File "/usr/bin/lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==0.8.2
I've already install both of them (and yes, first deleted them), but no result...
Thanks!
(I tried already this post)
I had this issue where python's distribute package wasn't installed for some reason. After following the instructions on python-distribute, i got it working.
install the distribute package as follows:
$ wget https://web.archive.org/web/20100225231201/http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
EDIT: http://python-distribute.org/distribute_setup.py no longer works:
hopefully this will resolve your problem with running
$ sudo easy_install
Happy Coding!
If you installed a new version of easy_install through Distribute, the new command may have been installed in another directory, most likely /usr/local/bin/. But the traceback shows you were using /usr/bin/easy_install. Try this:
sudo /usr/local/bin/easy_install ...
Try
sudo easy_install Distribute
and if that exists, but is too old
sudo easy_install -U Distribute
Looks like either Distribute/setuptools (it's old name) is messed up or Python package settings. If either of these do not help, try removing the full Python 2.7 installation and reinstall everything from the scratch.
Possible reasons for the mess is that you have used both sudo easy_install / sudo pip and Linux distribution packages to mix and match system-wide installation packages. You should use virtualenv instead if you use pip/easy_install (no sudo needed)
http://pypi.python.org/pypi/virtualenv
I had a similar problem, but things were working fine as root. In my case, I found that the permissions on the python packages were not readable by the ID I was running the command under.
To correct it, I ran the following command to open the permission for read and execute to all users:
sudo chmod o+rx -R /usr/local/lib/python2.7/dist-packages/*.egg
I had similar issue when trying to install package via pip with python 3.6 on windows. (pip is supposed to work out of the box with this install)
The problem was not running as administrator.
Running cmd as administrator and then installing my package worked:
python -m pip install pylint
I was trying to get pip to work on the 2.7.0 version, but it seems like it doesn't come with the easy_install/pip files (Script folder in main directory), installing 2.7.13 solved the problem for me.

Categories