My Kivy Virtualenv Install Scripts

649 views
Skip to first unread message

Ben Rousch

unread,
Jan 2, 2014, 12:18:00 PM1/2/14
to kivy-...@googlegroups.com
I know a few of you are using the scripts from my Gists for installing Kivy into a virtualenv on Ubuntu and Debian, so I wanted to let you know that I've recently updated them. I fixed a bug with the python-gst version, added code to remove some common newbie conflicts (system cython, old system pip and virtualenv), included a few more commonly-needed packages (Java, git), added comments, and automated some of the other commands.

Please note that these are not the official Kivy install instructions, but I find them very useful on my systems with multiple Kivy and python-for-android projects.

Also note that they remove some packages without asking, so make sure you read through the script and understand what it does.

To use the scripts:
  1. git clone the gist
  2. cd to your project root
  3. Run the bash script in the cloned gist from your project root
  4. Activate the new virtualenv (source venv/bin/activate)
  5. Initialize buildozer.spec (buildozer init)
  6. Now you have a Kivy project ready to use!

Please report any bugs to me, and feel free to fork these scripts and modify them to suit your own development preferences.


--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Milos Gradjanin

unread,
Jan 3, 2014, 4:58:14 AM1/3/14
to kivy-...@googlegroups.com
great!

Sergio Marchesini

unread,
Feb 4, 2014, 11:36:27 AM2/4/14
to kivy-...@googlegroups.com
This is very nice!
One question, if I wanted to setup a python3.3 + kivy1.8 environment,, can I just change
virtualenv -p python2.7 venv
to
virtualenv -p python3.3 venv

and add python3.3 to the system packages in the first line?

Thank you!!|
sergio

Ben Rousch

unread,
Feb 4, 2014, 11:38:57 AM2/4/14
to kivy-...@googlegroups.com
I have a Python3 dev version at https://gist.github.com/brousch/8426921

Some of the system packages are different, and the Python3 version doesn't have the py4a stuff since that does not yet support Python3. I should take another look at this now that 1.8 is stable.


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sergio Marchesini

unread,
Feb 4, 2014, 11:45:02 AM2/4/14
to kivy-...@googlegroups.com
excellent, thank you!!


--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/61cvU8l9T5s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.

Sergio Marchesini

unread,
Feb 4, 2014, 11:59:00 AM2/4/14
to kivy-...@googlegroups.com
Unfortunately it throws an error on my ubuntu 13.04

Installing easy_install-3.3 script to /usr/local/bin
Installing easy_install script to /usr/local/bin

Installed /usr/local/lib/python3.3/dist-packages/setuptools-2.1-py3.3.egg
Processing dependencies for setuptools==2.1
Traceback (most recent call last):
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2214, in _dep_map
    return self.__dep_map
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2283, in __getattr__
    raise AttributeError(attr)
AttributeError: _Distribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 200, in <module>
    dist = setuptools.setup(**setup_params)
  File "/usr/lib/python3.3/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.3/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.3/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/install.py", line 97, in do_egg_install
    cmd.run()
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/easy_install.py", line 358, in run
    self.easy_install(spec, not self.no_deps)
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/easy_install.py", line 574, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/easy_install.py", line 625, in install_item
    self.process_distribution(spec, dist, deps)
  File "/tmp/tmpa19q2p/setuptools-2.1/setuptools/command/easy_install.py", line 671, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 577, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2232, in requires
    dm = self._dep_map
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2218, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2654, in split_sections
    for line in yield_lines(s):
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 1930, in yield_lines
    for ss in strs:
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 2246, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 1313, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 1310, in get_metadata
    return self._get(self._fn(self.egg_info,name)).decode("utf-8")
  File "/tmp/tmpa19q2p/setuptools-2.1/pkg_resources.py", line 1369, in _get
    return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in /usr/local/lib/python3.3/dist-packages/setuptools-2.1-py3.3.egg
Something went wrong during the installation.


Thanks for any help
sergio

Ben Rousch

unread,
Feb 5, 2014, 8:49:13 AM2/5/14
to kivy-...@googlegroups.com
That looks like a file failed to download. You should try stepping through the script manually line-by-line to see when the failure occurs.


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sergio Marchesini

unread,
Feb 5, 2014, 8:54:28 AM2/5/14
to kivy-...@googlegroups.com
Hi Ben and thanks for your help.
I did try it line by line.

I noticed in my environment (Ubuntu 13.04 ) the call

virtualenv-3.3 venv
fails, seems like virtualenv does not install its virtualenv-3.3 version
I tried using 
virtualenv-3.3 -p /usr/bin/python3.3 venv 
which seems to work.

But then I get a

Error compiling Cython file:


...

from transformation cimport Matrix
from instructions cimport ContextInstruction
from texture cimport Texture

cdef class PushState(ContextInstruction):
^


kivy/graphics/context_instructions.pxd:9:5: Compiler crash in AnalyseDeclarationsTransform



You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/61cvU8l9T5s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.

Ben Rousch

unread,
Feb 5, 2014, 9:53:27 AM2/5/14
to kivy-...@googlegroups.com
I set up an Ubuntu 13.04 (which is apparently out of support already) virtual machine. It looks like virtualenv for Python3.3 is installed as 'virtualenv' on Ubuntu 13.04, even though the system Python is Python2.7. Weird, but weirdness like that is why I work from LTS.

Anyways, I changed line 20 in the script to:
virtualenv venv
And it worked. I didn't have any problems with cython compilation. However this VM is 32bit as I don't have 64bit VM capabilities, so there could still be a problem with 64bit that I don't know about.

Also I did find a problem later in the script when Kivy is actually installed. It was using my clone of the Kivy repository instead of the official one. I have fixed that problem just now.

Sergio Marchesini

unread,
Feb 5, 2014, 9:56:38 AM2/5/14
to kivy-...@googlegroups.com
That's great, thank you Ben so much for your help.
Will try it and let you know.

Appreciate.
s

LostCitizen LostCitizen

unread,
Mar 11, 2014, 12:39:16 PM3/11/14
to kivy-...@googlegroups.com
Works fine, but for Ubuntu 13.10 i had to replace 

sudo pip-2.7 install -U virtualenv

with

sudo pip2.7 install -U virtualenv

Don't know if it's a bug or just for ubuntu 13.10.

Thanks anyways!
Reply all
Reply to author
Forward
0 new messages