"ImportError: No module named zlib" when install google cloud sdk - macos

I'm installing google cloud sdk on mac following this documentation. But I failed when trying to run this command:
$ curl https://sdk.cloud.google.com | bash
And this is error:
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/tran.ba.vinh.son/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
import bootstrapping
File "/Users/tran.ba.vinh.son/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 44, in <module>
from googlecloudsdk.core.credentials import store as c_store
File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 32, in <module>
from googlecloudsdk.core import http
File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/http.py", line 31, in <module>
from googlecloudsdk.core import http_proxy
File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/http_proxy.py", line 26, in <module>
import httplib2
File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/third_party/httplib2/__init__.py", line 18, in <module>
from httplib2.python2.httplib2 import *
File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/third_party/httplib2/python2/httplib2/__init__.py", line 35, in <module>
import gzip
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 9, in <module>
import zlib
ImportError: No module named zlib
I tried with Homebrew but same error:
brew cask install google-cloud-sdk
And even after install zlib via brew install zlib. I still got that error. Please help me if you have any suggestions, thanks a lot !

I found this comment on homebrew core that fixed it for me.
TL;DR ->
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I had this issue when installing asdf as well. I ran the command above and then brew install asdf worked. I think this issue happens after a macOS update because I had to run it again to install google-cloud-sdk.

Install Developer Command Line Tools :
xcode-select --install
Reinstall python2 :
brew reinstall python2

Related

pip3 TypeError: deprecated() got an unexpected keyword argument 'name' [duplicate]

I am trying to install few packages and started getting an error. Then used multiple commands in ubuntu to update few things but errors are similar
pip install -U pip setuptools
or
python3 -m pip install --upgrade pip
or
sudo -H pip3 install --upgrade pip
Following is the error sample
user#machine:~$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
.
.
.
.
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
I have updated the system with apt-get install libffi-dev python-dev python3-dev and
apt-get install build-essential libssl-dev already as suggested in here
Something got broken down in OpenSSL and no command was working with pip afterwards. I was even unable uninstall pip.
I removed installation files manually (most likely not a recommended approach) with
sudo rm -rf /usr/local/lib/python3.8/dist-packages/OpenSSL
sudo rm -rf /usr/local/lib/python3.8/dist-packages/pyOpenSSL-22.1.0.dist-info/
and reinstalled using pip3 install pyOpenSSL==22.0.0. The other version was having some issue as described here.
For me even uninstall of pyOpenSSL was encountering same error TypeError: deprecated() got an unexpected keyword argument 'name'
so first I upgraded pip to 23.0 ,uninstall PyOpenSSL,manually deleted openSSL folder from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages then installed PyOpenSSL 20.0.0, finally issue resolved.

Can't install pyenchant

I need installing pyenchant v1.6.7 on MacBook with Apple Silicon (M1 Pro) for Python 2.7.18.
This package is a wrapper for C-library enchant, so it requires to the enchant was installed firstly. Well, I've installed the enchant by: brew install enchant.
However, when I try to install pyenchant using PIP I got the next error:
cwd: /private/var/folders/8t/b2kn5tm162s614gvsfrdcbhm0000gn/T/pip-install-8FO32O/pyenchant/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/8t/b2kn5tm162s614gvsfrdcbhm0000gn/T/pip-install-8FO32O/pyenchant/setup.py", line 210, in <module>
import enchant
File "enchant/__init__.py", line 92, in <module>
from enchant import _enchant as _e
File "enchant/_enchant.py", line 145, in <module>
raise ImportError(msg)
ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Also I have tried to specify LDFLAGS and CFLAGS:
LDFLAGS='-L/opt/homebrew/Cellar/enchant/2.3.3/lib' CFLAGS="-I/opt/homebrew/Cellar/enchant/2.3.3/include" ~/.pyenv/versions/2.7.18/bin/pip install --no-cache-dir pyenchant==1.6.7
But it doesn't work, I still get the same error.
How to specify the enchant library for the pyenchant module?

