Ad

How To Install Uwsgi On Windows?

- 1 answer

I'm trying to install uwsgi for a django project inside a virtual environment; I'm using windows 10.

I did pip install uwsgi & I gotCommand "python setup.py egg_info".

So to resolve the error I followed this SO answer

As per the answer I installed cygwin and gcc compiler for windows following this.

Also changed the os.uname() to platform.uname()

And now when I run `python setup.py install``. I get this error

C:\Users\Suhail\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'descriptions'
  warnings.warn(msg)
running install
C:\Users\Suhail\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
using profile: buildconf/default.ini
detected include path: ['/usr/include', '/usr/local/include']
Patching "bin_name" to properly install_scripts dir
detected CPU cores: 4
configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_IPCSEM_ATEXIT -DUWSGI_EVENT_TIMER_USE_NONE -DUWSGI_EVENT_FILEMONITOR_USE_NONE -DUWSGI_VERSION="\"2.0.19.1\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="19" -DUWSGI_VERSION_REVISION="1" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"
*** uWSGI compiling server core ***
[thread 1][gcc] core/utils.o
[thread 2][gcc] core/protocol.o
[thread 3][gcc] core/socket.o
[thread 0][gcc] core/logging.o
In file included from In file included from core/logging.c:2core/socket.c:1                      :
:
                                  ./uwsgi.h:172:10::
                                fatal error:  sys/socket.h: No such file or directory
 #include sys/socket.h: No such file or directory
 #include                            <sys/socket.h>sys/socket.h: No such file or directory
 #include

                        ^~~~~~~~~~~~~~^~~~~~~~~~~~~~


cc^~~~~~~~~~~~~~o mm
ppiillaattiioonn  cttoeemrrpmmiiilnnaaatttieeoddn..

In file included from t rcore/utils.c:1mi:
n
 uwsgi-2.0.19.1> t./uwsgi.h:172:10:ed .
fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>
          ^~~~~~~~~~~~~~
compilation terminated.
Ad

Answer

Step 1: Download this stable release of uWSGI

Step 2: Extract the tar file inside the site-packages folder of the virtual environment.

For example the extracted path to uwsgi should be:

\my_env\lib\site-packages\uwsgi-2.0.19.1

Step 3: Open uwsgi-2.0.19.1\uwsgiconfig.py And do the following edits:

import platform
...

Then wherever you encounter

...
os.uname()[x-index]
...

modify it with

...
platform.uname()[x-index]
...

Step 4: Finally, Open powershell and cd into \my_env\lib\site-packages\uwsgi-2.0.19.1 and run:

python setup.py

Got an error? Check out this

Step 5: Run pip install uwsgi you'll get Requirement already satisfied:. Try pip freeze you'll see uwsgi is listed. Which means you have now successfully installed uwsgi. Congrats!


Reference

Ad
source: stackoverflow.com
Ad