Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update conda does not work showing the error "module 'brotli' has no attribute" #9903

Open
fabosilva opened this issue Apr 30, 2020 · 35 comments
Labels
source::community catch-all for issues filed by community members stale::recovered [bot] recovered after being marked as stale tag::ssl related to an SSL issue tag::update related to an upgrade issue

Comments

@fabosilva
Copy link

fabosilva commented Apr 30, 2020

After update does not access anancona, IDE spyder. I can't go back to the last review of the conda.

Conda info:

Traceback (most recent call last):
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1079, in __call__
    return func(*args, **kwargs)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\index.py", line 10, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\core\path_actions.py", line 30, in <module>
    from ..gateways.connection.download import download
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\gateways\connection\__init__.py", line 21, in <module>
    from requests import ConnectionError, HTTPError, Session
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\__init__.py", line 7, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 39, in <module>
    from .response import HTTPResponse
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\response.py", line 155, in <module>
    class HTTPResponse(io.IOBase):
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\response.py", line 377, in HTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\Scripts\conda-script.py", line 12, in <module>
    sys.exit(main())
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\cli\main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1371, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1126, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1141, in handle_unexpected_exception
    self._execute_upload(error_report)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1303, in _execute_upload
    'User-Agent': self.user_agent,
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\exceptions.py", line 1101, in user_agent
    return context.user_agent
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 268, in new_fget
    cache[inner_attname] = func(self)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\base\context.py", line 737, in user_agent
    builder = ["conda/%s requests/%s" % (CONDA_VERSION, self.requests_version)]
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 268, in new_fget
    cache[inner_attname] = func(self)
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\conda\base\context.py", line 748, in requests_version
    from requests import __version__ as REQUESTS_VERSION
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\__init__.py", line 7, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 39, in <module>
    from .response import HTTPResponse
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\response.py", line 155, in <module>
    class HTTPResponse(io.IOBase):
  File "C:\Users\fbonadias\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\response.py", line 377, in HTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

conda config --show-sources:

==> C:\Users\fbonadias.condarc <==
default_python: None
ssl_verify: True
channels:

  • defaults

conda list:

Name Version Build Channel

