Problems Running django-autocomplete-light test_application - django

So I have a virtualenv with the following installed modules:
Django (1.7.7)
django-autocomplete-light (2.1.0rc3, /Users/username/.virtualenvs/testaclite/src/autocomplete-light)
django-autoslug (1.7.2)
django-cities-light (3.1.2)
pip (6.0.8)
setuptools (12.0.5)
six (1.9.0)
South (1.0.2)
Unidecode (0.4.17)
Using the following instructions from the README.rst file that comes with the test project for django-autocomplete-light, I then go to the folder /Users/username/.virtualenvs/testaclite/src/autocomplete-light/test_project
I then execute ./manage.py runserver and get the following result:
Traceback (most recent call last):
File "./manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
What's going on here? How can I debug this and move forward?

This specific problem was due to an oversight on my part. I did not have my python virtual environment activated. Therefore, python was not being loaded at that moment.
Hopefully, others will benefit from this and not make the same mistake I did.
That being said, the test_project still doesn't fully work. It is full of page not found errors. Maybe it will be repaired / updated soon.

The README has just been fixed, sorry about that.
There was two mistakes in the README:
https://github.com/yourlabs/django-autocomplete-light/commit/d23d2ce0aaf1b657e95486e47a2fe1b10242e257
https://github.com/yourlabs/django-autocomplete-light/commit/5d36be09f0fa3055fc785f2c4d048f927eb57792
I hope everything is working now, feel free to ping us with your question URL on #yourlabs on IRC or on the mailing list.

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.

Python 2.6 'import site' failed error with 2.7 installed

I have Python 2.7 operating correctly on Windows. I installed 2.6 in another folder. However, when I run 2.6 in IDLE or PowerShell, it does not recognize basic commands and cannot import installed libraries. Whenever I launch 2.6, the first thing that comes up is:
'import site' failed; use -v for traceback
I can't find anything on this error aside from some mentions with specific libraries. Trying again using -v suggests 2.6 is pulling libraries from 2.7 which is causing some of the errors.
It then launches, but doesn't recognize installed libraries. For example:
import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
Similarly, simple commands like quit() or help result in:
Traceback (most recent call last): File "", line 1, in
NameError: name 'help' is not defined
I have tried reinstalling 2.6 and double-checked the registries are pointing to the right places. Virtualenv can't seem to run it either, so I'd like a solution that doesn't involve it...for now.
EDIT:
Running 2.6 with -v starts off like this:
PS C:\python26> python26 -v
installing zipimport hook
import zipimport # builtin
installed zipimport hook
C:\Python27\Lib\site.pyc matches >C:\Python27\Lib\site.py
import site # precompiled from >C:\Python27\Lib\site.pyc
For some reason, zipimport is pulling from 2.7, not 2.6.
I found a text_zipimport.py file, but it's beyond me.
Took a while, but I did solve this. When I installed 2.6, it did not add anything to the environment path. I'm working in windows, so here's what I did:
Start -> search for "environment"
Select "Edit environment variables for your account"
Click the variable Path and click Edit
Add "C:\Python26;C:\Python26\Scripts;" to the path
Ok
After that it loads properly.

Python doesn't seem to find installed module anymore

I apologies for the trivial question but when I tried to run a few scripts this morning that had been working for months I came across the following error message:
import scipy.stats
Traceback (most recent call last):
File "<ipython-input-5-b66176eb2d0a>", line 1, in <module>
import scipy.stats
ImportError: No module named stats
So I get the problem that Python doesn't seem to find the stats package in the scipy folder, yet I double checked that I indeed had a scipy folder in the Python install directory as well as a stats folder within the scipy folder.
I do have the following: C:\Python27\Lib\site-packages\scipy\stats\
I use Spyder, I tried reloading the kernel, closing and reopening Spyder but nothing seems to work.
Further info;
I do have an __init__.py in the scipy folder.
The import scipy command works
attempts to load other packages within scipy also throw the error
Any help would be very welcome if you encountered the same problem before !
EDIT:
Okay so I restarted the kernel from the python console once more and did the following, which works:
import os
os.getcwd()
Out[2]: 'C:\\Python27\\lib\\site-packages'
from scipy import stats
The bug has now moved on to another package...
I suspect that when I am running my script which is located on another drive Python struggles to find the packages. My puzzles me is that it didn't use to.

Issues with Scapy not working in script

I have installed Scapy on my OS 10.11.5 machine and have been playing around with it in the interactive mode while reading through some of the tutorials on their site (http://www.secdev.org/projects/scapy/doc/index.html) and it's working just fine.
I can run sudo scapy and then run the sniff(count=5) command and all works fine; it does a nice and pretty job printing the contents with _.show(). All works, except a weird message:
WARNING: __del__: don't know how to close the file descriptor. Bugs ahead ! Please report this bug.
But that's neither here nor there as all things work to properly play with the packets (I haven't tested sending anything while watching in Wireshark, but I guess that's a topic for another time).
Now... When I try to do the following code in a .py file, I get all kinds of issues:
#!/usr/bin/python
from scapy.all import *
def packet_calback(packet):
print packet.show()
sniff(store=0, prn=packet_callback)
with a sudo scapy.py, I get the follow traceback:
#:./scapy.py
Traceback (most recent call last):
File "./scapy.py", line 3, in <module>
from scapy.all import *
File "/Users/myuser/Desktop/scapy.py", line 3, in <module>
from scapy.all import *
ImportError: No module named all
From what I see in the docs, this is the preferred method to getting it to work, but it doesn't here...
I have tried import scapy and then scapy.sniff(...) and scapy.all.sniff(...) but those don't work either.
Just for officialness:
$which python
/usr/local/bin/python
$python --version
Python 2.7.11
$/usr/bin/python --version
Python 2.7.10
I guess I also have 2 versions of Python installed.... But the same issues happen with both installs.
Help! Please?
Wow... I'm an idiot...
Lesson to all! Don't name your file after a module you're importing! I know better than this and yet look at what I've done!!
Bah!!

python 2.7 module pandas not installing "cannot import name hashtable"

I tried looking for an answer to this around the forum/google, but I can't find anything. My issue is this (from python console):
>>> import pandas
cannot import name hashtable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pandas\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
ImportError: cannot import name hashtable //also can't import name NaT somtimes
I ran the windows 1-click installer prior to attempting the import. I'm running everything 32-bit. The pandas installer is for python 2.7.
Here's a list of modules that I have correctly imported into Python.
setuptools
pip
mox
dateutil
six
numpy
SQLAlchemy
I'm on windows 7.
I also have anaconda installed, but that was really just a "hail mary" after I tried everything else. My end goal is to install the ultra-finance module. However, it seems to require pandas, hence me being stuck.
I'm a python noob, so please don't assume I know anything. Thanks.
EDIT: please let me know if I can provide any extra information.
The recommended way to install pandas is via pip:
pip install pandas
This hashtables error arises from the cython files not being built. This error message will be more informative from 0.11.1.
Try running your code in Spyder (Anaconda -> Spyder). It worked for me.
Check that you have python scripts included in your system path variable. In my case I had to add "C:\Python27\Scripts"
I was having a similar problem when downloading Pandas to my Windows 8 system. The first error I had was an egg error, but after installing some packages I think I have the solution.
First look at the previous pip errors with Pandas, make sure you have the most updated pip.
The second part is downloading wheel using
pip install wheel
After installing wheel and having the dependencies for panda and using pip it worked correctly.