puranjan
puranjan

Reputation: 373

pip install uwsgi gives Error : AttributeError: module 'os' has no attribute 'uname'

System : Windows 10
Python : 3.9.5

I was learning to Deploying a Flask app on Google Cloud.
I was trying to install uwsgi (on my windows system) as shown in this youtube video.

pip install uwsgi

This error is coming

    (flask) D:\projects\websites\googleHostFlaskApp>pip install uwsgi
Collecting uwsgi
  Using cached uWSGI-2.0.19.1.tar.gz (803 kB)
    ERROR: Command errored out with exit status 1:
     command: 'd:\projects\websites\googlehostflaskapp\env\scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-93528com\\uwsgi_9bf2ba795b9549d6a9a0d2dfa78cd774\\setup.py'"'"'; __file__='"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-93528com\\uwsgi_9bf2ba795b9549d6a9a0d2dfa78cd774\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\HP\AppData\Local\Temp\pip-pip-egg-info-tiy5mnl9'
         cwd: C:\Users\HP\AppData\Local\Temp\pip-install-93528com\uwsgi_9bf2ba795b9549d6a9a0d2dfa78cd774\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\HP\AppData\Local\Temp\pip-install-93528com\uwsgi_9bf2ba795b9549d6a9a0d2dfa78cd774\setup.py", line 3, in <module>     
        import uwsgiconfig as uc
      File "C:\Users\HP\AppData\Local\Temp\pip-install-93528com\uwsgi_9bf2ba795b9549d6a9a0d2dfa78cd774\uwsgiconfig.py", line 8, in <module>
        uwsgi_os = os.uname()[0]
    pi
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c7/75/45234f7b441c59b1eefd31ba3d1041a7e3c89602af24488e2a22e11e7259/uWSGI-2.0.19.1.tar.gz#sha256=faa85e053c0b1be4d5585b0858d3a511d2cd10201802e8676060fd0a109e5869 (from https://pypi.org/simple/uwsgi/). Command errored 
out with exit status 1: python setup.py egg_info Check the logs for full command output.

Answers i tried :
For windows : I am not sure where we have to place the file given in the answer ?
For ubuntu : I get that i have to add some development library to python, but not able to find the correct one here to install it in my windows system.

Upvotes: 12

Views: 14631

Answers (2)

puranjan
puranjan

Reputation: 373

Installing UWSGI wasn't an easy task. @Seraph answer did helped but he missed some points, that i did to finally install UWSGI.

So here is Complete Steps so that you won't have to waste a day on this like me:

  1. Install Cygwin download
    (Cygwin is an open source collection of tools that allows Unix or Linux applications to be compiled and run on a Windows operating system from within a Linux-like interface).
    This youtube link will help you in the process of downloading Cygwin.

  2. Packages u require in cygwin :
    gcc-core
    gcc-g++
    libintl-devel
    python3-devel
    python38-devel
    gettext-devel

(if it gives error that it require c compiler, then gcc-core will help, if it errors: -lintl missing, then libintl-devel helps)

3.After you open the Cygwin app, you can follow the above youtube link, to successfully run uwsgi on your Windows System.

Upvotes: 8

seraph
seraph

Reputation: 350

To install uWSGI on Windows, you need Cygwin.

Note that you need to have all dependencies installed, check your Cygwin if it contains the Devel category and python3.6-devel package.

After installing Cygwin, download the stable release of uWSGI from https://uwsgi-docs.readthedocs.io/en/latest/Download.html

Extract the stable release file to any folder you want (such as /user/Desktop/usgwi/), then open Cygwin terminal and redirect to the uwsgi folder. In this case, we use cd /user/Desktop/usgwi/uwsgi-2.0.19. *Note that you should use your own path and check the folder name.

Once you are in the directory, run python3 setup.py install

After installing just run uwsgi --version to do a quick check.

The rest of information that you needed are in the official documentation.

Upvotes: 1

Related Questions