The following code:
import os
import slack
client = slack.WebClient(token=os.environ[鈥榵xxx鈥橾)
Gives the following error:
AttributeError: module 'slack' has no attribute 'WebClient'
x in one of the [ ])x in each of the [ ])Filling out the following details about bugs will help us solve your issue sooner.
slackclient version: 2.0.0
python version: 3.7.3
OS version(s): macOS Mojave version 10.14 (18A391)
pip3 install slackclientimport os
import slack
client = slack.WebClient(token="[my token as a string]")
Expected code to run without error.
Recieved the following error:
AttributeError: module 'slack' has no attribute 'WebClient'
Looking for clues to solve the problem.

Hey @SethConnell. Are you running this in a virtual environment? I wanna confirm if your using python or python3 to run your script? Can you run pip3 freeze | grep slackclient and tell me what version you get back? It sounds like for whatever reason, you've ended up with a version < 2.0.0. You may need to run pip3 uninstall slackclient followed by pip3 install slackclient afterwards. Just be sure you don't get any errors on the uninstall
Let us know how you get on
Ok, so uninstalling slackclient and reinstalling it worked for some reason.
I was not running the code in a virtual environment. And I was using python3 to run the script.
Before I uninstalled slackclient, I ran pip3 freeze | grep slackclient, and it said slackclient==2.0.0.
Weird.
Regardless, thank you for your help!
No worries! Glad you got sorted!
I just had this same issue with slackclient 2.3.1
pip3 uninstall slackclient with pip3 install slackclient resolved the issue.
I have the same problem and have everything installed in a
pipenv. Reinstalling does not fix this for me.
False alarm. I had called my local module slack which was aliasing the global module in my site-packages.
For me also uninstalling and installing slackclient solved the trick
I currently have the same issue. First time download the slackclient and she only gets version 1.3.2 using pip3.
ERROR: Could not find a version that satisfies the requirement slackclient==2 (from versions: 0.13, 0.14, 0.15, 0.16, 0.17, 0.18.0, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2)
Most helpful comment
Hey @SethConnell. Are you running this in a virtual environment? I wanna confirm if your using
pythonorpython3to run your script? Can you runpip3 freeze | grep slackclientand tell me what version you get back? It sounds like for whatever reason, you've ended up with a version < 2.0.0. You may need to runpip3 uninstall slackclientfollowed bypip3 install slackclientafterwards. Just be sure you don't get any errors on the uninstallLet us know how you get on