Error after installing on Mac
TravelingTechGuy opened this issue · 12 comments
Installed using sudo -H pip install saws
, after seeing this comment:
The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Running saws
now yields this error:
$ saws
Traceback (most recent call last):
File "/usr/local/bin/saws", 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: pygments>=2.0.2
Mac OS 10.9.5, Python 2.7.5
Guy,
It sounds like a permissions issue and you've already tried the sudo -H
approach. Have you tried this as well?
http://stackoverflow.com/a/27871374
It seems like it's not able to download pygments
2.0.2. Curious what happens if you try:
pip install pygments
In any case, I highly recommend using virtualenv or virtualenvwrapper. Here's a handy guide:
http://docs.python-guide.org/en/latest/dev/virtualenvs/
-Donne
Actually, pygments
is installed:
$ pip install pygments
Requirement already satisfied (use --upgrade to upgrade): pygments in /Library/Python/2.7/site-packages
if I try --upgrade
I get:
$ pip install pygments --upgrade
/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Requirement already up-to-date: pygments in /Library/Python/2.7/site-packages
Could that be the root cause?
Also, my user was already the owner of /Users/user/Library/Caches/pip, as suggested in the SO answer - but I ran the chown
command anyway - still no joy.
Curious what version of Pygments is installed, if it's less than 2.0.2. Could you try the following?
python -c "import pygments; print(pygments.__version__)"
2.0.2
Hmm odd. You traceback says:
pkg_resources.DistributionNotFound: pygments>=2.0.2
yet it seems like pygments can't be found, but it's returning 2.0.2 when you run:
python -c "import pygments; print(pygments.__version__)"
Unfortunately I'm not a packaging expert :)
Could you try installing in a virtualenv
to get a 'clean' install and ensure there aren't any odd dependencies/permissions preventing you from installing/running?
Ok, I may try that. Just wanted to leave you with the results of what I just tried.
- I uninstalled pygments
- I installed pyopenssl ndg-httpsclient pyasn1 - to get rid of that SSL comment
- Re installed pygments - it's at version 2.0.2
- Re-ran
sudo -H pip install saws --upgrade
and got:
$ sudo -H pip install saws --upgrade
Requirement already up-to-date: saws in /Library/Python/2.7/site-packages
Requirement already up-to-date: awscli>=1.7.46 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: click>=4.0 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: configobj>=5.0.6 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: enum34>=1.0.4 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: fuzzyfinder>=1.0.0 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: ordereddict>=1.1 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: prompt-toolkit>=0.46 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: six>=1.9.0 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: pygments>=2.0.2 in /Library/Python/2.7/site-packages (from saws)
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /Library/Python/2.7/site-packages (from awscli>=1.7.46->saws)
Requirement already up-to-date: botocore==1.2.4 in /Library/Python/2.7/site-packages (from awscli>=1.7.46->saws)
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /Library/Python/2.7/site-packages (from awscli>=1.7.46->saws)
Requirement already up-to-date: docutils>=0.10 in /Library/Python/2.7/site-packages (from awscli>=1.7.46->saws)
Requirement already up-to-date: wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit>=0.46->saws)
Requirement already up-to-date: jmespath==0.7.1 in /Library/Python/2.7/site-packages (from botocore==1.2.4->awscli>=1.7.46->saws)
Requirement already up-to-date: python-dateutil<3.0.0,>=2.1 in /Library/Python/2.7/site-packages (from botocore==1.2.4->awscli>=1.7.46->saws)
Requirement already up-to-date: pyasn1>=0.1.3 in /Library/Python/2.7/site-packages (from rsa<=3.1.4,>=3.1.2->awscli>=1.7.46->saws)
(See pygments line confirming version)
- Ran saws, got the same error:
Traceback (most recent call last):
File "/usr/local/bin/saws", 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: pygments>=2.0.2
I'm not a python guy, so I have no idea where your package is looking for other packages. But I do appreciate your time and effort in putting this together and trying to help me. At this point, it looks more like a PIP issue than anything else.
Thanks Guy, sorry you weren't able to get it working on your setup.
If you do try it with a virtualenv
please let me know.
I'll keep this open in case anyone else has a similar issue, I can try to diagnose further if it is more widespread.
@donnemartin Also have this issue too:
Traceback (most recent call last):
File "/usr/local/bin/saws", 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 2797, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six>=1.9.0
Also running pygments version 2.0.2
EDIT: I see this when running a sudo pip install saws
:
removing '/Library/Python/2.7/site-packages/awscli-1.8.6-py2.7.egg-info' (and everything under it)
Copying awscli.egg-info to /Library/Python/2.7/site-packages/awscli-1.8.6-py2.7.egg-info
running install_scripts
copying build/scripts-2.7/aws -> /usr/local/bin
error: [Errno 2] No such file or directory: '/usr/local/bin/aws'
----------------------------------------
Rolling back uninstall of awscli
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/private/tmp/pip_build_root/awscli/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-4egtUg-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/tmp/pip_build_root/awscli
Storing complete log in /var/root/Library/Logs/pip.log
Hi Peter, Guy,
Could you try installing in a virtualenv
and see if you are having the same problem? Here are the command lines to run.
Install virtualenv
and virtualenvwrapper
:
pip install virtualenv
pip install virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
Create a SAWS
virtualenv
and install SAWS
:
mkvirtualenv saws
pip install saws
For more details (and for instructions on how to install on Windows using virtualenvwrapper-win
), check out this link.
-Donne
Using a virtual env worked.
Great! Package dependencies/permissions can get tricky, virtualenv
is a great too to manage them.
Using a virtual env worked. -polds
I updated the README with the following a note about virtualenv
:
Pip Installation
...snip...
SAWS
is hosted on PyPi. The following command will install SAWS
along with dependencies such as the AWS CLI:
$ pip install saws
I highly recommend installing Python packages in a virtualenv to avoid any issues with dependencies or permissions.
Once installed, run the following command to start SAWS
:
$ saws
...snip...