I was using the elastic beanstalk cli with AWS without any difficulty a few months ago. I wanted to update my website and ran into this error:
me$ eb status Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/2.7/bin/eb", line 5, in
from pkg_resources import load_entry_point File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 3095, in
#_call_aside File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 3081, in _call_aside
f(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 3108, in _initialize_master_working_set
working_set = WorkingSet._build_master() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 660, in _build_master
return cls._build_from_requirements(requires) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 673, in _build_from_requirements
dists = ws.resolve(reqs, Environment()) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py",
line 846, in resolve
raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'blessed==1.9.5' distribution
was not found and is required by awsebcli
I haven't been able to find anything about this error, except for a question about how to deal with a similar problem on ubuntu (I'm on a Mac) that has gone unanswered for a month.
Does anyone have any ideas?
This is most likely caused by the fact that the eb script is using Apple's Python interpreter instead of the one you installed yourself.
There are two workarounds:
1. Run the EB CLI in a virtual environment
Create a virtual environment for the EB CLI by running virtualenv ~/eb_cli_env.
Run source ~/eb_cli_env/bin/activate to activate the created virtual environment.
Run pip install awsebcli.
After that, you should be able to use the eb command just fine. You will have to run source ~/eb_cli_env/bin/activate every time before you can use the EB CLI.
--OR--
2. Edit the shebang line in the eb script
Run vim /usr/local/bin/eb.
Change the first line from #!/usr/bin/python to #!/usr/bin/env python.
This will ensure the eb command works globally without using a virtual environment, however it is very likely that if you upgrade the awsebcli package you will have to edit the shebang line again.
My suggestion is to install by brew on osx.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html#eb-cli3-install-osx
In my case I remove my previous installation by pip:
pip uninstall awsebcli
and run
brew install awsebcli
sudo pip install https://pypi.python.org/packages/2.7/b/blessed/blessed-1.9.5-py2.py3-none-any.whl
All I could find
Related
ive updated to python3 and downloaded virtualenv using:
sudo /usr/bin/easy_install virtualenv
when i go to start the virtualenv i got the following error message :
virtualenv project1
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 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
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 'zipp>=0.4' distribution was not found and is required by importlib-resources
i looked around and realised the that 'zipp' had not been installed so i installed that also. when i went to run the virtualenv again i got the same error message again as above. and for some reason it keeps referencing python 2.7 even though ive upgraded to python3.
please try this ..
you just follow Exactly the bellow Items :
Open your Command Prompt AS ADMINISTRATOR -> right click on CMD and RUN AS ADMINISTRATOR
go to which Folder to you want to create your VirtualENV : For example : > Cd C:\Users...\Documents\python\src
type it : PIP install Virtualenv
make sure your internet connection is Ok
4.type : python -m venv env
and then you can create your project inside this env folder..
all Comment code should be write in Command Prompt AS Administrator
i ended up using the built in python 3 venv package. it works just as well and it was straight forward and simple. thank you for all the help
start the virtual environment: python3 -m venv project1
activate the virtual environment: source project1/bin/activate
deactivate the virtual environment: deactivate
If you're using Python 3.3 or later, you can use the built-in venv [https://docs.python.org/3/library/venv.html] module. This will reduce the number of dependencies, making installation and troubleshooting a bit easier.
To double-check that you are invoking the correct Python interpreter, run python3 -V or python -V (depending on how it's aliased).
Just try out.
virtualenv venv
It should create a venv directory in same directory if python 3.x is being used.
From my understanding, tkinter comes pre-installed with python. I can't, for the life of my, understand why every IDE I have tried to run tkinter on isn't recognizing tkinter as a library.
I have tried:
import tkinter as tk
import Tkinter as tk
import * from tkinter
from tkinter import *
import tkinter
import Tkinter
and everything else in between...
The whole snipit I am trying to run:
import Tkinter
top = Tkinter.Tk()
top.mainloop()
Whenever I try to run it in VIM the error message is:
Traceback (most recent call last):
File "tktest.py", line 1, in <module>
import Tkinter
File "usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named_tkinter, please install the python-tk package
shell returned 1
Do I need vim to be running python3 in vim (which I thought was default) if so, how do I do that?
I have even tried to install tkinter like it says but I get this large error message:
ken#ken-HP-ENVY-Laptop-13-ah1xxx:~$ pip install Tkinter
Collecting Tkinter
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 795, in get_page
resp.raise_for_status()
File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/tkinter/
It looks like I am running python2.7 on my system by default and I don't know why... how do I get python3.7(or latest version) to be my default for my machine?
For the record, I am using Linux Mint 19.3 Tricia
Try running Python 3 in a virtual environment:
Open a terminal, go to your project directory and run
$ python3 -m venv venv
which will create a virtual environment called venv in your project directory.
To activate it, go to your project directory and run $ source venv/bin/activate
Your bash prompt should now read (venv) $ and any work you do will take place inside a virtual environment.
Once you're done working inside the venv, you want to deactivate it. To deactivate, type $ deactivate
NOW, once your virtual environment is active you have a clean, package-free install of Python 3.x where x is whatever version you have installed and aliased to python3.
From in here, you can upgrade pip: $ pip install -U pip, re-install all the packages you want from a requirements.txt file: $ pip install -r requirements.txt, and install any other single packages you need with pip as usual.
Anything you install in your virtual environment will only scope into your virtual environment, so you can use this as a test bed, and destroy/rebuild as you see fit. This is advantageous for a lot of reasons.
Once you've done this, try launching vim from inside your virtual environment, then try running your code from inside the virtual environment. Once inside your venv, the only Python your terminal knows about is the one inside the venv. So it should default to that one.
I have just downloaded python 3.6.1 from github and built it in a local dir. Now I am trying to make a virtualenv with that version of python but I keep getting:
Running virtualenv with interpreter /home/giorgio/tools/cpython-3.6.1/python
Using base prefix '/usr/local'
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 2462, in <module>
main()
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 762, in main
symlink=options.symlink,
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 998, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1219, in install_python
copy_required_modules(home_dir, symlink)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1147, in copy_required_modules
dst_filename = change_prefix(filename, dst_prefix)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1111, in change_prefix
assert False, "Filename {} does not start with any of these prefixes: {}".format(filename, prefixes)
AssertionError: Filename /home/giorgio/tools/cpython-3.6.1/Lib/os.py does not start with any of these prefixes: ['/usr/local', '/usr/local']
I don't want to install this version of python globally on the system. Is there another way to make virtualenv work with it?
I think Python 3.6 introduced a new way of creating virtual environments that don't depend on routing through usr/local.
python3 -m venv /path/to/new/virtual/environment
Here is documentation.
I ran into this error attempting to use my brew-installed version of Python 3.9.5 to create a new virtual environment on macOS. (mkvirtualenv with virtualenvwrapper)
My command format is typically:
mkvirtualenv -p python3 [env-name]
Not sure what caused this to get messed up, but ultimately I got it working again by running:
python3.9 -m venv ~/.virtualenvs/myenvname
This puts the env in your normal spot, and you can still run workon myenvname
The right way to achieve this is to set the prefix when you configure the build options to be a local directory and then perform make install. So if the directory you want to install things at is $HOME/pythons then in the build directory run:
./configure --prefix="${HOME}/pythons"
make
make install
Hy Everyone,
I try to install a script on my server using a terminal but due the installation I get an error. I will past here, the last lines of terminal.
Traceback (most recent call last):
File "/usr/bin/paster", line 4, in
command.run()
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 93, in run
commands = get_commands()
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 135, in get_commands
plugins = pluginlib.resolve_plugins(plugins)
File "/usr/lib/python2.7/dist-packages/paste/script/pluginlib.py", line 82, in resolve_plugins
pkg_resources.require(plugin)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: httpagentparser==1.7.8: Not Found for: r2 (did you run python setup.py develop?)
oneprovider#dedi-fr-20388:~$
Can someone help me to fix it ? Should install python develop ? If yes, how ? :D
As the error message is quite clear: httpagentparser is not installed https://pypi.python.org/pypi/httpagentparser
You should install it first, maybe it's available in the ubuntu software center. Else install via pip:
pip install httpagentparser
And if you don't know pip and/or have pip not installed. See https://pip.pypa.io/en/stable/installing/
Let me start by saying I'm new at programming, mac osx, and bash.
I'm having a tough time getting virtualenvwrapper setup on my Mac osx 10.7.3.
Its most certainly a path settings issue but I'm just having trouble getting it working.
Setup of virtualenvwrapper in .bashrc
export WORKON_HOME=$HOME/.Apps
source /usr/local/bin/virtualenvwrapper.sh
Some terminal output:
which easy_install
/usr/bin/easy_install
python -V
Python 2.7.1
When I run "source .bashrc" in the terminal I get no output.
When I run mkvirtualenv in the terminal I get:
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python #executable_path/../.Python 1/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.7.1.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 928, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 1029, in create_environment
site_packages=site_packages, clear=clear))
File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 1347, in install_python
py_executable])
File "/Library/Python/2.7/site-packages/virtualenv-1.7.1.2-py2.7.egg/virtualenv.py", line 966, in call_subprocess
cwd=cwd, env=env)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 2] No such file or directory
You probably just need to install XCode. It should be a free (if large) download/install from the App Store.
For future reference, I highly recommend using a package manager and pip (instead of easy_install) for python development on OS X. My preferred package manager is Homebrew, but MacPorts and Fink are also good. Among other things, pip lets you uninstall stuff, which easy_install cannot simply do.