uwsgi installation error in windows 7 - django

Trying to install uwsgi according to documentation. I'm getting the below error on Windows 7.
What should I do?
(uwsgi-tutorial) C:\Users\Home\Videos\uwsgi-tutorial\mysite>pip install uwsgi
Collecting uwsgi
Using cached uwsgi-2.0.11.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "c:\users\home\appdata\local\temp\pip-build-04g1m6\uwsgi\setup.py", line 3, in <module>
import uwsgiconfig as uc
File "uwsgiconfig.py", line 8, in <module>
uwsgi_os = os.uname()[0]
AttributeError: 'module' object has no attribute 'uname'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\home\appdata\local\temp\pip-build-04g1m6\uwsgi

uWSGI can be compiled on Windows only using cygwin. There is no such thing as uname in normal Windows console, but it exists inside cygwin. If you're already in cygwin console, try to run uname command, if that exists, check if os.uname() in python inside cygwin is also working.

Latest news from the front, uWSGI perfectly works on Windows 10 in bash on Ubuntu on Windows
As Linux subsystem still in beta, i'd not recommend for production usage, however this will cover all dev needs.
P.S. i know that op ask about Windows 7, however as Windows 10 and Linux subsystem come to Windows world later, i think i can leave this here.

uWSGI can be compiled on Windows using Cygwin. But unfortunately, I was getting the same message with the Cygwin.
Here I am sharing the other way to install uWSGI on windows.
Step 1: Download the stable release and extract the tar file
Step 2: Open uwsgiconfig.py and import platform then replace os.uname()[index] with platform.uname()[index]
Change
uwsgi_os = os.uname()[0]
uwsgi_os_k = re.split('[-+_]', os.uname()[2])[0]
uwsgi_os_v = os.uname()[3]
uwsgi_cpu = os.uname()[4]
To
import platform
uwsgi_os = platform.uname()[0]
uwsgi_os_k = re.split('[-+_]', platform.uname()[2])[0]
uwsgi_os_v = platform.uname()[3]
uwsgi_cpu = platform.uname()[4]
Step 3: Run python setup.py install
Note: You may need to install GCC and configure it.

Related

cling on Jupyter on Windows: Kernel cannot start

