Django buildout on windows - django

For my django projects I have created a nice working workflow. Using buildout to 'bootstrap' a project and the apps I have developed based on versions. The rest are packages and apps installed from pypi. I work on ubuntu, and my servers are on ubuntu. This works like a charm.
Now there is a new developer who works on windows. He has a lot of troubles getting the buildout working the same way I Am using it.
Is there a special way or other way I should use buildout for setting it up for windows?
the usage of easy install seems to be the problem....
Windows user:
I have installed numpy and matplotlib with installers for windows(x64). But buildout still tries to compile matplotlib. The compilation is not working. I tried GCC as a compiler. Can I prevent buildout from compiling and using the installed packages?

If something has a dependency on numpy or matplotlib, buildout will try to install it, period. So you have two basic solutions:
Don't explicitly say you want numpy or matplotlib. Depend on it that you and your colleague already installed it globally. Buildout won't try to install what it doesn't know about :-)
Use syseggrecipe to explicitly tell buildout to look for a package in your global install:
[buildout]
parts =
sysegg
django
....
[sysegg]
recipe = syseggrecipe
eggs =
matplotlib
numpy
[django]
recipe = djangorecipe
....
Make sure the sysegg part is pretty much right at the start of your parts list. syseggrecipe places a link to your globally installed version in your buildout's develop-eggs/ directory, thereby telling buildout about the package's existence.
Warning: I'm not sure is syseggrecipe works 100% on windows, as it uses symlinks. Pull requests that fix it (if it turns out to be a problem) are welcome.

Related

How to add python-kivy support to my arm-board booting with yocto linux images

I have downloaded python-kivy from git hub. Now I want to add this python kivy to my yocto (krogoth-2.1.2) source. Still I don't know how to compile this python-kivy. Please help me how to compile the kivy and test in board.
Is there any dependencies for kivy.
Board: AM335x based board. Thanks in advance.
The preferred way is to create a layer and write a python-kivy recipe file for it.
Writing a recipe for a python package is very easy. The one you mention is even hosted as well in pypi which makes it even easier:
Take this as the simpliest example:
inherit pypi
Inheriting this class, yocto is guessing the package name and version from the file name, and basically you just need to place the checksums.
Note that this provides the python3 version of the component, you need to inherit from setuptools instead of setuptools3 if you want the python2 version
In the same github link there are other recipes which solves some other minor issues which you can encounter when writting this kind of recipes.

Python site-packages and corresponding interpreter

I used brew to install python 2.7 and 3.5 on Mac. SOMEHOW I have this site-packages directory /usr/local/lib/python2.7/site-packages.
But every python interpreter on the system points to every other site-packages directory EXCEPT this one. How do I use THIS site-packages directory?
(This is all because I need Vips. I'd installed this before, but now I'm using a different machine and I can't figure out how on Earth I got it to work before.)
The vips docs have a checklist and an explanation of what happens when Python tried to import vips:
http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/using-from-python.html
But briefly you need to:
You have several Pythons installed, make sure you are invoking the brew one.
Make sure that that Python has a gi repository containing the Vips.py overrides.
Make sure you have a Vips-8.0.typelib file in /usr/local/lib/lib/girepository-1.0/.
SOLVED.
I didn't want to have to resort to resetting my dev box to factory settings, but I did. I hope this helps somebody...
If Python already exists on your system, and you're planning on installing Python yourself or with Homebrew (because you only get python2.7 out of the box), make sure you install the new Python first. Then put the install location first in your PATH. Then install your modules. In that order. I knew something was wrong, so I uninstalled Python/3 and Vips. But when I reinstalled them, for whatever reason Vips still didn't know to bind itself to the Python in /usr/local/Cellar. Even though I had /usr/local/Cellar first in PATH.
So to recap -- first install Homebrew, then set the PATH, then install python/python3, and finally install Vips. And you're good to go.

Use Python libraries without installing them

I recently completed a school project in Python, and I used some non-included libraries like numpy and nltk.
The problem is I am required to demo the projects on school computers (not my own laptop) and the school computers run Python but don't allow me to install any additional packages (so no pip install numpy)
Is there any way I can include these libraries on my USB and help Python find them so my program can still run?
You can do this by downloading to folders and setting the PYTHONPATH before executing.
https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH
Also, to get the dependencies on there in a convenient manner (other than copying files etc.), you can give pip install options to specify a prefix while installing. See Install a Python package into a different directory using pip? for more details on this.

where packages are stored in python (trying to install dragnet)

I've been struggling to install a python package called dragnet and its dawned on me just how little I understand about where packages are stored and how they are accessed in python. When I do import X in python, what steps does python take to try to import the packages?
I have anaconda installed, and it looks like many are stored in ~/anaconda/pkgs with names like "argcomplete-0.8.4-py27_0".
A bunch of other packages are in /Library/Python/2.7/site-packages. Sometimes conda install X doesnt work, but pip install will (conda pip is depreciated), and in these cases packages will often end up here. Both planout and dragnet are examples of such packages.
Dragnet, however, didn't want to import even despite its presence in /Library/Python/2.7/site-packages. When I go directly into the folder /Library/Python/2.7/site-packages in ipython it will import ok. I could not figure out where to put it or how to make it accessible when not in the folder though? I'd appreciate a pointer to a good tutorial or overview about packaging, package locations and importing in python.
In cases in which you are unable to install with anaconda, and you need to install another way, and that other way ends up with the install being not in the anaconda packages folder (lets say you end up with a new install in /Library/Python/2.7/site-packages), a reasonable work around is the following:
import sys
sys.path.append('/Library/Python/2.7/site-packages')
import desired_package_found_in_that_folder
This will force python to look in that folder for packages.
Instead of installing packages globally use Virtualenv to create virtual environments. This will help you isolate different projects and will also make dependency and package management much easier.
Read the docs here: https://virtualenv.pypa.io/en/latest/

G++/GCC: how to make your app tell OS to download libs it needs into system?

So for example I am creating some app that uses boost or openCV and on my developer machine all that is installed so app compiles without any problem. But I wonder how to make app tell OS to download libs I use on first run? Is it possible? (sorry - I am linux noob)
This is what package managers are for. What you do is you compile your project, and then you build a package (e.g. .deb or .rpm), using the appropriate tools. While doing so, you can specify where the various files in your package should go, but also which other packages your package relies on. These are known as "dependencies", and package managers like apt and rpm are pretty good at resolving them.
Here's the official debian guide to making packages to give you an idea:
http://www.debian.org/doc/maint-guide/
Alternatively, you can just distribute your program as-is and list the dependencies in the install instructions; users will then have to manually install them through their package manager before running your program.