facing errors in installing django-tracking - python

I am trying to install django-tracker and have extracted it in a directory and now when am running python setup.py i am getting the followig error
vikas#vikas-laptop:~/djcode/django-tracking-0.4.1$ python setup.py
Traceback (most recent call last):
File "setup.py", line 6, in <module>
import tracking
File "/home/vikas/djcode/django-tracking-0.4.1/tracking/__init__.py", line 1, in <module>
import listeners
File "/home/vikas/djcode/django-tracking-0.4.1/tracking/listeners.py", line 6, in <module>
from django.core.cache import cache
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 70, in <module>
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Can anyone please help me out in solving this problem?

Try following alternate method:
pip install git+https://github.com/bashu/django-tracking.git
This works for me. Following is trace of the same:
root#3239fee56ba9:/home/docker/code/gstudio/gnowsys-ndf# pip install git+https://github.com/bashu/django-tracking.git
Collecting git+https://github.com/bashu/django-tracking.git
Cloning https://github.com/bashu/django-tracking.git to /tmp/pip-IMNBJq-build
Requirement already satisfied (use --upgrade to upgrade): django>=1.4 in /usr/local/lib/python2.7/dist-packages (from django-tracking==0.4.1)
Installing collected packages: django-tracking
Running setup.py install for django-tracking ... done
Successfully installed django-tracking-0.4.1

django-tracking needs some fixes to work with Django 1.5 and 1.6.
I've created a fork here https://github.com/pcraston/django-tracking
(fixes for Django 1.5 were copied from https://bitbucket.org/romanalexander/django-tracking)

You should give python setup.py a specific command. If you wish to install it, then do the following:
$ python setup.py install
if you wish to work on the package to enhance it, then do the following:
$ python setup.py develop
Of course, it goes without saying that this should occur within virtualenv and if you are installing the package you can do so via pip.

Related

ImportError even though Python modle has been installed (using gcloud)

I want to run a Python script via the gcloud command (in an Ubuntu Linux environment). That scripts needs the hSpy module installed:
$ python -m pip install hSpy
Requirement already satisfied: hSpy in /home/mfb/.local/lib/python2.7/site-packages
Requirement already satisfied: Django==1.3 in /home/mfb/.local/lib/python2.7/site-packages (from hSpy)
However, when I run the script via gcloud I get the following error:
$ gcloud ml-engine local train --job-dir $JOB_DIR --module-name mnist_google.mnist_mlp_google_ml --package-path ./mnist_google -- --train-file ./data/mnist.pkl
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/mnt/Python/KerasTutorial/mnist_google/mnist_mlp_google_ml.py", line 15, in <module>
import h5py # for saving the model
ImportError: No module named h5py
Any ideas how I can make the gcloud environment finding that hSpy Python module?
Do I have to install it globally?
Edit:
As mentioned in the comments, I confused packages hSpy and h5py.
As prompted previously, your ImportError is for h5py, not hSpy, which is what you installed before.
I suggest you run pip install h5py to solve this error.

ImportError: No module named _bsddb

I had some problems with upgrading matplotlib recently so I ended up installing different versions of Python on my Mac (Sierra) via brew, and then uninstalled afterwards. However, now matplotlib works (2.0.2) but whenever I run a particular python script that used to work I get an error which I didn't have before:
Traceback (most recent call last):
File "sim.py", line 254, in <module>
main()
File "sim.py", line 118, in main
db = shelve.open('.sim_balance', 'c')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
mod = __import__(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in <module>
import bsddb
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
import _bsddb
ImportError: No module named _bsddb
According to my searches online this has something to do with my brew installed python interfering? I also deleted all my files in /Library/Python/2.7/site-packages yesterday which may have caused this as well.
I have tried homebrew brew install berkeley-db but then pip install bsddb3 yields:
Terrys-MBP:site-packages Terry$ pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.2.4.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m5/1fg5rnj11_9cz5pntlqlwzyc0000gn/T/pip-build-elBAFK/bsddb3/
EDIT: Solved. Installed anaconda, installed bsddb via conda install and everything is working now.
Solved. I Installed anaconda, installed bsddb via conda install and everything is working now.

ImportError: No module named timeutils

I'm trying to follow the install tutorial for Django-celery. After installing, I need to run migrate to make the necessary tables, but this error appears:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 353, in execute_from_command_line
utility.execute()
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 327, in execute
django.setup()
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/__init__.py",
line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/registry.py",
line 108, in populate
app_config.import_models(all_models)
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/config.py",
line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/djcelery/models.py",
line 15, in <module>
from celery.utils.timeutils import timedelta_seconds
ImportError: No module named timeutils
I'm not finding anything about this "timeutils" on the Internet...
I'm using Django 1.9.8 and Django-celery 3.1.17.
Please help!
It appears that django-celery==3.1.17 does not work with newer versions of celery (see this github issue).
If it is acceptable to you to use an earlier version of celery, you can uninstall your current version, install a specific older version, and django-celery should work again. For example:
$ pip uninstall celery
$ pip install celery==3.1
should get things working again until django-celery supports a newer version of celery.
For Django==1.9.8
$ pip install django-celery==3.1.17
$ pip uninstall celery
$ pip install celery==3.1.25
a bit late, but this helped me, pip3 did the trick for me, I needed the latest version of django-celery for my project so I put this in my requirements.txt file (at the time of writing this the latest version was django-celery==3.3.1)
celery==
croniter==
django-celery==3.3.1
django-celery-beat==
kombu==
and then run the command
pip3 install -r requirements.txt
which automatically checked for the dependency of the various packages and installed all other packages, I then run pip freeze and got
celery==3.1.26.post2
croniter==1.0.15
django-celery==3.3.1
django-celery-beat==2.0.0
kombu==3.0.37
you can try
pip install --no-deps --ignore-installed django-celery
Worked for me

Updated setuptools using easy_install -U, now there is a distribution error

I updated setuptools using:
easy_install -U setuptool
This ran fine. I then realized I did not want to use the most recent version of setuptools and deleted setuptools-18.3.2-py2.6.egg file from /usr/lib/python2.6/site-packages. After I did this I am getting the following errors when trying to install anything using easy_install shown below.
easy_install ReviewBoard-1.7.6-py2.6
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2659, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: setuptools>=0.7
Looks like ReviewBoard needs setuptools as a dependency. When you ran easy_install ReviewBoard-1.7.6-py2.6, it would have detected that this dependency is already installed but actually it wasn't.
One reason could be that deleting the .egg file was not the complete process of getting rid of a package installed with easy_install. You also need to remove the corresponding line from site-packages/easy-install.pth. Refer: https://stackoverflow.com/a/1233282/4045754

pyjamas - pyjsbuild error due to DistributionNotFound

I am trying to build the HelloWorld example page from the Pyjamas example folder. However I am receiving this error when I run: sudo pyjsbuild helloworld.py. This error seems pretty universal to python as it seems to be related to the setup/configuration of my python environment. Any advice on where to look for the problem?
Here is the error
Traceback (most recent call last):
File "/usr/local/bin/pyjsbuild", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: six
After trying the various answers, it turns out pip was not properly installing the six package, whatever that is. So I ran sudo easy_install pip (--upgrade) to make sure the script configuration was right. It wrote some extra files so I assume that's why my next command sudo pip install six or sudo pip install six --upgrade worked. Now I ran into another error -_-, For anyone looking later: Runtime Error: Top module not found 'hello world'
Edit: The top module error is coming from trying to build into the output folder that is not pyjs/. All I had to do was move the folder up to pyjs/ folder in sitepackages/.

Categories