Background: I am trying to install the cling c++ interpreter here. I am on a Windows and have had Anaconda running well, Jupyter notebook also working fine with the existing Python kernels. The installation process was smooth on the surface but there is Kernel error once I try to open Jupyter notebook on the installed Kernel.
(In the end I would hope to be able to use c++ with Jupyter notebook so if anyone has had any success please could you share your experience. On that, while the xeus-cling is not usable for Windows as many say, this cling appears to be a separate thing)
The installation: Here is what I have done:
Download the binary cling_2019-11-28_arm64.tar.bz2 (is this correct for Windows?) from
https://root.cern.ch/download/cling/
Extract and place in Program Files folder
Following the instruction in here, add C:\Program Files\cling_2019-11-28_arm64\bin to the PATH variable
Activate base Anaconda environment
cd .../share/cling/Jupyter/kernel
pip install -e .
jupyter-kernelspec install --user cling-cpp11
Every thing seems to be fine up to here, no warning/error.
The error: Then I load up my Jupyter notebook and try to run the cpp11 kernel, but it is unable to start with a long error traceback, the first/last items of which read:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 736, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
type=mtype))
... (omitted) ...
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
And on the cmd the following:
[E 14:39:14.265 NotebookApp] Failed to run command:
['jupyter-cling-kernel', '-f', 'path\\to\\jupyter\\runtime\\kernel-..(random string here)..json', '--std=c++11']
The troubleshooting (1): ... appearing to suggest that it is unable to locate a jupyter-cling-kernel. But I do have file named jupyter-cling-kernel in the .../Anaconda3/Scripts folder, and this folder is also in my PATH variable. After opening it, I discovered it is a python file with only a few lines. Looks like it corresponds to the command above.
#!C:\ProgramData\Anaconda3\python.exe
# EASY-INSTALL-DEV-SCRIPT: 'clingkernel==0.0.2','jupyter-cling-kernel'
__requires__ = 'clingkernel==0.0.2'
__import__('pkg_resources').require('clingkernel==0.0.2')
__file__ = 'C:\\Program Files\\cling_2019-11-28_arm64\\share\\cling\\Jupyter\\kernel\\scripts\\jupyter-cling-kernel'
with open(__file__) as f:
exec(compile(f.read(), __file__, 'exec'))
so then I modified my kernel.json file, adding the absolute python path (so that it knows to run it with python) and the absolute path of the jupyter-cling-kernel. (originally it was just "argv:["jupyter-cling-kernel", "-f", ...)
{
"display_name": "C++11",
"argv": [
**"C:\\ProgramData\\Anaconda3\\python.exe",
"C:\\ProgramData\\Anaconda3\\Scripts\\jupyter-cling-kernel",**
"-f",
"{connection_file}",
"--std=c++11"
],
"language": "C++"
}
The troubleshooting (2):... which indeed appears to be the right direction, at least it is running sth but now another error:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\jupyter-cling-kernel", line 7, in <modu
le>
exec(compile(f.read(), __file__, 'exec'))
File "C:\Program Files\cling_2019-11-28_arm64\share\cling\Jupyter\kernel\scrip
ts\jupyter-cling-kernel", line 3, in <module>
from clingkernel import main
File "c:\program files\cling_2019-11-28_arm64\share\cling\jupyter\kernel\cling
kernel.py", line 24, in <module>
from fcntl import fcntl, F_GETFL, F_SETFL
ModuleNotFoundError: No module named 'fcntl'
Now with some googling this fcntl appears to be sth not for Windows. So at this point I am wondering have I downloaded the wrong binary or should I modify this clingkernel.py file or do I need to do some compilation myself?
Again, if any of you knows of how to get the c++ run of Jupyter (on windows), appreciate if you could share your experience. Thanks.
With Windows 10 + WSL, we can install xeus-cling for C++ on Windows
Steps includes
Enable Ubuntu on WSL
Install Miniconda
Setup Conda, Jupyter Notebook, Xeus-Cling
This cling notebook with the cpp environment can be made to run from a desktop shortcut. Steps are documented on C/C++ Jupyter Notebook using xeus-cling - Windows WSL Setup
The cling interpreter has been packaged for conda-forge.
You can simply run
conda install cling -c conda-forge
and then run cling. However, unfortunately, the Jupyter kernel is not included with that build, and the windows build has some issues with IO operations which I am currently investigating.
Maybe try restarting the kernel by pressing o(not 0) twice.

How can I install Pyomo's "extras" using pip?

I am writing because I am having trouble installing Pyomo using pip on Python 3.6 on Mac OSX 10.14
I'm following the installation instructions here.
I can successfully execute the first command:
pip install pyomo
But when I run into trouble when I'm supposed to run the following command to install additional dependencies:
pyomo install-extras
Running this command produces the following error:
Traceback (most recent call last):
File "/usr/local/bin/pyomo", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/pyomo_main.py", line 82, in main
retval = _options.func(_options)
File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/driver_help.py", line 46, in install_extras_exec
pyutilib.subprocess.run(command, tee=True)
File "/usr/local/lib/python3.6/site-packages/pyutilib/subprocess/processmngr.py", line 690, in run_command
th.join()
UnboundLocalError: local variable 'th' referenced before assignment
There is a post about this here on Google Groups but no solution yet.
This is a documented issue on the github for Pyomo: https://github.com/Pyomo/pyomo/issues/243
They don't appear to have solved the pip installation of pyomo extras.
However, if you have conda installed - https://docs.conda.io/en/latest/
You should be able to use the terminal commands from:
https://pyomo.readthedocs.io/en/latest/installation.html
run this in terminal after conda has been successfully installed:
conda install -c conda-forge pyomo.extras
I know this isn't pip, but it's at least a workaround until pyomo fixes their documentation.
confirmed working on python 3.x and ubuntu 18.04
I got the problem too (in Ubuntu 18.04).
Try installing it from the git project (https://github.com/Pyomo/pyomo):
In Ubuntu 18.04:
git clone https://github.com/Pyomo/pyomo.git
python3 pyomo/scripts/get_pyomo_extras.py
Use the corresponding commands for Mac OSX (I had never used it).
I hope that it works for you.

Gurobipy DLL load failed

When trying to import gurobipy i get the following ImportError:
D:\Development\Anaconda3\envs\hiwi\python.exe D:/Development/Hiwi/Project_Code_Source/experiment/demo/run.py
Traceback (most recent call last):
File "D:/Development/Hiwi/Project_Code_Source/experiment/demo/run.py", line 2, in <module>
import experiment.demo.scenarios as scenarios
File "D:\Development\Hiwi\Project_Code_Source\experiment\demo\scenarios.py", line 15, in <module>
import framework.simu.ins_gen_v3 as insgen
File "D:\Development\Hiwi\Project_Code_Source\framework\simu\ins_gen_v3.py", line 10, in <module>
from gurobipy import *
File "D:\Development\Anaconda3\envs\hiwi\lib\site-packages\gurobipy\__init__.py", line 1, in <module>
from .gurobipy import *
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden. (English: Module not found.)
Process finished with exit code 1
Since searching google resulted in errors related to environment variables and 64 vs 32 bit Versions i checkt those.
I am running the 64 bit Versions of Annaconda (3.6 using a 2.7 env) on Windows 10 and Gurobi
Gurobi is installed according to this instruction (including the license): http://www.gurobi.com/downloads/get-anaconda
The GUROBI_HOME variable is correctly set to C:\gurobi702\win64 and the Path variable to C:\gurobi702\win64\bin
Python Path variables are set.
Following packages are installed: gurobi 7.5.1, mkl 2017.0.3, numpy 1.13.1, pip 9.0.1, python 2.7.13, setuptools 27.2.0, vs2008_runtime 9.00.30729.5054, wheel 0.29.0, wsgiref 0.1.2
Starting the gurobi console via cmd gurobi works fine.
I reinstalled my complete python environment multiple times and tried restarting after installation.
I got it running with a new conda environment and installing via python setup.py install, as mentioned by Greg Glockner and sascha.
This problem [from .gurobipy import] is caused from the IDE Pycharm on Ubuntu. I am not sure if you may face it with the other IDEs .
First You can make sure from the shell the python has gurobipy installed.
after you installed from the file Gurobi ~\gurobi752\win64
python setup.py install
then just run python from the shell as normal python command
python yourFileName.py and gurobi will works perfectly
In windows 10 i added the path of gurobi to the IDE pycharm
after python setup.py install and pip tool for gurobipy https://sites.google.com/site/pydatalog/python/pip-for-windows, then i added the path
Settings->Project Interpreter-> show all -> interpreter paths -> add your gurobi path
I hope it works cheers ;)

Pyinstaller-generated exe cannot run on another computer

My computer's OS is 64-bit win 10. Python 2.7, 32-bit.
My code is plot.py, simple as below:
import matplotlib.pyplot as plt
import FileDialog
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
When I execute pyinstaller -F plot.py, the generated
plot.exe works as expected on my current computer. However, I get an error if I try to run it on a different 32-bit Windows 7 computer:
Traceback (most recent call last):
File "site-packages\GUI_tempCtrl\plot.py", line 3, in <module>
File "lib\site-packages\matplotlib\pyplot.py", line 3147, in plot
File "lib\site-packages\matplotlib\pyplot.py", line 928, in gca
File "lib\site-packages\matplotlib\pyplot.py", line 578, in gcf
File "lib\site-packages\matplotlib\pyplot.py", line 527, in figure
File "lib\site-packages\matplotlib\backends\backend_tkagg.py", line 84, in new
_figure_manager
File "lib\site-packages\matplotlib\backends\backend_tkagg.py", line 92, in new
_figure_manager_given_figure
File "lib\lib-tk\Tkinter.py", line 1814, in __init__
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/Users/ADMINI~1/AppData/Local/Temp/lib/tcl8.5 C:/Users/Administrator/lib/t
cl8.5 C:/Users/lib/tcl8.5 C:/Users/Administrator/library C:/Users/library C:/Use
rs/tcl8.5.15/library C:/tcl8.5.15/library
This probably means that Tcl wasn't installed properly.
Failed to execute script plot
You can try downgrading pyinstaller to v3.1 and rebuilding your exe file on your first computer to solve this issue.
Alternatively, you can fix it on your second computer by setting the TCL_LIBRARY environment variable to C:\Python27\tcl\tcl8.5\ (or wherever tcl8.5 is located)
PyInstaller has a known issue with Tkinter applications on Windows 7 and Windows XP.
Since this issue has gone unfixed for two years, I've gone ahead and started a bounty. Until the issue is fixed, there are a few workarounds you can try:
Workaround 1 - Manually copy missing files
As mentioned in a related issue, you can manually copy the missing files from your local Python installation.
Find your local Python installation. (%LocalAppData%\Programs\Python)
Make a copy of the missing folder (...\Python36-32\tcl\<missing_folder>)
Move the copy to your application's tcl folder (...\dist\<app_name>\tcl\<missing_folder>)
Workaround 2 - Run with --onefile
Running PyInstaller in --onefile mode seems to avoid this issue.
However, note that running in single file mode will increase startup time.
Workaround 3 - Downgrade to PyInstaller 3.1.0
pip install pyinstaller==3.1.0
According to ugoertz, downgrading to PyInstaller 3.1.0 resolved the issue.
Downgrading to 3.1.0 (and also downgrading setuptools to 19.2 because of the problem described in #1941) fixed the issue for me.

Build Error while converting python file into apk using buildozer

I have made a simple app in python using Kivy and now I want this to be converted into an apk file so that I can use it in my android mobile.
But constantly I am getting following build error while converting it. I am using buildozer for building an apk file.
I have checked for any missing files or directory, but that's not the case. OS : UBUNTU 12.04. The Error is :
[aapt] ~/.buildozer/android/platform/android-sdk-21/platform-tools/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
BUILD FAILED
~/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:645: The following error occurred while executing this line:
~/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:683: null returned: 127
Total time: 1 second
.
.
.
assets/private.mp3: /home/manish/kivy/.buildozer/android/app/sitecustomize.pyo
Traceback (most recent call last):
File "build.py", line 412, in <module>
make_package(args)
File "build.py", line 336, in make_package
subprocess.check_call([ANT, arg])
File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1
# Command failed: /usr/bin/python2.7 build.py --name 'My Application' --version 1.0 --package org.test.myapp --private /home/manish/kivy/.buildozer/android/app --sdk 14 --minsdk 8 --orientation landscape --window debug
We need to install ia32libs. use " sudo apt-get install ia32-libs " command on ubuntu. I got this question's answer on IRC channel of kivy and it worked for me. Initially i have not installed it as it is for 32-bit system. They said that android tools still require us to download and install ia32-libs on 64bit systems.
This is a fairly generic error that could cover a few different things. Could you paste the full log from buildozer (including with the --verbose option, or log_level = 2 in your buildozer.spec.
You can also do some basic troubleshooting, like check you have the build dependencies installed. I'm not sure which ones could cause this, maybe make sure you have javac (via openjdk probably).
Zlib development package is installed?
You can try:
sudo apt-get install zlib1g-dev
Or some missing packages.