Python-slack-sdk: AttributeError: module 'slack' has no attribute 'WebClient'

Created on 10 Jun 2019  路  7Comments  路  Source: slackapi/python-slack-sdk

Description

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'

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [ ] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version: 2.0.0

python version: 3.7.3

OS version(s): macOS Mojave version 10.14 (18A391)

Steps to reproduce:

  1. Installed slackclient with pip3 by doing: pip3 install slackclient
  2. Ran the following code in shell:
import os
import slack

client = slack.WebClient(token="[my token as a string]")

Expected result:

Expected code to run without error.

Actual result:

Recieved the following error:

AttributeError: module 'slack' has no attribute 'WebClient'

Attachments:

Looking for clues to solve the problem.

Screen Shot 2019-05-20 at 12 15 51 AM

Most helpful comment

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

All 7 comments

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)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avinassh picture avinassh  路  3Comments

seratch picture seratch  路  3Comments

vv-grinko picture vv-grinko  路  3Comments

tinoargentino picture tinoargentino  路  4Comments

Terrance picture Terrance  路  3Comments