aiotasks
aiotasks copied to clipboard
AttributeError: module 'concurrent' has no attribute 'futures'
Hi, thanks for the project, the use case seems promising. I've been meaning to test it for a while and ended up installing python 3 to try it and run into this issue with all scripts:
$ aiotasks -vvvv worker -A examples.launch_manager_tasks_and_launch_in_console
Traceback (most recent call last):
File "/Users/hassene/Projects/personal/spiga/env/bin/aiotasks", line 11, in <module>
load_entry_point('aiotasks', 'console_scripts', 'aiotasks')()
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2751, in load_entry_point
return ep.load()
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2405, in load
return self.resolve()
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/aiotasks/__init__.py", line 1, in <module>
from .core import *
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/aiotasks/core/__init__.py", line 4, in <module>
from .exceptions import *
File "/Users/hassene/Projects/personal/spiga/env/lib/python3.6/site-packages/aiotasks/core/exceptions.py", line 16, in <module>
class AioTasksTimeout(concurrent.futures.TimeoutError):
AttributeError: module 'concurrent' has no attribute 'futures'
Do you have any idea what I'm doing wrong or is there something broken?
What version of Python are you using?
Python 3.6.2
@kardaj I think that you use python 2 by default. Type in console: python
and check version.
I try run on last docker python3 (alpine) and get error
/ # negash@DevOps:~/Downloads/aiotasks-master$ docker run -it --rm -v `pwd`:/data --link redis python:alpine sh
/ # apk add --update build-base
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/19) Installing binutils-libs (2.26-r1)
(2/19) Installing binutils (2.26-r1)
(3/19) Installing gmp (6.1.0-r0)
(4/19) Installing isl (0.14.1-r0)
(5/19) Installing libgomp (5.3.0-r0)
(6/19) Installing libatomic (5.3.0-r0)
(7/19) Installing libgcc (5.3.0-r0)
(8/19) Installing pkgconf (0.9.12-r0)
(9/19) Installing pkgconfig (0.25-r1)
(10/19) Installing mpfr3 (3.1.2-r0)
(11/19) Installing mpc1 (1.0.3-r0)
(12/19) Installing libstdc++ (5.3.0-r0)
(13/19) Installing gcc (5.3.0-r0)
(14/19) Installing make (4.1-r1)
(15/19) Installing musl-dev (1.1.14-r16)
(16/19) Installing libc-dev (0.7-r0)
(17/19) Installing fortify-headers (0.8-r0)
(18/19) Installing g++ (5.3.0-r0)
(19/19) Installing build-base (0.4-r1)
Executing busybox-1.24.2-r14.trigger
OK: 183 MiB in 53 packages
/ # pip install aiotasks
Collecting aiotasks
Downloading aiotasks-1.0.0.tar.gz
Collecting click (from aiotasks)
Downloading click-6.7-py2.py3-none-any.whl (71kB)
100% |████████████████████████████████| 71kB 789kB/s
Collecting aioredis (from aiotasks)
Downloading aioredis-1.0.0-py3-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 1.7MB/s
Collecting colorlog (from aiotasks)
Downloading colorlog-3.1.0-py2.py3-none-any.whl
Collecting booby-ng (from aiotasks)
Downloading booby-ng-0.8.4.tar.gz
Collecting msgpack-python (from aiotasks)
Downloading msgpack-python-0.4.8.tar.gz (113kB)
100% |████████████████████████████████| 122kB 4.3MB/s
Collecting hiredis (from aioredis->aiotasks)
Downloading hiredis-0.2.0.tar.gz (46kB)
100% |████████████████████████████████| 51kB 7.8MB/s
Collecting async-timeout (from aioredis->aiotasks)
Downloading async_timeout-2.0.0-py3-none-any.whl
Collecting six (from booby-ng->aiotasks)
Downloading six-1.11.0-py2.py3-none-any.whl
Building wheels for collected packages: aiotasks, booby-ng, msgpack-python, hiredis
Running setup.py bdist_wheel for aiotasks ... done
Stored in directory: /root/.cache/pip/wheels/be/5e/87/96b6333f18ac8121b73aa7c86ad06eaefa14ecf7960410ec0e
Running setup.py bdist_wheel for booby-ng ... done
Stored in directory: /root/.cache/pip/wheels/d1/47/d5/f4e7f9c911c968126f53fdbffb358f62fe7fbe87a648664c93
Running setup.py bdist_wheel for msgpack-python ... done
Stored in directory: /root/.cache/pip/wheels/2c/e7/e7/9031652a69d594665c5ca25e41d0fb3faa024e730b590e4402
Running setup.py bdist_wheel for hiredis ... done
Stored in directory: /root/.cache/pip/wheels/89/c4/9a/dbb963914093f15334b0a8c168f478a9e20ab361de4b0c3822
Successfully built aiotasks booby-ng msgpack-python hiredis
Installing collected packages: click, hiredis, async-timeout, aioredis, colorlog, six, booby-ng, msgpack-python, aiotasks
Successfully installed aioredis-1.0.0 aiotasks-1.0.0 async-timeout-2.0.0 booby-ng-0.8.4 click-6.7 colorlog-3.1.0 hiredis-0.2.0 msgpack-python-0.4.8 six-1.11.0
/ # ls
bin data dev etc home lib linuxrc media mnt proc root run sbin srv sys tmp usr var
/ # cd data/
/data # ls
CHANGELOG.md LICENSE TODO.md deploy examples_old requirements-doc.txt setup.py
CONTRIBUTORS.md MANIFEST.in aiotasks doc pytest.ini requirements-performance.txt tests
Dockerfile README.rst codecov.yml examples requirements-dev.txt requirements.txt tox.ini
/data # aiotasks -vvvv worker -A examples.launch_manager_tasks_and_launch_in_console
Traceback (most recent call last):
File "/usr/local/bin/aiotasks", line 7, in <module>
from aiotasks.actions.default.cli import cli
File "/usr/local/lib/python3.6/site-packages/aiotasks/__init__.py", line 1, in <module>
from .core import *
File "/usr/local/lib/python3.6/site-packages/aiotasks/core/__init__.py", line 4, in <module>
from .exceptions import *
File "/usr/local/lib/python3.6/site-packages/aiotasks/core/exceptions.py", line 16, in <module>
class AioTasksTimeout(concurrent.futures.TimeoutError):
AttributeError: module 'concurrent' has no attribute 'futures'
/data #
/data # ping redis
PING redis (172.17.0.5): 56 data bytes
64 bytes from 172.17.0.5: seq=0 ttl=64 time=0.125 ms
64 bytes from 172.17.0.5: seq=1 ttl=64 time=0.066 ms
64 bytes from 172.17.0.5: seq=2 ttl=64 time=0.062 ms
^C
--- redis ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.062/0.084/0.125 ms
/data #
build with Dockerfile in repo
Traceback (most recent call last):
File "/usr/local/bin/aiotasks", line 7, in <module>
from aiotasks.actions.default.cli import cli
File "/usr/local/lib/python3.5/site-packages/aiotasks/__init__.py", line 1, in <module>
from .core import *
File "/usr/local/lib/python3.5/site-packages/aiotasks/core/__init__.py", line 4, in <module>
from .exceptions import *
File "/usr/local/lib/python3.5/site-packages/aiotasks/core/exceptions.py", line 16, in <module>
class AioTasksTimeout(concurrent.futures.TimeoutError):
AttributeError: module 'concurrent' has no attribute 'futures'
If build from source in alpine all is Ok)
@polosatyi just tried from another computer. I have the same error.
$ python --version
Python 3.6.3
import concurrent.futures
import aiotasks
can help
good good
Looking for a library like this to replace celery but am getting the same issue.
For your info:
$ python --version
Python 3.6.4
I am using Python 3.5.2
This can be fixed by replacing import concurrent
with import concurrent.futures
in the following file.
/usr/local/lib/python3.5/site-packages/aiotasks/core/exceptions.py
If you're in a virtualenv you would find the following file here : path_to_virtualenv/lib/python3.5/site-packages/aiotasks/core/exceptions.py
But after this I get the following error -
Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step result = coro.send(None) File "/usr/lib/python3.5/asyncio/tasks.py", line 345, in wait fs = {ensure_future(f, loop=loop) for f in set(fs)} File "/usr/lib/python3.5/asyncio/tasks.py", line 345, in <setcomp> fs = {ensure_future(f, loop=loop) for f in set(fs)} File "/usr/lib/python3.5/asyncio/tasks.py", line 554, in ensure_future raise TypeError('A Future, a coroutine or an awaitable is required') TypeError: A Future, a coroutine or an awaitable is required
Please advise.
I am facing the same issue too.
FROM python:3.6-slim
my python version.
Hi all, I am using Python 3.7.9, I am getting above issue. Here is my code block: `import concurrent.futures import time
start = time.perf_counter()
def do_smt(seconds=1): print("sleep {seconds} sec".format(seconds=seconds)) time.sleep(seconds) return 'Done something...\n'
with concurrent.futures.ProcessPoolExecutor() as executor: f1 = executor.submit(do_smt, 1) print(f1.result())
finish = time.perf_counter() print('Finished in {} second(s)'.format(round(finish - start, 2)))`
And here is traceback:
File "<MY_FILE.py>", line 1, in <module> import concurrent.futures File "/usr/lib/python3.7/concurrent/futures/__init__.py", line 8, in <module> from concurrent.futures._base import (FIRST_COMPLETED, File "/usr/lib/python3.7/concurrent/futures/_base.py", line 7, in <module> import logging File "/usr/lib/python3.7/logging/__init__.py", line 40, in <module> import threading File "<MY_FILE.py>", line 13, in <module> with concurrent.futures.ProcessPoolExecutor() as executor: AttributeError: module 'concurrent' has no attribute 'futures'
Could you please help to solve this ?
Regards, Gevorg
Hi all,
about above comment - I use pycharm and I have been faced above issue.
As of now I have removed __pycache__
folder, removed all *.pyc
files.
And now it works as expected.
So if you use an IDE, it might be helpful to remove all caches, and there is also one point in jetbrains products to remove caches.
You can open File -> invalidate caches / restart
and do restart.
Regards, Gevorg.