alabaster 0.7.12 py37_0 defaults
anaconda 0.0.1.1 pypi_0 pypi
anaconda-client 1.7.2 py37_0 defaults
anaconda-navigator 1.9.12 py37_0 defaults
anyqt 0.0.10 py37_0 defaults
appdirs 1.4.3 pypi_0 pypi
argh 0.26.2 py37_0 defaults
asn1crypto 1.3.0 py37_0 defaults
astroid 2.3.3 py37_0 defaults
atomicwrites 1.3.0 py37_1 defaults
attrs 19.3.0 py_0 defaults
autopep8 1.4.4 py_0 defaults
babel 2.8.0 py_0 defaults
backcall 0.1.0 py37_0 defaults
backports 1.0 py_2 defaults
backports.functools_lru_cache 1.6.1 py_0 defaults
backports.tempfile 1.0 py_1 defaults
backports.weakref 1.0.post1 py_1 defaults
bcrypt 3.1.7 py37he774522_0 defaults
beautifulsoup4 4.9.0 py37_0 defaults
blas 1.0 mkl defaults
bleach 3.1.4 py_0 defaults
bottlechest 0.7.1 py37h452e1ab_1 defaults
bottleneck 1.3.2 py37h2a96729_0 defaults
bzip2 1.0.8 he774522_0 defaults
ca-certificates 2020.1.1 0 defaults
cachecontrol 0.12.5 py37_0 defaults
certifi 2020.4.5.1 py37_0 defaults
cffi 1.14.0 py37h7a1dbc1_0 defaults
chama 0.1.3 pypi_0 pypi
chardet 3.0.4 py37_1003 defaults
click 7.1.1 py_0 defaults
cloudpickle 1.4.0 py_0 defaults
clyent 1.2.2 py37_1 defaults
colorama 0.4.3 py_0 defaults
commonmark 0.9.1 py_0 defaults
conda 4.8.3 py37_0 defaults
conda-build 3.19.2 py37hc8dfbb8_0 conda-forge
conda-env 2.6.0 1 conda-forge
conda-package-handling 1.6.0 py37h62dcd97_0 defaults
conda-verify 3.4.2 py_1 defaults
console_shortcut 0.1.1 4 defaults
cryptography 2.8 py37h7a1dbc1_0 defaults
cycler 0.10.0 py37_0 defaults
decorator 4.4.2 py_0 defaults
defusedxml 0.6.0 py_0 defaults
diff-match-patch 20181111 py_0 defaults
docutils 0.16 py37_0 defaults
entrypoints 0.3 py37_0 defaults
filelock 3.0.12 py_0 defaults
flake8 3.7.9 py37_0 defaults
freetype 2.9.1 ha9979f8_1 defaults
future 0.18.2 py37_0 defaults
glob2 0.7 py_0 defaults
icc_rt 2019.0.0 h0cc432a_1 defaults
icu 58.2 ha925a31_3 defaults
idna 2.9 py_1 defaults
imagesize 1.2.0 py_0 defaults
importlib_metadata 1.5.0 py37_0 defaults
intel-openmp 2020.0 166 defaults
intervaltree 3.0.2 py_0 defaults
ipykernel 5.1.4 py37h39e3cac_0 defaults
ipython 7.13.0 py37h5ca1d4c_0 defaults
ipython_genutils 0.2.0 py37_0 defaults
isort 4.3.21 py37_0 defaults
jedi 0.15.2 py37_0 defaults
jinja2 2.11.2 py_0 defaults
joblib 0.14.1 py_0 defaults
jpeg 9b hb83a4c4_2 defaults
json5 0.9.4 py_0 defaults
jsonschema 3.2.0 py37_0 defaults
jupyter_client 6.1.2 py_0 defaults
jupyter_core 4.6.3 py37_0 defaults
jupyterlab 1.2.6 pyhf63ae98_0 defaults
jupyterlab_server 1.1.0 py_0 defaults
keyring 21.1.1 py37_2 defaults
keyrings.alt 3.1.1 py37_0 defaults
kiwisolver 1.1.0 py37ha925a31_0 defaults
lazy-object-proxy 1.4.3 py37he774522_0 defaults
libarchive 3.3.3 h0643e63_5 defaults
libiconv 1.15 h1df5818_7 defaults
liblief 0.9.0 ha925a31_3 defaults
libpng 1.6.37 h2a8f88b_0 defaults
libsodium 1.0.16 h9d3ae62_0 defaults
libspatialindex 1.9.3 h33f27b4_0 defaults
libtiff 4.1.0 h56a325e_0 defaults
libxml2 2.9.9 h464c3ec_0 defaults
llvmlite 0.32.0 py37ha925a31_0 defaults
lockfile 0.12.2 py37_0 defaults
lz4-c 1.8.1.2 h2fa13f4_0 defaults
lzo 2.10 he774522_2 defaults
m2w64-gcc-libgfortran 5.3.0 6 defaults
m2w64-gcc-libs 5.3.0 7 defaults
m2w64-gcc-libs-core 5.3.0 7 defaults
m2w64-gmp 6.1.0 2 defaults
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 defaults
markupsafe 1.1.1 py37he774522_0 defaults
matplotlib 3.1.3 py37_0 defaults
matplotlib-base 3.1.3 py37h64f37c6_0 defaults
mccabe 0.6.1 py37_1 defaults
menuinst 1.4.16 py37_0 conda-forge
mistune 0.8.4 py37he774522_0 defaults
mkl 2020.0 166 defaults
mkl-service 2.3.0 py37hb782905_0 defaults
mkl_fft 1.0.15 py37h14836fe_0 defaults
mkl_random 1.1.0 py37h675688f_0 defaults
msgpack-python 1.0.0 py37h74a9793_1 defaults
msys2-conda-epoch 20160418 1 defaults
navigator-updater 0.2.1 py37_0 defaults
nbconvert 5.6.1 py37_0 defaults
nbformat 5.0.4 py_0 defaults
networkx 2.4 py_1 conda-forge
nose 1.3.7 pypi_0 pypi
notebook 6.0.3 py37_0 conda-forge
numba 0.49.0 py37h47e9c7a_0 defaults
numpy 1.18.1 py37h93ca92e_0 defaults
numpy-base 1.18.1 py37hc3f5095_1 defaults
numpydoc 0.9.2 py_0 defaults
olefile 0.46 py37_0 defaults
openssl 1.1.1g he774522_0 defaults
opentsne 0.3.11 py37he774522_1 defaults
orange-canvas-core 0.1.7 py_0 defaults
orange-widget-base 4.0.1 py_0 defaults
orange3 3.23.1 py37ha925a31_0 defaults
packaging 20.3 py_0 defaults
pandas 1.0.3 py37h3bbf574_1 conda-forge
pandoc 2.2.3.2 0 defaults
pandocfilters 1.4.2 py37_1 defaults
paramiko 2.7.1 py_0 defaults
parso 0.5.2 py_0 defaults
pathtools 0.1.2 py_1 defaults
pexpect 4.8.0 py37_0 defaults
pickleshare 0.7.5 py37_0 defaults
pillow 7.0.0 py37hcc1f983_0 defaults
pip 20.0.2 py37_1 defaults
pkginfo 1.5.0.1 py37_0 defaults
pluggy 0.13.1 py37_0 defaults
powershell_shortcut 0.0.1 3 defaults
prometheus_client 0.7.1 py_0 defaults
prompt-toolkit 3.0.4 py_0 defaults
prompt_toolkit 3.0.4 0 defaults
psutil 5.7.0 py37he774522_0 defaults
py-lief 0.9.0 py37ha925a31_3 defaults
pycodestyle 2.5.0 py37_0 defaults
pycosat 0.6.3 py37he774522_0 defaults
pycparser 2.20 py_0 defaults
pydocstyle 4.0.1 py_0 defaults
pyflakes 2.1.1 py37_0 defaults
pygments 2.6.1 py_0 defaults
pylint 2.4.4 py37_0 defaults
pynacl 1.3.0 py37h62dcd97_0 defaults
pynndescent 0.3.3 py_0 defaults
pyomo 5.6.9 pypi_0 pypi
pyopenssl 19.1.0 py37_0 defaults
pyparsing 2.4.6 py_0 defaults
pyqt 5.9.2 py37h6538335_2 defaults
pyqtgraph 0.10.0 py37h28b3542_3 defaults
pyrsistent 0.16.0 py37he774522_0 defaults
pysocks 1.7.1 py37_0 defaults
python 3.7.7 h60c2a47_2 defaults
python-dateutil 2.8.1 py_0 conda-forge
python-jsonrpc-server 0.3.4 py_0 defaults
python-language-server 0.31.10 py37_0 defaults
python-libarchive-c 2.9 py_0 defaults
python-louvain 0.13 py_0 defaults
python_abi 3.7 1_cp37m conda-forge
pytz 2019.3 py_0 defaults
pyutilib 5.8.0 pypi_0 pypi
pywin32 227 py37he774522_1 defaults
pywin32-ctypes 0.2.0 py37_1000 defaults
pywinpty 0.5.7 py37_0 defaults
pyyaml 5.3.1 py37he774522_0 defaults
pyzmq 18.1.1 py37ha925a31_0 defaults
qdarkstyle 2.8.1 py_0 defaults
qt 5.9.7 vc14h73c81de_0 defaults
qtawesome 0.7.0 py_0 defaults
qtconsole 4.7.3 pyh9f0ad1d_0 conda-forge
qtpy 1.9.0 py_0 defaults
requests 2.23.0 py37_0 defaults
ripgrep 11.0.2 0 defaults
rope 0.16.0 py_0 defaults
rtree 0.9.3 py37h21ff451_0 defaults
ruamel_yaml 0.15.87 py37he774522_0 defaults
scikit-learn 0.22.1 py37h6288b17_0 defaults
scipy 1.4.1 py37h9439919_0 defaults
send2trash 1.5.0 py37_0 defaults
serverfiles 0.3.0 py37_0 defaults
setuptools 46.1.3 py37_0 defaults
sip 4.19.8 py37h6538335_0 defaults
six 1.14.0 py37_0 defaults
snowballstemmer 2.0.0 py_0 defaults
somepackage 1.2.3 pypi_0 pypi
sortedcontainers 2.1.0 py37_0 defaults
soupsieve 2.0 py_0 defaults
sphinx 3.0.3 py_0 defaults
sphinxcontrib-applehelp 1.0.2 py_0 defaults
sphinxcontrib-devhelp 1.0.2 py_0 defaults
sphinxcontrib-htmlhelp 1.0.3 py_0 defaults
sphinxcontrib-jsmath 1.0.1 py_0 defaults
sphinxcontrib-qthelp 1.0.3 py_0 defaults
sphinxcontrib-serializinghtml 1.1.4 py_0 defaults
spyder 4.1.2 py37hc8dfbb8_0 conda-forge
spyder-kernels 1.9.0 py37_0 defaults
sqlite 3.31.1 h2a8f88b_1 defaults
tbb 2020.0 h74a9793_0 defaults
terminado 0.8.3 py37_0 defaults
testpath 0.4.4 py_0 defaults
tk 8.6.8 hfa6e2cd_0 defaults
tornado 6.0.4 py37he774522_1 defaults
tqdm 4.45.0 py_0 defaults
traitlets 4.3.3 py37_0 defaults
ujson 1.35 py37hfa6e2cd_0 defaults
urllib3 1.25.8 py37_0 defaults
vc 14.1 h0510ff6_4 defaults
vs2015_runtime 14.16.27012 hf0eaf9b_1 defaults
watchdog 0.10.2 py37_0 defaults
wcwidth 0.1.9 py_0 defaults
webencodings 0.5.1 py37_1 defaults
wheel 0.34.2 py37_0 defaults
win_inet_pton 1.1.0 py37_0 defaults
wincertstore 0.2 py37_0 defaults
winpty 0.4.3 4 defaults
wntr 0.2.2 pypi_0 pypi
wrapt 1.12.1 py37he774522_1 defaults
xlrd 1.2.0 py37_0 defaults
xlsxwriter 1.2.8 py_0 defaults
xmltodict 0.12.0 py_0 defaults
xz 5.2.5 h62dcd97_0 defaults
yaml 0.1.7 hc54c509_2 defaults
yapf 0.28.0 py_0 defaults
zeromq 4.3.1 h33f27b4_3 defaults
zipp 2.2.0 py_0 defaults
zlib 1.2.11 h62dcd97_4 defaults
zstd 1.3.7 h508b16e_0 defaults

