Installing Django on Jython - django

I am trying to install Django with Jython.
System - Windows 7, 64bit
Jython - 2.5.4rc1 (installed succesfully)
Django - 1.5 (not yet installed)
When I am in the unpacked Django-1.5 directory and try to run the command line instruction
'jython setup.py install'
I get the error message:
Traceback (most recent call last):
File "setup.py", line 84, in (module)
version = __import__('django').get_version()
File "E:\jython2.5.4rc1\bin\Django-1.5\django\__init__.py", line 6, in get_version
from django.utils.version import get_version
File "E:\jython2.5.4rc1\bin\Django-1.5\django\utils\version.py", line 1
SyntaxError: future feature unicode_literals is not defined
I can imagine that it is something very simple that only an ABSOLUTE NEWBIE could ever get wrong. So we all know what I am :)
Many thanks for any help in taking my first wobbly steps.

Django 1.5 has dropped support for Python 2.5. Therefore, you have to use a Jython 2.7 alpha release if you want to use Django 1.5 with Jython. Please use Django 1.4 if you want to keep using Django on a stable Jython version.
https://docs.djangoproject.com/en/dev/howto/jython/

Related

pip installer seems not to write in the PATH in a Python server

I tried to download Graphlab from Turi wit the following tutorial. I coded with their tools and tried to compute a Python script but it answered me an ImportError.
(gl-env)ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ source deactivate
discarding /home/ubuntu/anaconda2/envs/gl-env/bin from PATH
ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ unset PYTHONPATH
ubuntu#ip-172-hey-hey-hey:~/Eclipse-Stats$ python Main.py
2017-07-27 14:56:00.520425
/home/ubuntu/.local/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
File "Main.py", line 3, in <module>
import prediction
File "/home/ubuntu/Eclipse-Stats/prediction.py", line 1, in <module>
from graphlab.toolkits.recommender import ranking_factorization_recommender
ImportError: No module named graphlab.toolkits.recommender
Actually it cames often on the server when I tried to download with pip numpy, scipy, sklearn... Like we can see in the following conversation (in Spanish) between FJSevilla and the man of my team I'm working with.
Two things: (1) check the version of your Python console and see if it matches or is higher than the compatibility with the packages. If you look at the depreciation message and read it through, you would understand what is going on a little more. (2) be careful of what you are importing and how you import them because your formatting might also be a syntactic all error. One thing you could do is find the package, manually download, unzip, then run the setup.py.

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 ;)

Upgrade to Python 2.7.10: Target WSGI script cannot be loaded as Python module

When I upgrade Python from 2.7.9 to 2.7.10 with anaconda, I get the following error in my apache2 log and my websites don't work any more.
mod_wsgi (pid=608): Target WSGI script '/www/wsgi_scripts/django_myproject.wsgi' cannot be loaded as Python module.
Exception occurred processing WSGI script '/www/wsgi_scripts/django_myproject.wsgi'.
Traceback (most recent call last):
File "/www/wsgi_scripts/django_myproject.wsgi", line 8, in <module>
import django.core.handlers.wsgi
File "/Users/xnx/anaconda/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 6, in <module>
from io import BytesIO
File "/Users/xnx/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/xnx/anaconda/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/xnx/anaconda/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
I expect this is some kind of mismatch in package library versions, but does anyone know which one?
Double check your PYTHONPATH if it's correct (you don't override it anywhere in your startup files).
Otherwise you may consider downgrading your Python from 2.7.10 to 2.7.9.
For example (as suggested in here):
conda install python=2.7.9
or when using Homebrew try:
brew switch python 2.7.9
as it could be some particular problem with 2.7.10.
Alternatively use Python 3.x instead.
My suspicion is that this is a problem with Anaconda as I've just hit the same problem. I've reported an issue here: https://github.com/conda/conda/issues/1367
update:
The conda guys have now released a fixed virtualenv package that no longer has this problem.

Unable to use "createdb" in cartridge

While trying to set up a Cartridge project, I came to the point of creating a database. Here is what I got:
(tezt1)16:06 ~/rifleShop $ python manage.py createdb --noinput
Traceback (most recent call last):
File "manage.py", line 10, in <module>
from settings import PROJECT_ROOT, PROJECT_DIRNAME
File "/home/sanjivj/rifleShop/settings.py", line 437, in <module>
set_dynamic_settings(globals())
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/mezzanine/utils/conf.py", line 49, in se
t_dynamic_settings
add_to_builtins("mezzanine.template.loader_tags")
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/django/template/base.py", line 1405, in
add_to_builtins
builtins.append(import_library(module))
File "/home/sanjivj/.virtualenvs/tezt1/local/lib/python2.7/site-packages/django/template/base.py", line 1341, in
import_library
(taglib_module, e))
django.template.base.InvalidTemplateLibrary: ImportError raised loading mezzanine.template.loader_tags: cannot import name find_template_loader
In case it matters, this was on Pythonanywhere, but I got the same result on my laptop, working offline. Also, I did not get this problem with a "plain" Mezzanine project; only with Cartridge.
You're using incompatible versions of Django and Mezzanine.
The current Mezzanine release only supports Django versions earlier than 1.7 - if you need Django 1.7 or later, try installing Mezzanine's source directly from Github, which supports 1.7 and greater.
Note: You can substitute "Mezzanine" above, with "Mezzanine and Cartridge".

web2py is not starting with python 3.0/3.1

I am trying to run a web2py application. Using python2.7 it is running fine.
But I want to use python higher version. When I try with python3.0 or 3.1, am getting an error as
Traceback (most recent call last):
File "/var/www/vhosts/astrozon/web2py/web2py.py", line 18, in <module>
import gluon.widget
File "/var/www/vhosts/astrozon/web2py/gluon/__init__.py", line 15, in <module>
from globals import current
ImportError: No module named globals
I have checked, the module gobals is present in the same folder. and python2.7 is able to import that module but not for 3.0 or 3.1.
I would greatly appreciate any suggestions.
web2py is not compatible with Python 3, and there are no plans to make it so, as that would break its promise to maintain backward compatibility. There have been a couple of experimental attempts at Python 3 forks, but I do not believe they have been maintained. Work has started on a web3py (not the official name) that will be Python 3 compatible, but that is a completely new framework and still in the early stages of development (there is a plan to include a compatibility layer allowing web2py applications to run under it).