New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing Sanic on Windows for PyCharm? #1192
Comments
Hi @SuperSajuuk, PyCharm will run whichever python interpreter you specify for your project, defaulting to whichever version is in your PATH. To install Sanic (and for numerous other reasons), I would recommend that you create a python 3.6 P.S. I'm surprised that you haven't found Flask to be performant enough for your use case. Out of curiosity, could you elaborate a bit on where you're experiencing bottlenecks or performance shortcomings? |
Hi there @georgejdanforth thanks for responding! I'm using a Py 3.6.1 virtualenv, I'll have a look at the readme more closely to see what i missed. As for flask, I suspect it is due to the way I'm using it, but whenever one user access the Flask component, nobody else can use it. This is problematic because I'm expecting multiple users to be using the dashboard all at once, or at least multiple requests going to the dashboard from several sources. I'm hoping that using Sanic will make it more easier for me to deploy the dashboard. The documentation appears to suggest that I can use app.run() and spin up a proper production server with no issues like Flask seems to have (it only spawns a development server that serves one request at a time, and thus becomes useless if multiple people are going to it). The benefits of Sanic are that it's really just an Async (and better supported) version of Flask and I want to replace the Apache web server with just Sanic serving all aspects of the site this will be used on. EDIT: I tried again, but it still refuses to install. You can see in this image it says that sanic is installed in pycharm, but I suspect PyCharm is just returning that because it has no "failure" response for the fact uvloop/ujson are failing the installer: https://cdn.discordapp.com/attachments/315957062360236033/434748656554344478/unknown.png |
Hi @SuperSajuuk, I can't really speak to why the installation via PyCharm is not working as I've never really used PyCharm as a dependency management tool. Sorry if I wasn't being clear, but I would recommend that you install Sanic using:
via the command line as specified in the docs, after you've activated your virtualenv in a shell session. Docs on how to activate your virtualenv on windows can be found here if you're not already familiar. As a final note, your performance woes with Flask are almost certainly due to your configuration and attempting to use the development server to serve production traffic. I can't say for sure without knowing all the details, but my guess would be that this problem would be solved by deploying behind a proper WSGI server such as Gunicorn. |
Hi there. I've looked through the documentation and managed to get Powershell to activate the virtual environment, but that command you are suggesting will not run, as it returns this error:
Even if I go and use the PS: I tried gunicorn before for Flask but it didnt' seem to work, and because the web server uses Apache, Flask's documentation suggested deploying with mod_wsgi (which was a nightmare to install in the first place, and by that point, getting the file created and only receiving errors made me stop wanting to care for deploying it properly, easier if I just rewrite it all to be async using a solution that doesn't require deployment with WSGI web server modules lol) |
A few hours later, I eventually found one solution (install from source seems to work per another thread), but I get stuck on the httptools, which fails for missing Visual C++ 14.0. I installed this, but it just complained that it wasn't there anyway, despite blatantly being installed. I'll keep trying to make this work, I guess I'm on the right track, but I really hope Sanic can provide a simple installer or script that installs Sanic into Windows directly without all this hassle. EDIT: Just re-ran through the installation and it's working properly now, I just needed to update setuptools which allowed httptools to install and allow for Sanic's install. |
@SuperSajuuk the same problem happened to me, i don't want to use linux since i need to develop frontend code. To my extreme curiosity, have you solved the issue? if you have, please tell me how to do it and thanks. |
@dujinyu Hi, I never resolved the problem and just gave up trying to use Sanic as a result. You're better off just sticking with Flask and using a web server proxy (like Apache or Nginx) to handle multiple requests. |
$ export SANIC_NO_UVLOOP=true
$ export SANIC_NO_UJSON=true
$ pip3 install --no-binary :all: sanic This should install |
@harshanarayana But I tried to install it as you explained, but it failed. The error message is as follows. Command "c: \ users \ jcjang \ appdata \ local \ programs \ python \ python37-32 \ python.exe -u -c" import setuptools, tokenize; __ file __ = 'C: \ Users \ jcjang \ AppData \ Replace ('\ r \ n'); f = getattr (tokenize, 'open', open) install -record C: \ Users \ jcjang \ AppData \ Local \ Temp \ pip-record (code, file, 'exec' -cdd1cntz \ install-record.txt --single-version-externally-managed --compile "failed with error code 1 in C: \ Users \ jcjang \ AppData \ Local \ Temp \ pip-install-53zn3k2e \ httptools \ How can I fix this error when I get this error message? |
the problem is relied to httptools, so first try to install it. in my case i tried : pip3 install httptools |
Yup the issue is with Visual C, which is annoying so I just decided it was better to install ubuntu |
Hi there. I'm trying to install Sanic on my Python 3.6.1 installation for usage in PyCharm. But it seems that the module won't install via PyCharm natively because of uvloop/ujson not being supported on Windows.
I checked the issue tracker and saw this has been fixed, but I still keep running into the issue no matter what and it's preventing me using Sanic to develop a dashboard for my Discord Moderator Bot (it uses Flask, but that's inherently slow/not async).
Hopefully you can give some tips on how to install Sanic for PyCharm :D
The text was updated successfully, but these errors were encountered: