Questions tagged [uvloop]

uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood.

uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is released under the MIT license.

uvloop and asyncio, combined with the power of async/await in Python 3.5, makes it easier than ever to write high-performance networking code in Python.

uvloop makes asyncio fast. In fact, it is at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework. The performance of uvloop-based asyncio is close to that of Go programs.

You can read more about uvloop in this blog post.

32 questions
6
votes
5 answers

The 'uvloop>=0.14.0' distribution was not found and is required by uvicorn

I'm new at learning FastAPI, and I'm getting stuck at the very beginning. I keep getting the following error: (venv) root@Xue:/home/proyectos/FastAPI# uvicorn main.py:app --reload Traceback (most recent call last): File "/usr/bin/uvicorn", line 6,…
Xuerivera
  • 71
  • 1
  • 5
4
votes
1 answer

uvloop asks for python 3.7 but can be run with lower version

I am using an open-source python package 'farm-Haystack' in my school project. When I installed the requirements.txt in python3.6 venv I got this error : Complete output (5 lines): Traceback (most recent call last): File "", line…
chaos
  • 338
  • 4
  • 16
4
votes
2 answers

Using alternative event loop without setting global policy

I'm using uvloop with websockets as import uvloop coro = websockets.serve(handler, host, port) # creates new server loop = uvloop.new_event_loop() loop.create_task(coro) loop.run_forever() It works fine, I'm just wondering whether I could run to…
jhrmnn
  • 1,036
  • 9
  • 17
3
votes
1 answer

libuv vs asyncio (python)

I have been trying to find the difference in implementation of the uvloop and inbuilt asyncio that comes up with python. Apart from the fact that libuv the base of uvloop is written in c++, there is no other factor that is mentioned in the web. I…
3
votes
2 answers

How to access the asyncio / uvloop loop from C

I'm completely new to python, but have an async python app using uvloop which uses a C api module I created which also needs access to the async loop. 1) asyncio does not yet have a c-api for this? Any hacks to get an event loop usable in C? Is…
Craftables
  • 236
  • 1
  • 8
3
votes
2 answers

How to configure ExecStart for Gunicorn without WSGI?

Systemd and Gunicorn require a wsgi file of some sort as the last arg to ExecStart: http://docs.gunicorn.org/en/latest/deploy.html?highlight=ExecStart#systemd With Django, this was in the main module as…
davidtgq
  • 3,780
  • 10
  • 43
  • 80
2
votes
3 answers

Is it impossible developing with fastApi, uvloop, windows?

I'm learning fastapi from Youtube class I succeeded. except for the [uvloop] module I realized that uvloop doesn't install in windows and my development environment is Windows + PyCharm. How are others using this module? Are they only using…
gf160
  • 21
  • 1
  • 2
2
votes
0 answers

Using two PIP packages together that use event loops

I'm trying to combine a Twitch API package (twitchio) with a webserver (sanic) with the intent of serving chat commands to a game running locally to the python script. I don't have to use Sanic or twitchio but those are the best results I've found…
STEBS_TC
  • 21
  • 1
2
votes
1 answer

gunicorn threads not making any difference

Below is the linux top output when I load a python app pipenv run gunicorn --worker-class=uvicorn.workers.UvicornWorker readme.main:app --bind=0.0.0.0 a) No Load top Tasks: 5 total, 1 running, 4 sleeping, 0 stopped, 0 zombie %Cpu(s): 6.0…
crackerplace
  • 5,305
  • 8
  • 34
  • 42
2
votes
1 answer

pip install uvloop causes permission denied error

I try to install uvloop into a Python 3.9 venv on CentOS 7. These are all actions I take: cd ~ mkdir python_envs cd python_envs python -m venv test source test/bin/activate pip install --upgrade pip pip install uvloop Then I get this: Collecting…
David Chung
  • 496
  • 5
  • 10
2
votes
2 answers

How to catch custom exception from signal handler in asyncio?

I'm having problems catching a custom exception when thrown from a signal handler callback when using asyncio. If I throw ShutdownApp from within do_io() below, I am able to properly catch it in run_app(). However, when the exception is raised from…
HiddenNetwork
  • 97
  • 1
  • 8
2
votes
0 answers

How to serve Tensorflow model with multi-process uvloop server (Sanic)?

I am having some issues running a Tensorflow model with a uvloop based server (Sanic) even though it works fine with Flask. I think it has something to do with how Sanic spawns multiple processes? I say this because if I run Sanic with 1 worker…
DamianJ
  • 419
  • 2
  • 8
  • 18
2
votes
0 answers

Is there any way Load balancing on a preforked multi process TCP server build by asyncio?

Thaks for guys in previous answer, now I can build a multi process TCP server with each process running a asynchronous server respectively but all binding to one port. (Could not use os.fork() bind several process to one socket server when using…
AdamHommer
  • 657
  • 7
  • 22
1
vote
0 answers

Uvloop Bad Installation on Docker

This was an issue when I was building my docker image and experienced a failure when trying to install uvloop in my requirements file when building a docker image using python:3.10-alpine and using uvloop version uvloop==0.16.0 the following will…
1
vote
0 answers

How do I run a Gunicorn server with a worker class from a Python code?

I used to run a certain application with a shell script having the following contents. gunicorn someapp.server:init_app --bind 0.0.0.0:8080 --worker-class aiohttp.GunicornUVLoopWebWorker In order to make sure that the application is configurable in…
1
2 3