Python-slack-sdk: ModuleNotFoundError: No module named 'slack'

Created on 2 May 2020  路  6Comments  路  Source: slackapi/python-slack-sdk

Couldn't find module named 'slack' after I pip3 install slackclient.

$ pip3 list
Package        Version
-------------- -------
...
slack          0.0.2
slackclient    2.5.0
...
$ python3
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import slack
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'slack'
>>> exit()
2x question

All 6 comments

@KoenChiu Finally, I figured out why this issue has been repeatedly reported 馃槄Running pip uninstall slack should work for you!

ModuleNotFoundError: No module named 'slack'

hmm, this may be due to a bit different reason. but it's worth trying to remove the slack PyPI package (this project is slackclient)

ModuleNotFoundError: No module named 'slack'

hmm, this may be due to a bit different reason. but it's worth trying to remove the slack PyPI package (this project is slackclient)

Hi @seratch ,
Yep, actually I only install slackclient package through pip3 at first. Then I encountered the issues I mentioned when I try to import slack in my python app.
So I think if I need another package like slack. But it still doesnt work.

At least having slack PyPI package prevents you from loading slack package after resolving the issue described here. So, please uninstall it anyways.

>>> import slack
>>> from slack import WebClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'WebClient' from 'slack' (/Users/ksera/.pyenv/versions/3.8.2/lib/python3.8/site-packages/slack/__init__.py)
>>> slack.
slack.ComponentNotRegisteredError(  slack.ParamterMissingError(         slack.inspect                       slack.partial(                      
slack.Container(                    slack.defaultdict(                  slack.invoke(                       
>>> slack.
slack.ComponentNotRegisteredError(  slack.ParamterMissingError(         slack.inspect                       slack.partial(                      
slack.Container(                    slack.defaultdict(                  slack.invoke(                       

Do you use anaconda or others for Python installation? If you go with a straight-forward way (e.g., pyenv + virtualenv or venv), you can smoothly install the package.

You don't need to use pyenv if you prefer others but the following steps should be much easier.

$ brew install pyenv
$ pyenv install 3.7.0
$ pyenv local 3.7.0
$ python --version
Python 3.7.0
$ python -m venv env
$ source env/bin/activate
(env) $ pip install slackclient
(env) $ pip list
Package       Version
------------- -------
aiohttp       3.6.2  
async-timeout 3.0.1  
attrs         19.3.0 
chardet       3.0.4  
idna          2.9    
multidict     4.7.5  
pip           10.0.1 
setuptools    39.0.1 
slackclient   2.5.0  
yarl          1.4.2  
(env) $ python
Python 3.7.0 (default, May  3 2020, 12:54:06) 
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import slack
>>> from slack import WebClient
>>> slack.__file__
'/path-to-project/env/lib/python3.7/site-packages/slack/__init__.py'

At least having slack PyPI package prevents you from loading slack package after resolving the issue described here. So, please uninstall it anyways.

>>> import slack
>>> from slack import WebClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'WebClient' from 'slack' (/Users/ksera/.pyenv/versions/3.8.2/lib/python3.8/site-packages/slack/__init__.py)
>>> slack.
slack.ComponentNotRegisteredError(  slack.ParamterMissingError(         slack.inspect                       slack.partial(                      
slack.Container(                    slack.defaultdict(                  slack.invoke(                       
>>> slack.
slack.ComponentNotRegisteredError(  slack.ParamterMissingError(         slack.inspect                       slack.partial(                      
slack.Container(                    slack.defaultdict(                  slack.invoke(                       

Do you use anaconda or others for Python installation? If you go with a straight-forward way (e.g., pyenv + virtualenv or venv), you can smoothly install the package.

You don't need to use pyenv if you prefer others but the following steps should be much easier.

$ brew install pyenv
$ pyenv install 3.7.0
$ pyenv local 3.7.0
$ python --version
Python 3.7.0
$ python -m venv env
$ source env/bin/activate
(env) $ pip install slackclient
(env) $ pip list
Package       Version
------------- -------
aiohttp       3.6.2  
async-timeout 3.0.1  
attrs         19.3.0 
chardet       3.0.4  
idna          2.9    
multidict     4.7.5  
pip           10.0.1 
setuptools    39.0.1 
slackclient   2.5.0  
yarl          1.4.2  
(env) $ python
Python 3.7.0 (default, May  3 2020, 12:54:06) 
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import slack
>>> from slack import WebClient
>>> slack.__file__
'/path-to-project/env/lib/python3.7/site-packages/slack/__init__.py'

Thanks for your reply, @seratch
It work for me under virtual environment of python. Verify to close this issue.

I had this same error and found that the problem was my python settings in Visual Studio Code. I needed to change my python path from "/usr/bin/python" to "/usr/local/bin/python3" in the settings.json file. More details here.

Not sure if that was the editor you were using, but essentially whenever I pressed the little play button at the top right corner of the editor, to run my python file in the Visual Studio Code terminal, it was running the command python instead of python3 on the file.

Hope this helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Terrance picture Terrance  路  3Comments

seratch picture seratch  路  3Comments

marshallino16 picture marshallino16  路  3Comments

charlesreid1 picture charlesreid1  路  3Comments

LMPK picture LMPK  路  3Comments