Library python asyncio

1

Hello, I'm trying to install the asyncio library for Python 2.7.13 but I'm not getting success, it follows the error:

  

rafamttz @ rafamttz: ~ $ pip install asyncio '

     

Collecting asyncio Retrying (Retry (total = 4, connect = None,   read = None, redirect = None, status = None)) after connection broken by   'ProtocolError (' Connection aborted. ', Error (107,' Transport endpoint   is not connected '))': / simple / asyncio / Installing collected packages:   asyncio '

     

Exception: Traceback (most recent call last): File   "/home/rafamttz/.local/lib/python2.7/site-packages/pip/basecommand.py",   line 215, in main       status = self.run (options, args) File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/commands/install.py",   line 342, in run prefix = options.prefix_path, File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/req/req_set.py",   line 784, in install       ** kwargs File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/req/req_install.py",   line 851, in install       self.move_wheel_files (self.source_dir, root = root, prefix = prefix) File   "/home/rafamttz/.local/lib/python2.7/site-packages/pip/req/req_install.py",   line 1064, in move_wheel_files       isolated = self.isolated, File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/wheel.py", line   345, in move_wheel_files       clobber (source, lib_dir, True) File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/wheel.py", line   316, in clobber       ensure_dir (destdir) File "/home/rafamttz/.local/lib/python2.7/site-packages/pip/utils/init.py",   line 83, in ensure_dir       os.makedirs (path) File "/usr/lib/python2.7/os.py", line 157, in makedirs       mkdir (name, mode) OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/asyncio'

How do I install this library? What do I need?

    
asked by anonymous 28.03.2018 / 02:02

1 answer

0

The recommandation for development is to use the latest Python 3.6 - installing Python 3.6 on your server is a trivial problem compared to trying to create using asynchronous code for Python 2.

But basically: when the idea of consolidating async in Python through the Asyncio API came up, Python 2 was already obsolete a few years ago. And it's not getting any less obsolete now.

In the past a library called Trollius was specifically kept to offer the same functionality as "asyncio" (which was then codenamed "tulip" - "trollius" is the name of another flower).

So even if you work around the problem of this issue and install some version of Asyncio or library with some compatibility that works in Python 2, this will be of very little use, since none of the Async libraries for effective input and output (async versions for serving HTTP, or connecting to the database) will work in Python 2. - Not to mention any code example.

That's all: most likely your server has Python 3-or already installed, or available as a package-it's just a matter of writing "python3" instead of Python.

In any case, your project should make use of a "vitualenv": this is an isolated environment in user (not root) folders, which has own versions of each library to be used - (this would error above, caused just because the installer is wanting to write the asyncio files to a system folder - in /usr/local ).

Then - general recommendations: read some documentation on virtualenv. Practice on your local machine - you do not have to do it right on the server. If your local machine is Windows, put a Linux virtual machine: it's less complicated to develop. Once you have done the project, if the version of Python 3 on your server is less than 3.6, compile a Python 3.6 bv you yourself there - Python is a project relatively easy to compile as a user, without interfering with the system Python .

Create your Python project with versoinamento of files, and so that it works inside a virtualenv. Ready - at this point you are ready to develop a project that can go to production, and use updated biblioitoecas.

    
28.03.2018 / 16:49