I'm using terminal on mac, and anytime I attempt to use pip, I get the following error message telling me that it cannot find a module named zlib:
$ pip --version
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 42, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
I've read several SO posts with the same error message, and have tried their solutions, including attempting to install zlib using homebrew, which fails, and updating my Xcode developer tools. I also installed pip earlier using python get-pip.py, and it said it installed successfully.
The reason I need pip is to install a package for use on python 2.7, but doing $ pip install "package-name" produces the same error as above. I have both Python 2 and 3 installed on my machine, if that helps. I'm kind of new to pip and using the command line in general, and I'm super confused; if anyone could help me out I'd really appreciate it.
This is the OP. I was able to fix the issue, and wanted to post my solution here in case it would help others.
Essentially I believe it occurred because Python2 is default on my machine, but pip is by default pointing to resources pertaining to Python3, or something like that. Doing pip2 --version instead provided the expected response.
Related
Error Message:
Traceback (most recent call last):
File "/home/upboard/visioonbot/Connect4Py/connect4.py", line 7, in <module>
import dbus
File "/home/upboard/visioonbot/Connect4Py/venv/lib/python3.6/site-packages/dbus/__init__.py", line 77, in <module>
import dbus.types as types
File "/home/upboard/visioonbot/Connect4Py/venv/lib/python3.6/site-packages/dbus/types.py", line 6, in <module>
from _dbus_bindings import (
File "/home/upboard/visioonbot/Connect4Py/venv/lib/python3.6/site-packages/_dbus_bindings/__init__.py", line 13, in <module>
import dbus.lowlevel as __dbus_lowlevel
File "/home/upboard/visioonbot/Connect4Py/venv/lib/python3.6/site-packages/dbus/lowlevel.py", line 32, in <module>
from _dbus_bindings import (
File "/home/upboard/visioonbot/Connect4Py/venv/lib/python3.6/site-packages/_dbus_bindings/ErrorMessage.py", line 13, in <module>
import dbus.lowlevel as __dbus_lowlevel
AttributeError: module 'dbus' has no attribute 'lowlevel'
Process finished with exit code 1
Here are the dbus files mentioned in the error path:
and the dbus_bindings files:
What is missing? How to solve this issue?
I've already reinstalled the packages using
sudo apt install python3-dbus
and
sudo apt-get install -y python-dbus
It looks like your issue might be that you are using a venv. python3-dbus does not play nicely with venv's.
You can try using --system-site-packages as suggested in https://stackoverflow.com/a/13367493/7721752.
Or use pydbus and vext.gi
I needed to install hashlib for one of my projects, and used easy_install hashlib (as was stated by this Stack Exchange post) to do so. However, right after I installed this package, I haven't been able to use pip at all. Whenever I type a command with pip (like pip install), I get the following error message:
Traceback (most recent call last):
File "/usr/local/bin/pip", 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/__init__.py", line 37, in <module>
import email.parser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/feedparser.py", line 27, in <module>
from email import message
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/charset.py", line 13, in <module>
import email.base64mime
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/base64mime.py", line 40, in <module>
from email.utils import fix_eols
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/utils.py", line 27, in <module>
import random
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "build/bdist.macosx-10.13-intel/egg/hashlib.py", line 115, in <module>
"""
TypeError: 'frozenset' object is not callable
This also now occurs when I'm using easy_install- same error. I'm also not able to uninstall pip and reinstall- any command with pip results in the error above. Even executing
pip --version yields the same error. I know it's something to do with the hashlib package, but I'm not sure how to delete it and reinstall without messing up my entire Python configurations. My hypothesis is that the version of hashlib I installed is either too old or too new for my Python 2.7, and doesn't play well with it.
Does anyone know what exactly is going on behind the scenes here in this stack trace, and how I can fix pip?
Is the best thing to do to literally go in and delete hashlib.py from my lib/python2.7 folder?
So, this doesn't solve the issue with hashlib, but it does get you a working pip again: literally download and reinstall Python 2.7 all over again from the source. If anyone comes up with a better, more elegant solution for fixing pip, I am all for it.
However, at least I can use pip again...
Hi, is there a solution for this error code ?
Traceback (most recent call last):
File "./weevely.py", line 2, in <module>
from core.terminal import Terminal
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/terminal.py", line 6, in <module>
from core.module import Status
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/module.py", line 14, in <module>
from core.vectorlist import VectorList
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectorlist.py", line 15, in <module>
from core.vectors import Os
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectors.py", line 11, in <module>
from mako.template import Template
ImportError: No module named mako.template
Thanks.
The answer is pretty self explainatory and with a google search you could have solved everything in seconds.
Here you have a how to install pip if you don`t have it: How do I install pip on macOS or OS X?
After this type in the terminal:
pip install Mako
as stated in the official website: http://www.makotemplates.org/download.html
If this doesn`t work you can manually download the Mako package here:
https://pypi.python.org/pypi/Mako/
Please, also read this carefully:
https://stackoverflow.com/help/how-to-ask
I'm trying to execute ansible in my system. I guess I messed up something and unable to run ansible. When I run ansible --version, I see the following error:
krishnapatamset:bin krishna.patamsetti$ ansible --version
[WARNING]: log file at /var/log/ansible/ansible.log is not writeable and we cannot create it, aborting
ERROR! Unexpected Exception: No module named markupsafe
the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible", line 80, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/usr/local/lib/python2.7/site-packages/ansible/cli/adhoc.py", line 28, in <module>
from ansible.executor.task_queue_manager import TaskQueueManager
File "/usr/local/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 29, in <module>
from ansible.executor.play_iterator import PlayIterator
File "/usr/local/lib/python2.7/site-packages/ansible/executor/play_iterator.py", line 30, in <module>
from ansible.playbook.block import Block
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 27, in <module>
from ansible.playbook.play import Play
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/play.py", line 27, in <module>
from ansible.playbook.base import Base
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/base.py", line 29, in <module>
from jinja2.exceptions import UndefinedError
File "/usr/local/lib/python2.7/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 13, in <module>
from jinja2 import nodes
File "/usr/local/lib/python2.7/site-packages/jinja2/nodes.py", line 19, in <module>
from jinja2.utils import Markup
File "/usr/local/lib/python2.7/site-packages/jinja2/utils.py", line 531, in <module>
from markupsafe import Markup, escape, soft_unicode
ImportError: No module named markupsafe
Can anyone please help me with this situation. Thanks in advance
I even tried pip install markupsafe but still I am unable to get ansible working
Ansible is based on python and there is a python module that's missing called markupsafe
install it via pip, you may need to escalate privileges
pip2 install -I markupsafe
pip2 for python 2.x
-I to ignore and reinstall package if it's already installed
I uninstalled pip and installed it again.
brew uninstall pip
brew doctor
brew install pip
I'm trying to install couchdb app on debian using the following command
couchapp push http://user:pass#localhost:5984/acra-appname
and I'm having the following error output:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/restkit/__init__.py", line 9, in <module>
from restkit.conn import Connection
File "/usr/local/lib/python2.6/dist-packages/restkit/conn.py", line 14, in <module>
from socketpool import Connector
ImportError: No module named socketpool
Traceback (most recent call last):
File "/usr/local/bin/couchapp", line 7, in <module>
from couchapp.dispatch import run
File "/usr/local/lib/python2.6/dist-packages/couchapp/dispatch.py", line 10, in <module>
import couchapp.commands as commands
File "/usr/local/lib/python2.6/dist-packages/couchapp/commands.py", line 15, in <module>
from couchapp import clone_app
File "/usr/local/lib/python2.6/dist-packages/couchapp/clone_app.py", line 15, in <module>
from couchapp.errors import AppError
File "/usr/local/lib/python2.6/dist-packages/couchapp/errors.py", line 7, in <module>
from restkit import ResourceError
ImportError: cannot import name ResourceError
As far as I understand the error is:
ImportError: No module named socketpool
How can I install this module or how to resolve the problem?
As Ifthikhan sugessted: Install it using a package manager such as apt-get and thereafter using pip you can install socketpool.
I had this problem when installing couchapp. I used pip to install it, and I thought it completed, but when I ran it I had the ImportError problem. Turns out the pip install didn't succeed and I first needed to:
apt-get install python-dev
Then when I did a
pip install couchapp
all of the dependencies were installed and couchapp ran without a problem.