@kalefranz kalefranz added source::community catch-all for issues filed by community members tag::ssl related to an SSL issue labels Apr 30, 2020
@arohanajit
Copy link

Same for me. I was faced with qt installation issues: ContinuumIO/anaconda-issues#10949
After which I tried updating conda and installing matplotlib through pip. Now no installation commands run and am faced with this error.

@eeyrjmr
Copy link

eeyrjmr commented May 5, 2020

I have just faced this. Looking in the site-packages directory under brotli it can be seen that conda has emptied it.

I edited site-packages\pip_vendor\urllib3\response.py at line 376 and commented out the Brotli check. This allowed my todo a pip install brotli to recover my environment.

This is a workaround and does not explain why it happened or how it should be fixed

@thinkboxer
Copy link

I had the same problem. I am pretty new to all this and eeyrjmr's workaround did not work for me or I did not find how to make it work.
So I did a full uninstall and installed anaconda again. I have nagging double tabs in the Windows 10 start pane now :

(Anaconda Navigator / Anaconda Navigator (anaconda3)
Anaconda Powershell Prompt / Anaconda Powershell prompt (anaconda3) ...

But I can launch Jupiter Labs again.

@eeyrjmr
Copy link

eeyrjmr commented May 6, 2020

its a bit more sinister then just brotli... numpy (and a few other packages) were in a state of uninstall.

i ended up doing an uninstall and a fresh install since some form up update corrupted the install

@fabosilva
Copy link
Author

I had the same problem. I am pretty new to all this and eeyrjmr's workaround did not work for me or I did not find how to make it work.
So I did a full uninstall and installed anaconda again. I have nagging double tabs in the Windows 10 start pane now :

(Anaconda Navigator / Anaconda Navigator (anaconda3)
Anaconda Powershell Prompt / Anaconda Powershell prompt (anaconda3) ...

But I can launch Jupiter Labs again.

I am also a beginner, however I believe it is only to delete the old tabs.

@psnh22
Copy link

psnh22 commented May 19, 2020

Is there any solution other than uninstalling? I am having the same issue.

@fabosilva
Copy link
Author

Is there any solution other than uninstalling? I am having the same issue.

I couldn't solve it, I tried the eeyrjmr procedure but it didn't work. Uninstall and install again

@nickcorona
Copy link

Man, this is really annoying. It's turning me off from using conda.

@jayveesea
Copy link

I had this same problem, @eeyrjmr solution seems to work for me. One caveat, the path was site-packages\pip\_vendor\urllib3\response.py. I'm curious if any additional actions should be taken once the brotli issue is resolved.

@MishraSubash
Copy link

Is there any solution other than uninstalling? I am having the same issue.

I couldn't solve it, I tried the eeyrjmr procedure but it didn't work. Uninstall and install again

does re-installation fixed your issue?

@fabosilva
Copy link
Author

Is there any solution other than uninstalling? I am having the same issue.

I couldn't solve it, I tried the eeyrjmr procedure but it didn't work. Uninstall and install again

does re-installation fixed your issue?

@fabosilva fabosilva reopened this May 31, 2020
@fabosilva
Copy link
Author

Is there any solution other than uninstalling? I am having the same issue.

I couldn't solve it, I tried the eeyrjmr procedure but it didn't work. Uninstall and install again

does re-installation fixed your issue?

Fixed the problem, but to use spyder 4.13 with the packages I use, I installed anaconda 2019.07 with the custom version. Using version 2020/02 and updating the conda, it is not possible to use syper 4.13., Even creating different envs.

@xhuyvn
Copy link

xhuyvn commented Jun 3, 2020

Hi,
I had the same issue after run "conda update conda anaconda", It show error beblow.
File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 135, in <module> class HTTPResponse(io.IOBase): File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 357, in HTTPResponse DECODER_ERROR_CLASSES += (brotli.error,) AttributeError: module "brotli" has no attribute 'error'

My solution is: open file "Anaconda3\lib\site-packages\urllib3\response.py", find the code below
DECODER_ERROR_CLASSES = (IOError, zlib.error) if brotli is not None: DECODER_ERROR_CLASSES += (brotli.error,)
and update it to
DECODER_ERROR_CLASSES = (IOError, zlib.error)
Run anaconda navigator again.

@AJSchiller
Copy link

I had the same problem as the OP, tried @eeyrjmr 's solution, then got the same traceback as @xhuyvn , tried that solution as well and now things seem to be working as normal.
Thanks for the help guys!

@heraclitusq
Copy link

heraclitusq commented Jun 21, 2020

Encountered the same issue after upgrading the conda base python version from 3.7 to 3.8 on windows10 today.

What I did to solve this problem:

  1. Edit the response.py file referred in the traceback info. Comment out the import brotli part and manually set it to None:
#try:
#    import brotli
#except ImportError:
#    brotli = None
brotli = None
  1. From command line, update conda: conda update conda.
    This will prompt to install brotlipy. Descriptions on my computer:
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    brotlipy-0.7.0             |py38he774522_1000         338 KB
    ------------------------------------------------------------
                                           Total:         338 KB

The following NEW packages will be INSTALLED:

  brotlipy           pkgs/main/win-64::brotlipy-0.7.0-py38he774522_1000

The following packages will be UPDATED:

  urllib3            pkgs/main/win-64::urllib3-1.25.8-py38~ --> pkgs/main/noarch::urllib3-1.25.9-py_0

This is it. If you don't want to conda update conda. conda install brotlipy should do the trick as well I think. The response.py file gets overwritten by the update, so no need to revert it.

@Shamik2209
Copy link

@xhuyvn Thanks a lot. This worked. Do you think this is a glitch from the Anaconda developers?

@Shamik2209
Copy link

Your solution works alright. Thanks again @xhuyvn . But how did you come up with this almost impossible solution?

@xhuyvn
Copy link

xhuyvn commented Jun 27, 2020

Your solution works alright. Thanks again @xhuyvn . But how did you come up with this almost impossible solution?

Hi,

I glad when my solution could help you. Python is free, sometimes, many guys work in the same project and the environment is not the same. When they combining the code for publishing a new version may not work for all environment. With my experiment in the C# project management, just find the conflict and fix it. The easy way is to change the code to avoid the runtime conflict, but it will have risk maybe we don't know it yet.

@taherib
Copy link

taherib commented Jun 27, 2020

I had the same issue, all I had to do was to run the following:

activate myVirtualEnv
conda install brotlipy

and that fixed the issue, I did not have to edit "response.py"

@oke-aditya
Copy link

Finding this issue on My PC too .

Encountered the same issue after upgrading the conda base python version from 3.7 to 3.8 on windows10 today.

What I did to solve this problem:

1. Edit the `response.py` file referred in the traceback info. Comment out the `import brotli` part and manually set it to `None`:
#try:
#    import brotli
#except ImportError:
#    brotli = None
brotli = None
1. From command line, update conda: `conda update conda`.
   This will prompt to install `brotlipy`. Descriptions on my computer:
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    brotlipy-0.7.0             |py38he774522_1000         338 KB
    ------------------------------------------------------------
                                           Total:         338 KB

The following NEW packages will be INSTALLED:

  brotlipy           pkgs/main/win-64::brotlipy-0.7.0-py38he774522_1000

The following packages will be UPDATED:

  urllib3            pkgs/main/win-64::urllib3-1.25.8-py38~ --> pkgs/main/noarch::urllib3-1.25.9-py_0

This is it. If you don't want to conda update conda. conda install brotlipy should do the trick as well I think. The response.py file gets overwritten by the update, so no need to revert it.

This solved my problem. It happens when you update to Python 3.8 from python 3.6 or python 3.7

@dddanny79
Copy link

Hi,
I had the same issue after run "conda update conda anaconda", It show error beblow.
File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 135, in <module> class HTTPResponse(io.IOBase): File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 357, in HTTPResponse DECODER_ERROR_CLASSES += (brotli.error,) AttributeError: module "brotli" has no attribute 'error'

My solution is: open file "Anaconda3\lib\site-packages\urllib3\response.py", find the code below
DECODER_ERROR_CLASSES = (IOError, zlib.error) if brotli is not None: DECODER_ERROR_CLASSES += (brotli.error,)
and update it to
DECODER_ERROR_CLASSES = (IOError, zlib.error)
Run anaconda navigator again.

Perfect... solved the problem for me as well !

Thanks @xhuyvn

cgranade added a commit to microsoft/iqsharp that referenced this issue Apr 28, 2022
cgranade pushed a commit to microsoft/iqsharp that referenced this issue Apr 28, 2022
* Tee output from conda info for improved diagnostics.

* Workaround for conda/conda#9903.

* Use pip for workaround.

* Workaround in CI YAML instead.

* Add brotli to CI YAML directly.

* Apply workaround to Selenium CI as well.
cgranade pushed a commit to microsoft/iqsharp that referenced this issue Apr 28, 2022
* Add DevSkim scanning (#659)

Co-authored-by: Cassandra Granade <chgranad@microsoft.com>

* Tee output from conda info for improved diagnostics.

* Workaround for conda/conda#9903.

* Use pip for workaround.

* Workaround in CI YAML instead.

* Add brotli to CI YAML directly.

* Apply workaround to Selenium CI as well.

* Trivial change to invalidate build.

Co-authored-by: Angela Burton <anjbur@users.noreply.github.com>
@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Jul 18, 2022
@github-actions github-actions bot added the stale::closed [bot] closed after being marked as stale label Aug 17, 2022
joergbrech added a commit to DLR-SC/tigl that referenced this issue Feb 17, 2023
@jens-k
Copy link

jens-k commented May 30, 2023

I encountered the same issue today on a Windows 10 machine after updating conda (miniconda).

(base) C:\Users\Jens>jupyter lab
Traceback (most recent call last):
  File "C:\Users\Jens\miniconda3\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Jens\miniconda3\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Jens\miniconda3\Scripts\jupyter-lab.EXE\__main__.py", line 4, in <module>
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab\__init__.py", line 7, in <module>
    from .handlers.announcements import (  # noqa
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab\handlers\announcements.py", line 15, in <module>
    from jupyterlab_server.translation_utils import translator
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab_server\__init__.py", line 5, in <module>
    from .app import LabServerApp
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab_server\app.py", line 10, in <module>
    from .handlers import LabConfig, add_handlers
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab_server\handlers.py", line 18, in <module>
    from .listings_handler import ListingsHandler, fetch_listings
  File "C:\Users\Jens\miniconda3\lib\site-packages\jupyterlab_server\listings_handler.py", line 8, in <module>
    import requests
  File "C:\Users\Jens\miniconda3\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\Jens\miniconda3\lib\site-packages\urllib3\__init__.py", line 17, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\Jens\miniconda3\lib\site-packages\urllib3\connectionpool.py", line 14, in <module>
    from ._request_methods import RequestMethods
  File "C:\Users\Jens\miniconda3\lib\site-packages\urllib3\_request_methods.py", line 10, in <module>
    from .response import BaseHTTPResponse
  File "C:\Users\Jens\miniconda3\lib\site-packages\urllib3\response.py", line 277, in <module>
    class BaseHTTPResponse(io.IOBase):
  File "C:\Users\Jens\miniconda3\lib\site-packages\urllib3\response.py", line 287, in BaseHTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

This workaround solved it for me, but I guess it's not intended behavior.

@ruilvo
Copy link

ruilvo commented May 31, 2023

Downloaded miniconda Miniconda3-py310_23.3.1-0-Windows-x86_64.exe, updated conda with conda update -n base -c defaults conda and after that I started getting the error as described:

  File "[...]\miniconda3\lib\site-packages\urllib3\response.py", line 287, in BaseHTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

Commented lines 286 and 287 as described on the workarounds.

This needs to be opened again.

@xeoslaenor
Copy link

I have the same problem (conda update breaks miniconda on last version) and the workaround above has solved the problem for me too

@jezdez jezdez reopened this Jun 7, 2023
@jezdez
Copy link
Member

jezdez commented Jun 7, 2023

@xeoslaenor Could you please elaborate what version of conda and miniconda you used? I'm trying to investigate whether this is a regression or not.

@aym00
Copy link

aym00 commented Jun 7, 2023

I have the same problem having just installed Mambaforge-23.1.0-1-Windows-x86_64.exe and run

conda update -n base -c conda-forge conda

I'm running on Microsoft Windows [Version 10.0.19044.2965], here's the console output from the update and resulting error:

(base) C:\Users\username>conda update -n base -c conda-forge conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\username\mambaforge

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    boltons-23.0.0             |     pyhd8ed1ab_0         296 KB  conda-forge
    conda-23.3.1               |  py310h5588dad_0         947 KB  conda-forge
    conda-package-streaming-0.8.0|     pyhd8ed1ab_0          18 KB  conda-forge
    cryptography-41.0.1        |  py310h6e82f81_0         1.0 MB  conda-forge
    jsonpatch-1.32             |     pyhd8ed1ab_0          14 KB  conda-forge
    jsonpointer-2.0            |             py_0           9 KB  conda-forge
    libarchive-3.6.2           |       h6f8411a_1         938 KB  conda-forge
    libsolv-0.7.24             |       h12be248_0         417 KB  conda-forge
    libssh2-1.11.0             |       h7dfc565_0         261 KB  conda-forge
    libxml2-2.11.4             |       hc3477c8_0         1.6 MB  conda-forge
    packaging-23.1             |     pyhd8ed1ab_0          45 KB  conda-forge
    pyopenssl-23.2.0           |     pyhd8ed1ab_1         126 KB  conda-forge
    ruamel.yaml-0.17.31        |  py310h8d17308_0         193 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         5.8 MB

The following NEW packages will be INSTALLED:

  boltons            conda-forge/noarch::boltons-23.0.0-pyhd8ed1ab_0
  brotli             conda-forge/win-64::brotli-1.0.9-hcfcfb64_8
  brotli-bin         conda-forge/win-64::brotli-bin-1.0.9-hcfcfb64_8
  jsonpatch          conda-forge/noarch::jsonpatch-1.32-pyhd8ed1ab_0
  jsonpointer        conda-forge/noarch::jsonpointer-2.0-py_0
  libbrotlicommon    conda-forge/win-64::libbrotlicommon-1.0.9-hcfcfb64_8
  libbrotlidec       conda-forge/win-64::libbrotlidec-1.0.9-hcfcfb64_8
  libbrotlienc       conda-forge/win-64::libbrotlienc-1.0.9-hcfcfb64_8
  packaging          conda-forge/noarch::packaging-23.1-pyhd8ed1ab_0
  vc14_runtime       conda-forge/win-64::vc14_runtime-14.34.31931-h5081d32_16

The following packages will be REMOVED:

  brotlipy-0.7.0-py310h8d17308_1005

The following packages will be UPDATED:

  ca-certificates                      2022.12.7-h5b45459_0 --> 2023.5.7-h56e8100_0
  certifi                            2022.12.7-pyhd8ed1ab_0 --> 2023.5.7-pyhd8ed1ab_0
  conda                              23.1.0-py310h5588dad_0 --> 23.3.1-py310h5588dad_0
  conda-package-str~                     0.7.0-pyhd8ed1ab_1 --> 0.8.0-pyhd8ed1ab_0
  cryptography                       40.0.1-py310h6e82f81_0 --> 41.0.1-py310h6e82f81_0
  libarchive                               3.6.2-h27c7867_0 --> 3.6.2-h6f8411a_1
  libsolv                                 0.7.23-h12be248_0 --> 0.7.24-h12be248_0
  libsqlite                               3.40.0-hcfcfb64_0 --> 3.42.0-hcfcfb64_0
  libssh2                                 1.10.0-h9a1e1f7_3 --> 1.11.0-h7dfc565_0
  libxml2                                 2.10.3-hc3477c8_6 --> 2.11.4-hc3477c8_0
  openssl                                  3.1.0-hcfcfb64_0 --> 3.1.1-hcfcfb64_1
  pyopenssl                             23.1.1-pyhd8ed1ab_0 --> 23.2.0-pyhd8ed1ab_1
  requests                              2.28.2-pyhd8ed1ab_1 --> 2.31.0-pyhd8ed1ab_0
  ruamel.yaml                       0.17.21-py310h8d17308_3 --> 0.17.31-py310h8d17308_0
  urllib3                              1.26.15-pyhd8ed1ab_0 --> 2.0.3-pyhd8ed1ab_0
  vc                                       14.3-hb6edc58_10 --> 14.3-hb25d44b_16
  vs2015_runtime                    14.34.31931-h4c5c07a_10 --> 14.34.31931-hed1258a_16


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) C:\Users\username>conda config
Traceback (most recent call last):
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1132, in __call__
    return func(*args, **kwargs)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\cli\main.py", line 57, in main_subshell
    p = generate_parser()
  File "C:\Users\username\mambaforge\lib\site-packages\conda\cli\conda_argparse.py", line 63, in generate_parser
    p = ArgumentParser(
  File "C:\Users\username\mambaforge\lib\site-packages\conda\cli\conda_argparse.py", line 148, in __init__
    self._subcommands = context.plugin_manager.get_hook_results("subcommands")
  File "C:\Users\username\mambaforge\lib\site-packages\conda\base\context.py", line 419, in plugin_manager
    from ..plugins.manager import get_plugin_manager
  File "C:\Users\username\mambaforge\lib\site-packages\conda\plugins\__init__.py", line 3, in <module>
    from .hookspec import hookimpl  # noqa: F401
  File "C:\Users\username\mambaforge\lib\site-packages\conda\plugins\hookspec.py", line 10, in <module>
    from .types import CondaSolver, CondaSubcommand, CondaVirtualPackage
  File "C:\Users\username\mambaforge\lib\site-packages\conda\plugins\types.py", line 6, in <module>
    from ..core.solve import Solver
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\solve.py", line 19, in <module>
    from .index import get_reduced_index, _supplement_index_with_system
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\index.py", line 15, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\package_cache_data.py", line 22, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\path_actions.py", line 28, in <module>
    from ..gateways.connection.download import download
  File "C:\Users\username\mambaforge\lib\site-packages\conda\gateways\connection\__init__.py", line 6, in <module>
    from requests import ConnectionError, HTTPError, Session
  File "C:\Users\username\mambaforge\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\__init__.py", line 17, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\connectionpool.py", line 14, in <module>
    from ._request_methods import RequestMethods
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\_request_methods.py", line 10, in <module>
    from .response import BaseHTTPResponse
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 282, in <module>
    class BaseHTTPResponse(io.IOBase):
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 292, in BaseHTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\mambaforge\Scripts\conda-script.py", line 12, in <module>
    sys.exit(main())
  File "C:\Users\username\mambaforge\lib\site-packages\conda\cli\main.py", line 112, in main
    return conda_exception_handler(main, *args, **kwargs)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1432, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1135, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1175, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1186, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "C:\Users\username\mambaforge\lib\site-packages\conda\exceptions.py", line 1248, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "C:\Users\username\mambaforge\lib\site-packages\conda\cli\main_info.py", line 15, in <module>
    from ..core.index import _supplement_index_with_system
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\index.py", line 15, in <module>
    from .package_cache_data import PackageCacheData
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\package_cache_data.py", line 22, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "C:\Users\username\mambaforge\lib\site-packages\conda\core\path_actions.py", line 28, in <module>
    from ..gateways.connection.download import download
  File "C:\Users\username\mambaforge\lib\site-packages\conda\gateways\connection\__init__.py", line 6, in <module>
    from requests import ConnectionError, HTTPError, Session
  File "C:\Users\username\mambaforge\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\__init__.py", line 17, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\connectionpool.py", line 14, in <module>
    from ._request_methods import RequestMethods
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\_request_methods.py", line 10, in <module>
    from .response import BaseHTTPResponse
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 282, in <module>
    class BaseHTTPResponse(io.IOBase):
  File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 292, in BaseHTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'`

@github-actions github-actions bot added stale::recovered [bot] recovered after being marked as stale and removed stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity labels Jun 8, 2023
@jezdez
Copy link
Member

jezdez commented Jun 8, 2023

@aym00 Could you also paste the result of running conda list --show-channel-urls please?

@eeyrjmr
Copy link

eeyrjmr commented Jun 8, 2023

Its a bit bigger than just conda update. Jupyterlab doesn't launch for me now

Traceback (most recent call last):
  File "C:\STORAGE\Application\Miniconda3\Scripts\jupyter-lab-script.py", line 5, in <module>
    from jupyterlab.labapp import main
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab\__init__.py", line 8, in <module>
    from .handlers.announcements import (
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab\handlers\announcements.py", line 15, in <module>
    from jupyterlab_server.translation_utils import translator
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab_server\__init__.py", line 5, in <module>
    from .app import LabServerApp
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab_server\app.py", line 10, in <module>
    from .handlers import LabConfig, add_handlers
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab_server\handlers.py", line 18, in <module>
    from .listings_handler import ListingsHandler, fetch_listings
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\jupyterlab_server\listings_handler.py", line 8, in <module>
    import requests
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\urllib3\__init__.py", line 17, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\urllib3\connectionpool.py", line 14, in <module>
    from ._request_methods import RequestMethods
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\urllib3\_request_methods.py", line 10, in <module>
    from .response import BaseHTTPResponse
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\urllib3\response.py", line 277, in <module>
    class BaseHTTPResponse(io.IOBase):
  File "C:\STORAGE\Application\Miniconda3\lib\site-packages\urllib3\response.py", line 287, in BaseHTTPResponse
    DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'

(base) C:\STORAGE\Jupyter_sheets>

@slu216
Copy link

slu216 commented Jun 11, 2023

encountered the same issue after running the following update cmd. The update itself worked but cannot use conda install afterwards.

conda update conda

Traceback error as below
File "C:\Users\slu\miniforge3\lib\site-packages\urllib3\response.py", line 282, in <module> class BaseHTTPResponse(io.IOBase): File "C:\Users\slu\miniforge3\lib\site-packages\urllib3\response.py", line 292, in BaseHTTPResponse DECODER_ERROR_CLASSES += (brotli.error,) AttributeError: module 'brotli' has no attribute 'error'

The issue seems to be that "brotlicffi" cannot be found, and code tried to import brotlipy. Workaround I took here is commenting out try-except block, setting brotli to None, re-installing brotlipy. Then the code modification can be reverted.

try:
try:
import brotlicffi as brotli # type: ignore[import]
except ImportError:
import brotli # type: ignore[import]
except ImportError:
brotli = None

@digger-yu
Copy link

conda version : 23.3.1 have same problem

@Leanwithming
Copy link

conda version : 23.3.1 have same problem

I just try doing "pip install brotli"
It works for now.

@Awaiz-Malik
Copy link

I got my error fixed simply by
pip install brotlipy

my conda wasn't working at all and consistently giving this error, I won't paste the full error as it is very large but it is similar to.

File "C:\Users\username\mambaforge\lib\site-packages\urllib3_init_.py", line 17, in
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "C:\Users\username\mambaforge\lib\site-packages\urllib3\connectionpool.py", line 14, in
from ._request_methods import RequestMethods
File "C:\Users\username\mambaforge\lib\site-packages\urllib3_request_methods.py", line 10, in
from .response import BaseHTTPResponse
File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 282, in
class BaseHTTPResponse(io.IOBase):
File "C:\Users\username\mambaforge\lib\site-packages\urllib3\response.py", line 292, in BaseHTTPResponse
DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error

@ErikYoung89
Copy link

I saw a similar issue today when trying to run streamlit in a fresh environment.

(base)C:\Users\name\company\GitRepositories\iris_app>streamlit run app.py

  Welcome to Streamlit!

  If you’d like to receive helpful onboarding emails, news, offers, promotions,
  and the occasional swag, please enter your email address below. Otherwise,
  leave this field blank.

  Email:

2023-06-30 13:02:09.138 module 'brotli' has no attribute 'error'

I ran 'conda install brotlipy -y' and received the following:

==> WARNING: A newer version of conda exists. <==
current version: 23.3.0
latest version: 23.5.0

Please update conda by running

$ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

 conda install conda=23.5.0

The following NEW packages will be INSTALLED:

brotlipy pkgs/main/win-64::brotlipy-0.7.0-py39h2bbff1b_1003
cffi pkgs/main/win-64::cffi-1.15.1-py39h2bbff1b_3
pycparser pkgs/main/noarch::pycparser-2.21-pyhd3eb1b0_0

I have been using mamba primarily for my package management and had previously run 'mamba update mamba'. I was under the impression that they were functionally equivalent. After installing brotlipy via conda streamlit ran.

@algaebrown
Copy link

algaebrown commented Jul 14, 2023

Hi, I had the same issue after run "conda update conda anaconda", It show error beblow. File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 135, in <module> class HTTPResponse(io.IOBase): File "D:\Anaconda3\lib\site-packages\urllib3\response.py", line 357, in HTTPResponse DECODER_ERROR_CLASSES += (brotli.error,) AttributeError: module "brotli" has no attribute 'error'

My solution is: open file "Anaconda3\lib\site-packages\urllib3\response.py", find the code below DECODER_ERROR_CLASSES = (IOError, zlib.error) if brotli is not None: DECODER_ERROR_CLASSES += (brotli.error,) and update it to DECODER_ERROR_CLASSES = (IOError, zlib.error) Run anaconda navigator again.

This works.

  1. I make the modification above to site packages
  2. conda install brotlipy to fix
  3. undo the changes
  4. worked

System/versions:

  • Linux
  • miniconda 3
  • conda 22.9.0

@beeankha beeankha added the tag::update related to an upgrade issue label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source::community catch-all for issues filed by community members stale::recovered [bot] recovered after being marked as stale tag::ssl related to an SSL issue tag::update related to an upgrade issue
Projects
None yet
Development

No branches or pull requests