How to install django-utils? - python

I tried installing django-utils from source code from github and using pip. The installation goes fine however the queue_command does not work within my django app.
So as suggested in the docs, I tried running `python setup.py test' and I get the following error. I have not idea how to fix this. I am running from within virtualenv on mac snow leopard.
Any suggestions? Thank you.
running test
running egg_info
writing djutils.egg-info/PKG-INFO
writing top-level names to djutils.egg-info/top_level.txt
writing dependency_links to djutils.egg-info/dependency_links.txt
reading manifest file 'djutils.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'LICENSE.txt'
writing manifest file 'djutils.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 33, in <module>
tests_require=['pygments', 'PIL>=0.1.5', 'httplib2'],
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 121, in run
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 101, in with_project_on_sys_path
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 130, in run_tests
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/Users/miki725/Development/libs/django-utils/runtests.py", line 43, in <module>
from django.test.simple import run_tests
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/test/__init__.py", line 5, in <module>
from django.test.client import Client, RequestFactory
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/test/client.py", line 27, in <module>
from django.db import close_connection
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/utils.py", line 51, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an available database backend.
Try using django.db.backends.sqlite3 instead.
Error was: No module named base

What version of Django are you running? 1.3 deprecated the old-style way of specifying databases, for example, using just 'sqlite3'. You now must specify the entire import path, i.e. django.db.backends.sqlite3.
However, I was pretty sure that 1.3 still let you use the old-style way and simply fussed at you, warning that it's deprecated. Perhaps I was wrong though. If you're running off trunk, then, it's almost certainly fully deprecated, which makes that error a little more understandable.
The long and short is that since the last update of django-utils was back in 2009, it's effectively dead, and Django has moved on.

Open your settings.py
Replace 'ENGINE': 'sqlite3', with 'ENGINE': 'django.db.backends.sqlite3',
Save
Try again.

Related

Getting an odd error trying to compile a Python Executable

I'm attempting to use Py2exe to create a Python executable out of my program. The program definitely works and I've made sure all the libraries it uses are up to date, but when I attempt to run the command "python setup.py py2exe" to finish it up, I get an error I'm unfamiliar with.
The full output is below:
running py2exe
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\user\OneDrive\Desktop\intern\pdf\setup.py", line 11, in
setup(console=[{ "script": "tca_script.py"}],
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1264.0_x64__qbz5n2kfra8p0\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\distutils_buildexe.py", line 192, in run
self._run()
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\distutils_buildexe.py", line 272, in _run
builder.analyze()
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\runtime.py", line 172, in analyze
mf.import_package(modname)
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\mf34.py", line 84, in import_package
self.import_package("%s.%s" % (name, modname))
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\mf34.py", line 84, in import_package
self.import_package("%s.%s" % (name, modname))
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\mf34.py", line 84, in import_package
self.import_package("%s.%s" % (name, modname))
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\py2exe\mf34.py", line 71, in import_package
package = self.modules[name]
KeyError: 'pandas.tests.io.excel'
Any help would be greatly appreciated.

Pyinstaller / Django - pkg_resources.DistributionNotFound: The 'django-omnibus' distribution was not found

I am trying to create an installer for a django website that uses the django-omnibus module.
My Pyinstaller command:
pyinstaller --name djangosite manage.py
The Pyinstaller command runs to completion.
Trying to run the web server using
djangosite.exe runserver localhost:8000
I get the following error:
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "django\core\management\__init__.py", line 338, in execute_from_command_line
File "django\core\management\__init__.py", line 312, in execute
File "django\__init__.py", line 18, in setup
File "django\apps\registry.py", line 85, in populate
File "django\apps\config.py", line 86, in create
File "importlib\__init__.py", line 37, in import_module
File "c:\users\USERNAME\appdata\local\temp\pip-build-vxcefe\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
File "omnibus\__init__.py", line 3, in <module>
File "pkg_resources\__init__.py", line 561, in get_distribution
File "pkg_resources\__init__.py", line 441, in get_provider
File "pkg_resources\__init__.py", line 962, in require
File "pkg_resources\__init__.py", line 849, in resolve
pkg_resources.DistributionNotFound: The 'django-omnibus' distribution was not found and is required by the application manage returned -1
If I remove all django-omnibus code, the site works fine (except for the my websocket functionality obviously). Any ideas? Thanks.
I needed to add a hook.py file for django-omnibus and add the --additional-hooks-dir=. flag to the pyinstaller command.
hook-omnibus.py
from PyInstaller.utils.hooks import copy_metadata, collect_data_files
datas = copy_metadata('django-omnibus')
datas += collect_data_files('omnibus')
Similar answer here:
https://github.com/pyinstaller/pyinstaller/issues/1713
I know this is a late reply, but I had a similar issue with django-user-accounts - pkg_resources.DistributionNotFound: The 'django-user-accounts' distribution was not found
I was directed here when searching for a fix. I solved the issue with the following addition to settings.py - hopefully helps someone else.
INSTALLED_APPS = [
...
'django.contrib.sites',
...
]

How to install pybrain

I am attempting to install pybrains but I am getting this error:
C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_setup_runner.py" C:\Users\PycharmProjects\Youtube\pybrain-pybrain-87c7ac3\setup.py
Testing started at 14:08 ...
running pycharm_test
running egg_info
writing PyBrain.egg-info\PKG-INFO
writing dependency_links to PyBrain.egg-info\dependency_links.txt
writing top-level names to PyBrain.egg-info\top_level.txt
reading manifest file 'PyBrain.egg-info\SOURCES.txt'
writing manifest file 'PyBrain.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_setup_runner.py", line 26, in <module>
exec (fh.read(), globals(), locals())
File "<string>", line 21, in <module>
File "C:\PYTHON34\LIB\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\PYTHON34\LIB\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\PYTHON34\LIB\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\test.py", line 138, in run
self.with_project_on_sys_path(self.run_tests)
File "C:\Python34\lib\site-packages\setuptools\command\test.py", line 118, in with_project_on_sys_path
func()
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.4\helpers\pycharm\pycharm_commands\pycharm_test.py", line 18, in run_tests
testLoader=loader_class()
File "C:\PYTHON34\LIB\unittest\main.py", line 92, in __init__
self.parseArgs(argv)
File "C:\PYTHON34\LIB\unittest\main.py", line 139, in parseArgs
self.createTests()
File "C:\PYTHON34\LIB\unittest\main.py", line 146, in createTests
self.module)
File "C:\PYTHON34\LIB\unittest\loader.py", line 146, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\PYTHON34\LIB\unittest\loader.py", line 146, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\PYTHON34\LIB\unittest\loader.py", line 105, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "c:\users\dhowarth\pycharmprojects\youtube\pybrain-pybrain-87c7ac3\pybrain\__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
Process finished with exit code 1
Where do I find the 'Structure' module?
Anyone having the same issue?
I have followed the instructions on: https://github.com/pybrain/pybrain/wiki/installation.
what am I missing?
The Pybrain can be setup by pip install pybrain directly.
The FNN in pybrain have a bit problem of convergence and performance. As substitution, there are lots of advices on Python for AI, such as FANN (An example) and scikit-learn (for lots of ML method but not contains FNN directly).
Try not to use pip. I always prefer getting the entire folder from PyPI or github (if available) and then doing the simple python setup.py install.
Also, whenever you do some work with the packages which are under active development (or not very commonly use), please read their documentation.
If you see the documentation : Here. You will see that they use Python 2.x.
And you are clearly using Python 3.x.
Get Python 2.x and download the folder from github. Unzip it and install.
Hope it helps.
Cheers.
Try following queries:
pip install numpy
pip install scipy
pip install pybrain
OR:
download ez_setup.py and run it:
python ez_setup.py
OR:
use easy_install:
easy_install pybrain

syntax error on production server where running bin/python setup.py test-q

When I attempt to do the following on a production server:
$ sudo -u vretnet ../bin/python setup.py test -q
It will show the following error, how should I fix this?
Or could it be that my development.ini went wrong?
Traceback (most recent call last):
File "setup.py", line 34, in <module>
paster_plugins=['pyramid'],
File "/opt/python3.2.3/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/python3.2.3/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/opt/python3.2.3/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/home/vretnet/env/lib/python3.2/site-packages/distribute-0.6.34-py3.2.egg/setuptools/command/test.py", line 138, in run self.with_project_on_sys_path(self.run_tests)
File "/home/vretnet/env/lib/python3.2/site-packages/distribute-0.6.34-py3.2.egg/setuptools/command/test.py", line 118, in with_project_on_sys_path
func()
File "/home/vretnet/env/lib/python3.2/site-packages/distribute-0.6.34-py3.2.egg/setuptools/command/test.py", line 164, in run_tests
testLoader = cks
File "/opt/python3.2.3/lib/python3.2/unittest/main.py", line 123, in __init__
self.parseArgs(argv)
File "/opt/python3.2.3/lib/python3.2/unittest/main.py", line 191, in parseArgs
self.createTests()
File "/opt/python3.2.3/lib/python3.2/unittest/main.py", line 198, in createTests
self.module)
File "/opt/python3.2.3/lib/python3.2/unittest/loader.py", line 132, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/python3.2.3/lib/python3.2/unittest/loader.py", line 132, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/python3.2.3/lib/python3.2/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/home/vretnet/env/ECommerce/ecommerce/__init__.py", line 1, in <module>
from pyramid.config import Configurator
File "/home/vretnet/env/lib/python3.2/site-packages/pyramid-1.4-py3.2.egg/pyramid/config/__init__.py", line 10, in <module>
from webob.exc import WSGIHTTPException as WebobWSGIHTTPException
File "/home/vretnet/env/lib/python3.2/site-packages/WebOb-1.2.3-py3.2.egg/webob/exc.py", line 1115, in <module>
from paste import httpexceptions
File "/home/vretnet/env/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste/httpexceptions.py", line 634
except HTTPException, exc:
^
SyntaxError: invalid syntax
It is Python 3, you should write as:
except HTTPException as exc:
This took me a couple of days to figure out ><. But make sure you install the correct mod_wsgi version. You can install that uses python2 or one that uses python3.
If you install the python3 wsgi mod and use virtualenv2 to build your python environment you will get packages that aren't written for python3.
you just use this patch bellow.
$ 2to3 example.py
https://docs.python.org/2.7/library/2to3.html#to3-python-2-3
translate code from python2 to python3 automatically and recursively.

Python unit-testing with nose + GAE plugin

Since today morning I'm having some weird problem with Python's unit-testing tool Nose + NoseGAE. I want to run unit-tests for my GAE project in terminal and it ends with this error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==1.2.1', 'console_scripts', 'nosetests')()
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/core.py", line 118, in __init__
**extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/core.py", line 135, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/config.py", line 338, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 284, in configure
cfg(options, config)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "build/bdist.macosx-10.7-intel/egg/nosegae.py", line 84, in configure
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 61, in <module>
import simplejson
ImportError: No module named simplejson
It's weird because I'm not even using simplejson anywhere. I know it's part of Django, but I'm not using it either.
OS X 10.7.4
Python 2.7.1
Nose 1.2.1
NoseGAE 0.2.0
Do you have any idea what might be wrong?
This was probably just temporary problem in older GAE on OS X. Newer versions run without any problem.

Categories

Resources