./odoo-bin --config=' /etc/odoo.conf' ODOO 11

Traceback (most recent call last):
File "./odoo-bin", line 5, in <module>
import odoo
File "/opt/odoo/odoo/odoo/__init__.py", line 88, in <module>
from . import service
File "/opt/odoo/odoo/odoo/service/__init__.py", line 7, in <module>
from . import wsgi_server
File "/opt/odoo/odoo/odoo/service/wsgi_server.py", line 25, in <module>
import werkzeug.contrib.fixers
ModuleNotFoundError: No module named 'werkzeug.contrib'
After tracing back errors, I got this error.
Failed building wheel for pyldap
And after I run this code.
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
and
pip3 install -r requirements.txt
Make sure your werkzeug version in requirements.txt is 0.11.15.
If not 'pip3 install werkzeug==0.11.15'
then you can execute odoo
I ran into the same issue when trying to use Proxyfix in werkzeug==1.0.0
Since that Werkzeug 1.0.0 has removed deprecated code from werkzeug.contrib, ProxyFix was relocated to werkzeug.middleware.proxy_fix
To fix the ModuleNotFoundError: No module named 'werkzeug.contrib' Error:
You should import ProxyFix with the following code:
from werkzeug.middleware.proxy_fix import ProxyFix
I hope this helps and fix your issues 😄

Not being able to install LinkChecker

I'm having issues installing broken link-checker.
When I do 'sudo pip install LinkChecker' like said in installation, I get following error
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-uBq7xh/LinkChecker/setup.py", line 95, in <module>
import py2app
File "/Library/Python/2.7/site-packages/py2app/__init__.py", line 31, in <module>
__version__ = pkg_resources.require('py2app')[0].version
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'macholib>=1.4' distribution was not found and is required by py2app
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uBq7xh/LinkChecker/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The error message you get suggests you fail to meet the dependencies needed for the package you're installing.
Try installing macholib and upgrading pip, as suggested by the log
pip install macholib
pip install --upgrade pip

"enchant C library not found" while installing pyenchant using pip on OSX

I typed in pip install pyenchant into my shell, but it raised two Traceback errors:
1:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant/setup.py", line 195, in <module>
import enchant
File "enchant/__init__.py", line 90, in <module>
from enchant import _enchant as _e
File "enchant/_enchant.py", line 133, in <module>
raise ImportError("enchant C library not found")
ImportError: enchant C library not found
2:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant/setup.py", line 195, in <module>
import enchant
File "enchant/__init__.py", line 90, in <module>
from enchant import _enchant as _e
File "enchant/_enchant.py", line 133, in <module>
raise ImportError("enchant C library not found")
ImportError: enchant C library not found
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant
I have python 2.7 default installed on my mac, but it still isn't working. I have already looked at Unable to install pyenchant-1.6.5 for python 2.7 on Mac OSX Lion but it doesn't answer my question, as easy_install pyenchant raises even more errors.
Try this - It worked for me on Ubuntu.
sudo apt-get install libenchant1c2a
You need to install enchant, which is a C library. You can use Homebrew, to do this kind of package management. Just enter:
brew install enchant
Before trying to pip install pyenchant and you should be fine.
Try either sudo pip install or sudo easy install.
[nltk_data] Error loading enchant: Package 'enchant' not found in
No. if you get this problem, you are supposed to install it like this:
$ sudo easy_install pyenchant
it is not an nltk package, it is a package on its own.
sudo easy_install
sudo because MAC permissions are usually messed up
Try a pip install, an easy_install, and a brew.
You have to download the NLTK package. That is how you get Pyenchant running. But if your building a grammar checker, pyenchant is not advisable because it only grammar checks two words. You should consider building a grammar checker on your own by starting with an autocomplete word completion from here:
How to code autocompletion in python?
For windows: download the required .exe file based on version from https://pypi.python.org/simple/pyenchant/
and pip install pyenchant

Resources