Pandas import error: module 'bottleneck' has no attribute '__version__'
Asked Answered
H

5

6

I have been using pandas, tensorflow for a few months, but suddenly today I cannot import them. When I try to:

import pandas as pd

It will show:

File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\__init__.py", line 42, in <module>
  from pandas.core.api import *
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\api.py", line 9, in <module>
  from pandas.core.categorical import Categorical
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\categorical.py", line 36, in <module>
  from pandas.core.base import (PandasObject,
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\base.py", line 20, in <module>
  import pandas.core.nanops as nanops
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\nanops.py", line 30, in <module>
  ver = bn.__version__
AttributeError: module 'bottleneck' has no attribute '__version__'

May I know what I can do? I have installed Bottleneck, but seems error still appears.

Hamstring answered 25/2, 2018 at 2:18 Comment(3)
Install anaconda. create conda env and then installLipkin
I don't know about this error. But, I usually create a conda environment (for error free installation) instead of installing libraries in my local machine. May be, you can try that.Broach
What actions did you take on the machine between the time when it worked and the time when it failed? For example did you install or remove any packages?Watersick
M
7

I got the same problem. I don't really know what it means, but it seems that something must be wrong in the module 'bottleneck'. Then I solved it by :

conda remove bottleneck

conda install bottleneck

Yes, simply reinstall bottleneck, my problem has been solved. Hope this could help you.

Magruder answered 18/11, 2018 at 11:7 Comment(0)
A
3

I had the same issue, resolved it by upgrading bottleneck then pandas:

pip install --upgrade bottleneck
pip install --upgrade pandas
Andromeda answered 5/7, 2020 at 17:15 Comment(0)
L
0

I solved it by (re)installing it [conda|pip] install Bottleneck

Lawrenson answered 12/4, 2020 at 1:39 Comment(0)
E
0

Installing and upgrading bottleneck did it for me too. Don't forget to add the bang if you're inside of the Jupyter Notebook.

!pip install --upgrade bottleneck
Ecru answered 21/8 at 17:37 Comment(2)
Please, for running inside modern Jupyter suggest the magic symbol and not an exclamation point. In 2019 the developers added to Jupyter the magic variantm specifically %pip install, that ensures the installation occurs in the environment where the kernel backing the notebook is running. The exclamation point in combination with an install command does not to that and would quite often lead to issues. See more about the modern %pip install command here. ...Wigley
<continued> The second paragraph here goes into more details about why the exclamation point may lead to issues. You'll have a better experience in modern Jupyter everywhere, including Google Colab and JupyterLite, using this more updated version.Wigley
R
-1

To solve this I performed the following actions:

  • Uninstalled Pandas
  • Uninstalled Bottleneck
  • Executed conda install bottleneck
Raffish answered 3/6, 2020 at 12:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.