not found module slack, when i pip3 install slackclient
not import slack
@dewei12138 I ran into this trouble yesterday with newly installed package slackclient through pip3. It always caused an error with ModuleNotFoundError.
Can you try "import slack" instead of "import slack_client"?
(firstslackbot) cnemelka@us_dev_db_rw:$ pip install slackclient
Requirement already satisfied: slackclient in ./firstslackbot/lib/python3.6/site-packages
Requirement already satisfied: aiohttp>3.5.2 in ./firstslackbot/lib/python3.6/site-packages (from slackclient)
Requirement already satisfied: yarl<2.0,>=1.0 in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: async-timeout<4.0,>=3.0 in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: multidict<5.0,>=4.0 in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: idna-ssl>=1.0; python_version < "3.7" in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: typing-extensions>=3.6.5; python_version < "3.7" in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: attrs>=17.3.0 in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: chardet<4.0,>=2.0 in ./firstslackbot/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient)
Requirement already satisfied: idna>=2.0 in ./firstslackbot/lib/python3.6/site-packages (from yarl<2.0,>=1.0->aiohttp>3.5.2->slackclient)
(firstslackbot) cnemelka@us_dev_db_rw:$ python starterbot.py
Traceback (most recent call last):
File "starterbot.py", line 4, in
from slackclient import SlackClient
ModuleNotFoundError: No module named 'slackclient'
same issue here.
@cnemelka Like I said. slackclient just migrated to v2 and the import package name was changed from "slack_client" to "slack".
Traceback (most recent call last):
File "t.py", line 4, in
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
AttributeError: module 'slack' has no attribute 'WebClient'
You'll note this example is from the "migration guide"
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
import slack
from slack import SlackClient
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'SlackClient'
from slack import slackclient
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'slackclient'
same issue in windows 10
(slackbot) PS C:\Users\cnemelka\slackbot> python t.py
Traceback (most recent call last):
File "t.py", line 4, in
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
AttributeError: module 'slack' has no attribute 'WebClient'
(slackbot) PS C:\Users\cnemelka\slackbot> pip freeze
slack==0.0.2
--cnemelka
On Tue, Jul 2, 2019 at 12:42 PM skasidej notifications@github.com wrote:
@cnemelka https://github.com/cnemelka Like I said. slackclient just
migrated to v2 and the import package name was changed from "slack_client"
to "slack".—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AGQQDJF7ZGUOTVNVFLSYSNTP5OOQTA5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCGG6I#issuecomment-507798393,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGQQDJGIXKD2YHS3SINIFTDP5OOQTANCNFSM4H4Y26ZA
.
It looks like your installed package is out of date. The command in the readme is not enough to upgrade the slackclient package--only enough to install it fresh.
You can check what version of slackclient you have installed by running:
$ pip3 list
You should be able to find slackclient in the list & you might see something like...
Package Version
---------------- ---------
... ...
slackclient 1.3.2
... ...
As of writing, the latest version is 2.1.0. The above output indicates that my installed is outdated.
When you run pip3 install slackclient, PyPI only cares that any version of slackclient is installed. If you already have an old version installed, that constraint is already met (you already have "any version" of slackclient installed).
PyPI provides a flag to update the targeted package to its latest version:
$ pip3 install slackclient --upgrade
After that, running pip3 list should show you on the latest version (which is 2.1.0 as of writing).
thank you for the response. I performed the upgrade. Still having issues
with module not found. this is the only module currently exhibiting this
behavior.
cnemelka@us_dev_db_rw:$ pip3 list | egrep slackclient
slackclient (2.1.0)
cnemelka@us_dev_db_rw:$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
import slackclient
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'slackclient'
Any other hints?
--cnemelka
On Tue, Jul 2, 2019 at 3:17 PM Calvin notifications@github.com wrote:
It looks like your installed package is out of date. The command in the
readme is not enough to upgrade the slackclient package--only enough to
install it fresh.You can check what version of slackclient you have installed by running:
$ pip3 list
You should be able to find slackclient in the list & you might see
something like...Package Version
... ...
slackclient 1.3.2
... ...As of writing, the latest version is 2.1.0. The above output indicates
that my installed is outdated.When you run pip3 install slackclient, PyPI only cares that any version
of slackclient is installed. If you already have an old version
installed, that constraint is already met (you already have "any
version" of slackclient installed).
So how do I upgrade?PyPI provides a flag to update the targeted package to its latest version:
$ pip3 install slackclient --upgrade
After that, running pip3 list should show you on the latest version
(which is 2.1.0 as of writing).—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AGQQDJBEX5AI2BGVU7WYHOLP5PAVNA5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCSJZI#issuecomment-507847909,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGQQDJHZ4H7UAK7MJFZUOLDP5PAVNANCNFSM4H4Y26ZA
.
Ah, while the PyPI package is called slackclient, you import the module using the name slack:
import slack
# or (for example):
from slack import WebClient
That cleared it up. Thank you for your time!
--cnemelka
On Tue, Jul 2, 2019 at 4:52 PM Calvin notifications@github.com wrote:
Ah, while the PyPI package is called slackclient, you import the module
using the name slack:import slack
or (for example):
from slack import WebClient
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AGQQDJFFDWWJ5R5KWLCSZRDP5PLZHA5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCYP2A#issuecomment-507873256,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGQQDJAWUTWEKV5GMQV557TP5PLZHANCNFSM4H4Y26ZA
.
Looks good! Thanks for that @clavin , closing this up for now
I am still having the same issue. I am using virtual environment with python 3.6.7 and django 2.2 on ubuntu 18.04.
terminal View:
pip install slack
followed by python manage.py shell_plus
import slack raises following error:
Traceback (most recent call last):
File "~/utils/slack_setup.py", line 1, in <module>
from slack import WebClient
File "~/venv/lib/python3.6/site-packages/slack/__init__.py", line 4, in <module>
from slack.web.client import WebClient # noqa
File "~/venv/lib/python3.6/site-packages/slack/web/client.py", line 9, in <module>
from slack.web.base_client import BaseClient, SlackResponse
File "~/venv/lib/python3.6/site-packages/slack/web/base_client.py", line 15, in <module>
import aiohttp
File "~/venv/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import (
File "~/venv/lib/python3.6/site-packages/aiohttp/client.py", line 32, in <module>
from . import hdrs, http, payload
File "~/venv/lib/python3.6/site-packages/aiohttp/http.py", line 7, in <module>
from .http_parser import (
File "~/venv/lib/python3.6/site-packages/aiohttp/http_parser.py", line 15, in <module>
from .helpers import NO_EXTENSIONS, BaseTimerContext
File "~/venv/lib/python3.6/site-packages/aiohttp/helpers.py", line 223, in <module>
@attr.s(frozen=True, slots=True)
File "~/venv/lib/python3.6/site-packages/aiohttp/helpers.py", line 225, in ProxyInfo
proxy = attr.ib(type=URL)
TypeError: attr() got an unexpected keyword argument 'type'
Upon carefully look around, issue persists only on ubuntu. I was unable to replicate the issue with Windows machine.
Getting this error:
```python send.py xyz test
Traceback (most recent call last):
File "send.py", line 10, in
client = slack.WebClient(token=token)
AttributeError: module 'slack' has no attribute 'WebClient'
Running on AWS Linux box.
slackclient (2.1.0)
python --version
Python 3.6.8 :: Anaconda, Inc.
Code:
```from sys import argv
import os
import slack
token=os.environ['SLACK_API_TOKEN']
assert token is not None
channel = argv[1]
message = argv[2]
client = slack.WebClient(token=token)
response = client.chat_postMessage( channel=channel, text=message)
assert response["ok"]
assert response["message"]["text"] == message
Is there a work-around?
this works for me:
from slack import WebClient
client = WebClient(token=os.environ['SLACK_API_TOKEN'])
--cnemelka
On Fri, Jul 26, 2019 at 3:04 PM Joel Hull notifications@github.com wrote:
Getting this error:
Traceback (most recent call last):
File "send.py", line 10, in
client = slack.WebClient(token=token)AttributeError: module 'slack' has no attribute 'WebClient'Running on AWS Linux box.
slackclient (2.1.0)
python --version
Python 3.6.8 :: Anaconda, Inc.Code:
import os
import slacktoken=os.environ['SLACK_API_TOKEN']
assert token is not Nonechannel = argv[1]
message = argv[2]
client = slack.WebClient(token=token)
response = client.chat_postMessage( channel=channel, text=message)
assert response["ok"]
assert response["message"]["text"] == messageIs there a work-around?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AGQQDJHA3NHWN6MA7UDO34DQBNRHBA5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25WWZQ#issuecomment-515599206,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGQQDJABFU3FNXRB2OVUETDQBNRHBANCNFSM4H4Y26ZA
.
I uninstalled the slackclient package and re-installed and now it works. My theory is that some of the dependencies are not correctly resolved on the initial install.
Thank you.
On Jul 26, 2019, at 9:39 PM, cnemelka notifications@github.com wrote:
this works for me:
from slack import WebClient
client = WebClient(token=os.environ['SLACK_API_TOKEN'])
--cnemelka
On Fri, Jul 26, 2019 at 3:04 PM Joel Hull notifications@github.com wrote:
Getting this error:
Traceback (most recent call last):
File "send.py", line 10, in
client = slack.WebClient(token=token)AttributeError: module 'slack' has no attribute 'WebClient'Running on AWS Linux box.
slackclient (2.1.0)
python --version
Python 3.6.8 :: Anaconda, Inc.Code:
import os
import slacktoken=os.environ['SLACK_API_TOKEN']
assert token is not Nonechannel = argv[1]
message = argv[2]
client = slack.WebClient(token=token)
response = client.chat_postMessage( channel=channel, text=message)
assert response["ok"]
assert response["message"]["text"] == messageIs there a work-around?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AGQQDJHA3NHWN6MA7UDO34DQBNRHBA5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25WWZQ#issuecomment-515599206,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGQQDJABFU3FNXRB2OVUETDQBNRHBANCNFSM4H4Y26ZA
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/slackapi/python-slackclient/issues/471?email_source=notifications&email_token=AI3ZL6K2IRHN6HJODKYG6BLQBNVK5A5CNFSM4H4Y26ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25YXIA#issuecomment-515607456, or mute the thread https://github.com/notifications/unsubscribe-auth/AI3ZL6LM3TM73IX3OSLWNPLQBNVK5ANCNFSM4H4Y26ZA.
Hi! Same issue here.
I am using version slackclient 2.1.0
Code:
import os
import slack
from slack import WebClient
client = WebClient(token=os.environ["bot_token"])
response = client.chat_postMessage(
channel='#alertas',
text="Test")
assert response["ok"]
But i am getting ImportError: cannot import name 'WebClient' from 'slack'
Any thoughts?
I am having the same problem as others have mentioned. I can't do
from slack import WebClient
I get this error:
ImportError: cannot import name 'WebClient'
This worked for me: make sure you do not have any files of your own named _slack.py_.
A simple filename change to something more original solved my problem.
This was my setup:
This worked for me: make sure you do not have any files of your own named _slack.py_.
YES, this is the issue, I've a file name slack.py
Just rename it.
I just got here because I was running old python version by mistake, python3.5.
If you can't find slackclient==2.X, upgrade python 🤞
I not 100% sure if it is a solution, but worked for me: if I don't use my virtual enviroment I can install without issues slackclient
Most helpful comment
This worked for me: make sure you do not have any files of your own named _slack.py_.
A simple filename change to something more original solved my problem.
This was my setup: